Skip to content

Commit f6c2bb6

Browse files
committed
Fix: Add job draft date in job details
1 parent 0081995 commit f6c2bb6

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/actions/job.actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { handleError } from "@/lib/utils";
44
import { AddJobFormSchema } from "@/models/addJobForm.schema";
55
import { JobStatus } from "@/models/job.model";
66
import { getCurrentUser } from "@/utils/user.utils";
7+
import { revalidatePath } from "next/cache";
78
import { z } from "zod";
89

910
export const getStatusList = async (): Promise<any | undefined> => {

src/components/myjobs/JobDetails.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ function JobDetails({ job }: { job: JobResponse }) {
2424
const getAiJobMatch = async () => {
2525
setAiSectionOpen(true);
2626
};
27+
const getJobType = (code: string) => {
28+
switch (code) {
29+
case "FT":
30+
return "Full-time";
31+
case "PT":
32+
return "Part-time";
33+
case "C":
34+
return "Contract";
35+
default:
36+
return "Unknown";
37+
}
38+
};
2739
return (
2840
<>
2941
<div className="flex justify-between">
@@ -49,7 +61,7 @@ function JobDetails({ job }: { job: JobResponse }) {
4961
{job?.Company?.label}
5062
<CardTitle>{job?.JobTitle?.label}</CardTitle>
5163
<CardDescription>
52-
{job?.Location?.label} - {job?.jobType}
64+
{job?.Location?.label} - {getJobType(job?.jobType)}
5365
</CardDescription>
5466
</CardHeader>
5567
<h3 className="ml-4">
@@ -67,7 +79,7 @@ function JobDetails({ job }: { job: JobResponse }) {
6779
</Badge>
6880
)}
6981
<span className="ml-2">
70-
{format(new Date(job?.appliedDate), "PP")}
82+
{job?.appliedDate ? format(new Date(job?.appliedDate), "PP") : ""}
7183
</span>
7284
</h3>
7385
{job.jobUrl && (

src/components/myjobs/JobsContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function JobsContainer({
142142
const onChangeJobStatus = async (jobId: string, jobStatus: JobStatus) => {
143143
const { success, message } = await updateJobStatus(jobId, jobStatus);
144144
if (success) {
145+
router.refresh();
145146
toast({
146147
variant: "success",
147148
description: `Job has been updated successfully`,

0 commit comments

Comments
 (0)