Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
Add jobs table
Khuram Niaz9fd30cbf02c0
diff --git a/package-lock.json b/package-lock.jsonindex 8f16da8..af0e6c9 100644--- a/package-lock.json+++ b/package-lock.json@@ -19,6 +19,7 @@"@radix-ui/react-label": "^2.0.2","@radix-ui/react-popover": "^1.0.7","@radix-ui/react-progress": "^1.0.3",+ "@radix-ui/react-radio-group": "^1.1.3","@radix-ui/react-scroll-area": "^1.0.5","@radix-ui/react-select": "^2.0.0","@radix-ui/react-slot": "^1.0.2",@@ -1271,6 +1272,38 @@}}},+ "node_modules/@radix-ui/react-radio-group": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.1.3.tgz",+ "integrity": "sha512-x+yELayyefNeKeTx4fjK6j99Fs6c4qKm3aY38G3swQVTN6xMpsrbigC0uHs2L//g8q4qR7qOcww8430jJmi2ag==",+ "dependencies": {+ "@babel/runtime": "^7.13.10",+ "@radix-ui/primitive": "1.0.1",+ "@radix-ui/react-compose-refs": "1.0.1",+ "@radix-ui/react-context": "1.0.1",+ "@radix-ui/react-direction": "1.0.1",+ "@radix-ui/react-presence": "1.0.1",+ "@radix-ui/react-primitive": "1.0.3",+ "@radix-ui/react-roving-focus": "1.0.4",+ "@radix-ui/react-use-controllable-state": "1.0.1",+ "@radix-ui/react-use-previous": "1.0.1",+ "@radix-ui/react-use-size": "1.0.1"+ },+ "peerDependencies": {+ "@types/react": "*",+ "@types/react-dom": "*",+ "react": "^16.8 || ^17.0 || ^18.0",+ "react-dom": "^16.8 || ^17.0 || ^18.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "@types/react-dom": {+ "optional": true+ }+ }+ },"node_modules/@radix-ui/react-roving-focus": {"version": "1.0.4","resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.0.4.tgz",diff --git a/package.json b/package.jsonindex 2bd921d..0385fd1 100644--- a/package.json+++ b/package.json@@ -21,6 +21,7 @@"@radix-ui/react-label": "^2.0.2","@radix-ui/react-popover": "^1.0.7","@radix-ui/react-progress": "^1.0.3",+ "@radix-ui/react-radio-group": "^1.1.3","@radix-ui/react-scroll-area": "^1.0.5","@radix-ui/react-select": "^2.0.0","@radix-ui/react-slot": "^1.0.2",diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.tsindex 534b632..05c9e3f 100644--- a/src/actions/job.actions.ts+++ b/src/actions/job.actions.ts@@ -69,6 +69,9 @@ export const getJobsList = async (): Promise<any | undefined> => {Status: true,Location: true,},+ orderBy: {+ createdAt: "desc",+ },});return list;} catch (error) {@@ -165,19 +168,32 @@ export const addJob = async (throw new Error("Not authenticated");}+ const {+ title,+ company,+ location,+ type,+ status,+ source,+ salaryRange,+ dueDate,+ dateApplied,+ jobDescription,+ } = data;+const job = await prisma.job.create({data: {- jobTitleId: data.title,- companyId: data.company,- locationId: data.location,- statusId: data.status,- jobSourceId: data.source,- salaryRange: data.salaryRange,+ jobTitleId: title,+ companyId: company,+ locationId: location,+ statusId: status,+ jobSourceId: source,+ salaryRange: salaryRange,createdAt: new Date(),- dueDate: data.dueDate,- appliedDate: data.dateApplied,- description: data.jobDescription,- jobType: "fulltime",+ dueDate: dueDate,+ appliedDate: dateApplied,+ description: jobDescription,+ jobType: type,userId: user.id,},});diff --git a/src/app/dashboard/myjobs/page.tsx b/src/app/dashboard/myjobs/page.tsxindex 272178b..1218b28 100644--- a/src/app/dashboard/myjobs/page.tsx+++ b/src/app/dashboard/myjobs/page.tsx@@ -27,16 +27,20 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { MY_JOBS_DATA } from "@/lib/data/myJobsData";import { Metadata } from "next";import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";import { AddJob } from "@/components/AddJob";+import { getJobsList } from "@/actions/job.actions";+import { format } from "date-fns";+import { cn } from "@/lib/utils";export const metadata: Metadata = {title: "My Jobs | JobSync",};-function MyJobs() {+async function MyJobs() {+ const jobsList = await getJobsList();+ console.log("JOB OBJECT: ", jobsList[5]);return (<div className="col-span-3"><Card x-chunk="dashboard-06-chunk-0">@@ -95,9 +99,10 @@ function MyJobs() {<TableHeader><TableRow><TableHead className="hidden w-[100px] sm:table-cell">- <span className="sr-only">Company</span>+ <span className="sr-only">Company Logo</span></TableHead><TableHead>Title</TableHead>+ <TableHead>Company</TableHead><TableHead>Status</TableHead><TableHead className="hidden md:table-cell">Source</TableHead><TableHead className="hidden md:table-cell">Location</TableHead>@@ -110,7 +115,7 @@ function MyJobs() {</TableRow></TableHeader><TableBody>- {MY_JOBS_DATA.data.map((job) => {+ {jobsList.map((job: any) => {return (<TableRow key={job.id}><TableCell className="hidden sm:table-cell">@@ -118,25 +123,35 @@ function MyJobs() {alt="Company logo"className="aspect-square rounded-md object-cover"height="32"- src={job.companyLogo}+ src="/icons/amazon-logo.svg"width="32"/></TableCell>- <TableCell className="font-medium">{job.company}</TableCell><TableCell className="font-medium">- {job.jobTitle}+ {job.JobTitle?.label}+ </TableCell>+ <TableCell className="font-medium">+ {job.Company?.label}</TableCell><TableCell>- <Badge>{job.status}</Badge>+ <Badge+ className={cn(+ "w-[70px] justify-center",+ job.Status?.value === "applied" && "bg-cyan-500",+ job.Status?.value === "interview" && "bg-green-500"+ )}+ >+ {job.Status?.label}+ </Badge></TableCell><TableCell className="hidden md:table-cell">- {job.jobSource}+ {job.JobSource?.label}</TableCell><TableCell className="hidden md:table-cell">- {job.location}+ {job.Location?.label}</TableCell><TableCell className="hidden md:table-cell">- {job.dateApplied}+ {format(new Date(job.appliedDate), "MMM d, yyyy")}</TableCell><TableCell><DropdownMenu>diff --git a/src/components/AddJob.tsx b/src/components/AddJob.tsxindex e75e2ce..9201ee7 100644--- a/src/components/AddJob.tsx+++ b/src/components/AddJob.tsx@@ -10,16 +10,14 @@ import {} from "@/actions/job.actions";export async function AddJob() {- const [statuses, companies, jobTitles, locations, jobSources, jobs] =+ const [statuses, companies, jobTitles, locations, jobSources] =await Promise.all([getStatusList(),getCompanyList(),getJobTitleList(),getJobLocationList(),getJobSourceList(),- getJobsList(),]);- console.log("JOBS LIST: ", jobs);return (<><DialogHeader>diff --git a/src/components/AddJobForm.tsx b/src/components/AddJobForm.tsxindex c640dc4..b4a0f92 100644--- a/src/components/AddJobForm.tsx+++ b/src/components/AddJobForm.tsx@@ -9,7 +9,6 @@ import {FormLabel,FormMessage,} from "@/components/ui/form";-import { Input } from "@/components/ui/input";import { Textarea } from "./ui/textarea";import { z } from "zod";import { AddJobFormSchema } from "@/models/addJobForm.schema";@@ -19,12 +18,15 @@ import { toast } from "./ui/use-toast";import { Combobox } from "./ComboBox";import { DatePicker } from "./DatePicker";import SelectFormCtrl from "./Select";-import { JOB_SOURCES } from "@/lib/data/jobSourcesData";import { SALARY_RANGES } from "@/lib/data/salaryRangeData";-import { useState, useTransition } from "react";+import { useRef, useTransition } from "react";import { addDays } from "date-fns";import { addJob } from "@/actions/job.actions";import { Loader } from "lucide-react";+import { RadioGroup, RadioGroupItem } from "./ui/radio-group";+import { JOB_TYPES } from "@/models/job.model";+import { useRouter } from "next/router";+import { redirect } from "next/navigation";interface AddJobFormProps {jobStatuses: { id: string; label: string; value: string }[];@@ -41,13 +43,13 @@ export default function AddJobForm({locations,jobSources,}: AddJobFormProps) {- const [loading, setLoading] = useState(false);const [isPending, startTransition] = useTransition();const form = useForm<z.infer<typeof AddJobFormSchema>>({resolver: zodResolver(AddJobFormSchema),// mode: "onChange",defaultValues: {+ type: Object.keys(JOB_TYPES)[0],dateApplied: new Date(),dueDate: addDays(new Date(), 3),status: jobStatuses[0].id,@@ -61,15 +63,10 @@ export default function AddJobForm({startTransition(async () => {const res = await addJob(data);form.reset();- console.log("RESPONSE DATA: ", res);+ redirect("/dashboard/myjobs");});toast({- title: "You submitted the following values:",- description: (- <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">- <code className="text-white">{JSON.stringify(data, null, 2)}</code>- </pre>- ),+ description: "Job has been created successfully",});}@@ -128,6 +125,36 @@ export default function AddJobForm({)}/></div>+ {/* Job Type */}+ <div>+ <FormField+ control={form.control}+ name="type"+ render={({ field }) => (+ <FormItem className="flex flex-col">+ <FormLabel className="mb-2">Job Type</FormLabel>+ <RadioGroup+ onValueChange={field.onChange}+ defaultValue={field.value}+ className="flex space-y-1"+ >+ {Object.entries(JOB_TYPES).map(([key, value]) => (+ <FormItem+ key={key}+ className="flex items-center space-x-3 space-y-0"+ >+ <FormControl>+ <RadioGroupItem value={key} />+ </FormControl>+ <FormLabel className="font-normal">{value}</FormLabel>+ </FormItem>+ ))}+ </RadioGroup>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>{/* Job Source */}<div><FormFielddiff --git a/src/components/ui/radio-group.tsx b/src/components/ui/radio-group.tsxnew file mode 100644index 0000000..e9bde17--- /dev/null+++ b/src/components/ui/radio-group.tsx@@ -0,0 +1,44 @@+"use client"++import * as React from "react"+import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"+import { Circle } from "lucide-react"++import { cn } from "@/lib/utils"++const RadioGroup = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Root+ className={cn("grid gap-2", className)}+ {...props}+ ref={ref}+ />+ )+})+RadioGroup.displayName = RadioGroupPrimitive.Root.displayName++const RadioGroupItem = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Item+ ref={ref}+ className={cn(+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",+ className+ )}+ {...props}+ >+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">+ <Circle className="h-2.5 w-2.5 fill-current text-current" />+ </RadioGroupPrimitive.Indicator>+ </RadioGroupPrimitive.Item>+ )+})+RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName++export { RadioGroup, RadioGroupItem }diff --git a/src/models/addJobForm.schema.ts b/src/models/addJobForm.schema.tsindex a9e942d..67475d9 100644--- a/src/models/addJobForm.schema.ts+++ b/src/models/addJobForm.schema.ts@@ -22,6 +22,7 @@ export const AddJobFormSchema = z.object({.min(2, {message: "Location name must be at least 2 characters.",}),+ type: z.string().min(1),source: z.string({required_error: "Source is required.",diff --git a/src/models/job.model.ts b/src/models/job.model.tsindex 4822ce3..cbd6303 100644--- a/src/models/job.model.ts+++ b/src/models/job.model.ts@@ -1,6 +1,7 @@export interface Job {source: string;title: string;+ type: string;company: string;location: string;status: string;@@ -9,3 +10,9 @@ export interface Job {salaryRange: string;jobDescription: string;}++export enum JOB_TYPES {+ FT = "Full-time",+ PT = "Part-time",+ C = "Contract",+}