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
feat: Implement reusable StatusBadge component and centralize badge colors for improved UI consistency
Khuram Niazf558b219d98b
diff --git a/src/components/StatusBadge.tsx b/src/components/StatusBadge.tsxnew file mode 100644index 0000000..616691b--- /dev/null+++ b/src/components/StatusBadge.tsx@@ -0,0 +1,16 @@+import { Badge } from "@/components/ui/badge";+import { cn } from "@/lib/utils";+import { BADGE_COLORS, BadgeColor } from "@/lib/badge-colors";++interface StatusBadgeProps {+ label: string;+ color: BadgeColor;+ className?: string;+}++// Reusable colored badge; color values are centralized in @/lib/badge-colors+export function StatusBadge({ label, color, className }: StatusBadgeProps) {+ return (+ <Badge className={cn(BADGE_COLORS[color], className)}>{label}</Badge>+ );+}diff --git a/src/components/automations/AutomationWizard.tsx b/src/components/automations/AutomationWizard.tsxindex 5636b83..843afa4 100644--- a/src/components/automations/AutomationWizard.tsx+++ b/src/components/automations/AutomationWizard.tsx@@ -31,8 +31,14 @@ import {FormLabel,FormMessage,} from "@/components/ui/form";-import { CreateAutomationSchema, type CreateAutomationInput } from "@/models/automation.schema";-import { createAutomation, updateAutomation } from "@/actions/automation.actions";+import {+ CreateAutomationSchema,+ type CreateAutomationInput,+} from "@/models/automation.schema";+import {+ createAutomation,+ updateAutomation,+} from "@/actions/automation.actions";import { toast } from "@/components/ui/use-toast";import type {AutomationWithResume,@@ -229,7 +235,10 @@ export function AutomationWizard({<FormItem><FormLabel>Automation Name</FormLabel><FormControl>- <Input placeholder="e.g., Full Stack Jobs Calgary" {...field} />+ <Input+ placeholder="e.g., Full Stack Jobs Calgary"+ {...field}+ /></FormControl><FormDescription>A descriptive name to identify this automation@@ -251,7 +260,9 @@ export function AutomationWizard({</SelectTrigger></FormControl><SelectContent>- <SelectItem value="jsearch">JSearch (Google Jobs)</SelectItem>+ <SelectItem value="jsearch">+ JSearch (Google Jobs)+ </SelectItem><SelectItem value="greenhouse">Greenhouse (company boards)</SelectItem>@@ -352,8 +363,9 @@ export function AutomationWizard({)}/>{resumes.length === 0 && (- <p className="text-sm text-muted-foreground">- No resumes found. Please create a resume in your profile first.+ <p className="text-sm text-orange-600 dark:text-orange-500">+ No resumes found. Please create a resume with enough content in+ your profile first.</p>)}</div>@@ -365,9 +377,7 @@ export function AutomationWizard({name="matchThreshold"render={({ field }) => (<FormItem>- <FormLabel>- Match Threshold: {field.value}%- </FormLabel>+ <FormLabel>Match Threshold: {field.value}%</FormLabel><FormControl><Slidermin={0}@@ -407,7 +417,10 @@ export function AutomationWizard({</FormControl><SelectContent>{HOURS.map((hour) => (- <SelectItem key={hour.value} value={hour.value.toString()}>+ <SelectItem+ key={hour.value}+ value={hour.value.toString()}+ >{hour.label}</SelectItem>))}@@ -431,7 +444,9 @@ export function AutomationWizard({</div><div className="flex justify-between"><span className="text-muted-foreground">Job Board</span>- <span className="font-medium capitalize">{formValues.jobBoard || "-"}</span>+ <span className="font-medium capitalize">+ {formValues.jobBoard || "-"}+ </span></div>{isGreenhouse ? (<>@@ -482,26 +497,35 @@ export function AutomationWizard({<><div className="flex justify-between"><span className="text-muted-foreground">Keywords</span>- <span className="font-medium">{formValues.keywords || "-"}</span>+ <span className="font-medium">+ {formValues.keywords || "-"}+ </span></div><div className="flex justify-between"><span className="text-muted-foreground">Location</span>- <span className="font-medium">{formValues.location || "-"}</span>+ <span className="font-medium">+ {formValues.location || "-"}+ </span></div></>)}<div className="flex justify-between"><span className="text-muted-foreground">Resume</span>- <span className="font-medium">{selectedResume?.title || "Not selected"}</span>+ <span className="font-medium">+ {selectedResume?.title || "Not selected"}+ </span></div><div className="flex justify-between"><span className="text-muted-foreground">Match Threshold</span>- <span className="font-medium">{formValues.matchThreshold ?? 80}%</span>+ <span className="font-medium">+ {formValues.matchThreshold ?? 80}%+ </span></div><div className="flex justify-between"><span className="text-muted-foreground">Schedule</span><span className="font-medium">- Daily at {(formValues.scheduleHour ?? 8).toString().padStart(2, "0")}:00+ Daily at{" "}+ {(formValues.scheduleHour ?? 8).toString().padStart(2, "0")}:00</span></div></div>@@ -534,16 +558,18 @@ export function AutomationWizard({</div><Form {...form}>- <form onSubmit={form.handleSubmit(onSubmit, (errors) => {- const firstError = Object.values(errors)[0];- if (firstError?.message) {- toast({- title: "Validation Error",- description: firstError.message as string,- variant: "destructive",- });- }- })}>+ <form+ onSubmit={form.handleSubmit(onSubmit, (errors) => {+ const firstError = Object.values(errors)[0];+ if (firstError?.message) {+ toast({+ title: "Validation Error",+ description: firstError.message as string,+ variant: "destructive",+ });+ }+ })}+ ><div className="py-4">{renderStepContent()}</div><DialogFooter className="gap-2">@@ -554,13 +580,19 @@ export function AutomationWizard({</Button>)}{step < STEPS.length - 1 ? (- <Button type="button" onClick={nextStep} disabled={!canGoNext()}>+ <Button+ type="button"+ onClick={nextStep}+ disabled={!canGoNext()}+ >Next<ChevronRight className="h-4 w-4 ml-1" /></Button>) : (<Button type="submit" disabled={isSubmitting}>- {isSubmitting && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}+ {isSubmitting && (+ <Loader2 className="h-4 w-4 mr-2 animate-spin" />+ )}{editAutomation ? "Update" : "Create"} Automation</Button>)}diff --git a/src/components/dashboard/RecentCardToggle.tsx b/src/components/dashboard/RecentCardToggle.tsxindex c937de9..516eb7c 100644--- a/src/components/dashboard/RecentCardToggle.tsx+++ b/src/components/dashboard/RecentCardToggle.tsx@@ -2,8 +2,9 @@import { useState } from "react";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";-import { Badge } from "@/components/ui/badge";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";+import { StatusBadge } from "@/components/StatusBadge";+import { getJobStatusBadgeColor } from "@/lib/badge-colors";import { cn } from "@/lib/utils";import { JobResponse } from "@/models/job.model";import { format } from "date-fns";@@ -123,15 +124,11 @@ export default function RecentCardToggle({</div></Link>{job.Status?.label ? (- <Badge- className={cn(- "ml-auto shrink-0 justify-center text-xs px-1.5 py-0 h-5",- job.Status?.value === "applied" && "bg-cyan-500",- job.Status?.value === "interview" && "bg-green-500",- )}- >- {job.Status.label}- </Badge>+ <StatusBadge+ label={job.Status.label}+ color={getJobStatusBadgeColor(job.Status.value)}+ className="ml-auto shrink-0 justify-center text-xs px-1.5 py-0 h-5"+ />) : null}</div>))}diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsxindex 5975bdc..8da78e3 100644--- a/src/components/myjobs/JobDetails.tsx+++ b/src/components/myjobs/JobDetails.tsx@@ -1,7 +1,9 @@"use client";import { format } from "date-fns";import { Badge } from "../ui/badge";-import { cn, formatUrl } from "@/lib/utils";+import { StatusBadge } from "../StatusBadge";+import { getJobStatusBadgeColor } from "@/lib/badge-colors";+import { formatUrl } from "@/lib/utils";import {Company,JobLocation,@@ -266,17 +268,17 @@ function JobDetails({</CardHeader><h3 className="ml-4">{new Date() > job.dueDate && currentStatus?.value === "draft" ? (- <Badge className="bg-red-500">Expired</Badge>+ <StatusBadge+ label="Expired"+ color="amber"+ className="w-[70px] justify-center"+ />) : (- <Badge- className={cn(- "w-[70px] justify-center",- currentStatus?.value === "applied" && "bg-cyan-500",- currentStatus?.value === "interview" && "bg-green-500",- )}- >- {currentStatus?.label}- </Badge>+ <StatusBadge+ label={currentStatus?.label ?? ""}+ color={getJobStatusBadgeColor(currentStatus?.value ?? "")}+ className="w-[70px] justify-center"+ />)}<span className="ml-2">{job?.appliedDate ? format(new Date(job?.appliedDate), "PP") : ""}diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsxindex 8dfdb57..007e832 100644--- a/src/components/myjobs/MyJobsTable.tsx+++ b/src/components/myjobs/MyJobsTable.tsx@@ -15,8 +15,9 @@ import {Tags,Trash,} from "lucide-react";-import { cn } from "@/lib/utils";import { Badge } from "../ui/badge";+import { StatusBadge } from "../StatusBadge";+import { getJobStatusBadgeColor } from "@/lib/badge-colors";import { format } from "date-fns";import {DropdownMenu,@@ -134,17 +135,17 @@ function MyJobsTable({Dismissed</Badge>) : new Date() > job.dueDate && job.Status?.value === "draft" ? (- <Badge className="bg-red-500">Expired</Badge>+ <StatusBadge+ label="Expired"+ color="amber"+ className="w-[70px] justify-center"+ />) : (- <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>+ <StatusBadge+ label={job.Status?.label ?? ""}+ color={getJobStatusBadgeColor(job.Status?.value ?? "")}+ className="w-[70px] justify-center"+ />)}</TableCell><TableCell className="hidden md:table-cell">diff --git a/src/components/profile/ResumeTable.tsx b/src/components/profile/ResumeTable.tsxindex 5d6818a..70bf0db 100644--- a/src/components/profile/ResumeTable.tsx+++ b/src/components/profile/ResumeTable.tsx@@ -32,6 +32,8 @@ import { deleteResumeById, setDefaultResume } from "@/actions/profile.actions";import { deleteCoverLetterById } from "@/actions/coverLetter.actions";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { Badge } from "../ui/badge";+import { StatusBadge } from "../StatusBadge";+import { DOCUMENT_TYPE_BADGE_COLORS } from "@/lib/badge-colors";import {hasMinResumeSections,warnInsufficientResumeSections,@@ -188,9 +190,10 @@ function DocumentTable({)}</TableCell><TableCell>- <Badge variant={isResume ? "default" : "secondary"}>- {isResume ? "Resume" : "Cover Letter"}- </Badge>+ <StatusBadge+ label={isResume ? "Resume" : "Cover Letter"}+ color={DOCUMENT_TYPE_BADGE_COLORS[doc.type]}+ /></TableCell><TableCell>{doc.createdAt && format(doc.createdAt, "PP")}diff --git a/src/components/tasks/TasksTable.tsx b/src/components/tasks/TasksTable.tsxindex ed81672..887c1f0 100644--- a/src/components/tasks/TasksTable.tsx+++ b/src/components/tasks/TasksTable.tsx@@ -20,7 +20,8 @@ import {Flame,} from "lucide-react";import { cn } from "@/lib/utils";-import { Badge } from "../ui/badge";+import { StatusBadge } from "../StatusBadge";+import { TASK_STATUS_BADGE_COLORS } from "@/lib/badge-colors";import {format,isToday,@@ -56,13 +57,6 @@ type TasksTableProps = {groupBy?: "none" | "createdDate" | "dueDate" | "updatedDate" | "activityType";};-const statusColors: Record<TaskStatus, string> = {- "in-progress": "bg-blue-500",- complete: "bg-green-500",- "needs-attention": "bg-orange-500",- cancelled: "bg-gray-500",-};-type PriorityLevel = "low" | "medium" | "high" | "critical";function getPriorityLevel(priority: number): PriorityLevel {@@ -250,14 +244,11 @@ function TasksTable({{task.activityType?.label || "—"}</TableCell><TableCell className="hidden md:table-cell py-1 px-2">- <Badge- className={cn(- "min-w-[120px] whitespace-nowrap justify-center",- statusColors[task.status],- )}- >- {TASK_STATUSES[task.status]}- </Badge>+ <StatusBadge+ label={TASK_STATUSES[task.status]}+ color={TASK_STATUS_BADGE_COLORS[task.status]}+ className="w-[110px] whitespace-nowrap justify-center"+ /></TableCell><TableCell className="hidden md:table-cell py-1 px-2">{(() => {diff --git a/src/lib/badge-colors.ts b/src/lib/badge-colors.tsnew file mode 100644index 0000000..0ae79cf--- /dev/null+++ b/src/lib/badge-colors.ts@@ -0,0 +1,50 @@+import { JOB_STATUSES } from "@/lib/constants";+import { TaskStatus } from "@/models/task.model";+import { ProfileDocumentType } from "@/models/profile.model";++// Central badge color palette. Add new semantic colors here only.+export const BADGE_COLORS = {+ slate: "bg-slate-500 dark:bg-slate-400",+ blue: "bg-blue-500 dark:bg-blue-400",+ violet: "bg-violet-500 dark:bg-violet-400",+ amber: "bg-amber-500 dark:bg-amber-400",+ emerald: "bg-emerald-500 dark:bg-emerald-400",+ red: "bg-red-500 dark:bg-red-400",+} as const;++export type BadgeColor = keyof typeof BADGE_COLORS;++type JobStatusValue = (typeof JOB_STATUSES)[number]["value"];++export const JOB_STATUS_BADGE_COLORS: Record<JobStatusValue, BadgeColor> = {+ draft: "slate",+ applied: "blue",+ interview: "violet",+ offer: "emerald",+ rejected: "red",+ expired: "amber",+ archived: "slate",+};++// job.Status.value is a plain string from the DB, not the literal union,+// so lookups need a safe fallback for unrecognized values.+export function getJobStatusBadgeColor(value: string): BadgeColor {+ return (+ JOB_STATUS_BADGE_COLORS[value as JobStatusValue] ?? "slate"+ );+}++export const TASK_STATUS_BADGE_COLORS: Record<TaskStatus, BadgeColor> = {+ "in-progress": "blue",+ complete: "emerald",+ "needs-attention": "amber",+ cancelled: "slate",+};++export const DOCUMENT_TYPE_BADGE_COLORS: Record<+ ProfileDocumentType,+ BadgeColor+> = {+ resume: "blue",+ "cover-letter": "violet",+};