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(timeline): add the Timeline tab with its stage count badge and stageless empty state
Khuram Niaze17735cd8741
diff --git a/__tests__/JobDetails.spec.tsx b/__tests__/JobDetails.spec.tsxindex ef891b1..d56e614 100644--- a/__tests__/JobDetails.spec.tsx+++ b/__tests__/JobDetails.spec.tsx@@ -65,6 +65,45 @@ vi.mock("@/components/CircularScore", () => ({),}));+vi.mock("@/actions/jobStage.actions", () => ({+ getJobStages: vi.fn().mockResolvedValue([]),+ setPrepQuestionAsked: vi.fn(),+ removeStagePrepQuestion: vi.fn(),+ unlinkStageInterviewer: vi.fn(),+ setStageNotes: vi.fn(),+}));++const makeStage = (id: string, label: string, over: any = {}) => ({+ id,+ jobId: "job-1",+ stageTypeId: `t-${id}`,+ occurredAt: new Date(2026, 8, 3),+ isCurrent: false,+ outcome: null,+ notes: null,+ durationMins: null,+ format: null,+ location: null,+ createdAt: new Date(2026, 8, 1),+ updatedAt: new Date(2026, 8, 1),+ StageType: {+ id: `t-${id}`,+ label,+ value: label.toLowerCase(),+ statusId: "s1",+ sortOrder: 0,+ Status: { id: "s1", label, value: "applied" },+ },+ interviewers: [],+ prepQuestions: [],+ ...over,+});++const stageA = makeStage("stage-a", "Applied", {+ occurredAt: new Date(2026, 8, 1),+});+const stageB = makeStage("stage-b", "Interview", { isCurrent: true });+const baseProps = {jobStatuses: [],companies: [],@@ -72,6 +111,7 @@ const baseProps = {locations: [],sources: [],tags: [],+ stageTypes: [],};const makeJob = (overrides: Partial<JobResponse> = {}): JobResponse => ({@@ -284,17 +324,41 @@ describe("JobDetails – tabs", () => {searchParams = new URLSearchParams();});- // The bar must not shift between jobs, so all five are always present.- it("renders all five tabs regardless of what the job has", () => {+ // The bar must not shift between jobs, so all six are always present.+ it("renders all six tabs regardless of what the job has", () => {render(<JobDetails {...baseProps} job={makeJob()} />);expect(screen.getByRole("tab", { name: /description/i })).toBeInTheDocument();expect(screen.getByRole("tab", { name: /ai match/i })).toBeInTheDocument();+ expect(screen.getByRole("tab", { name: /timeline/i })).toBeInTheDocument();expect(screen.getByRole("tab", { name: /cover letter/i })).toBeInTheDocument();expect(screen.getByRole("tab", { name: /notes/i })).toBeInTheDocument();expect(screen.getByRole("tab", { name: "Contacts" })).toBeInTheDocument();});+ it("renders a Timeline tab between AI Match and Cover Letter, with a stage count", () => {+ render(+ <JobDetails {...baseProps} job={makeJob({ stages: [stageA, stageB] })} />,+ );++ const tabs = screen.getAllByRole("tab").map((t) => t.textContent);+ const matchAt = tabs.findIndex((t) => t?.startsWith("AI Match"));+ const timelineAt = tabs.findIndex((t) => t?.startsWith("Timeline"));+ const letterAt = tabs.findIndex((t) => t?.startsWith("Cover Letter"));++ expect(timelineAt).toBe(matchAt + 1);+ expect(letterAt).toBe(timelineAt + 1);+ expect(screen.getByRole("tab", { name: /Timeline/ })).toHaveTextContent("2");+ });++ it("shows an empty state for a job with no stages, keeping its status visible", () => {+ onTab("timeline");+ render(<JobDetails {...baseProps} job={makeJob({ stages: [] })} />);++ expect(screen.getByText(/No stages recorded/i)).toBeInTheDocument();+ expect(screen.getByTestId("timeline-add-stage-btn")).toBeInTheDocument();+ });+it("opens on the Description tab", () => {render(<JobDetails {...baseProps} job={makeJob()} />);diff --git a/__tests__/JobDetailsPage.spec.tsx b/__tests__/JobDetailsPage.spec.tsxindex 01f14ce..85a097b 100644--- a/__tests__/JobDetailsPage.spec.tsx+++ b/__tests__/JobDetailsPage.spec.tsx@@ -32,6 +32,10 @@ vi.mock("@/actions/tag.actions", () => ({getAllTags: vi.fn(async () => []),}));+vi.mock("@/actions/jobStageType.actions", () => ({+ getAllJobStageTypes: vi.fn(async () => []),+}));+vi.mock("@/components/myjobs/JobDetails", () => ({default: () => <div data-testid="job-details" />,}));diff --git a/src/app/dashboard/myjobs/[id]/page.tsx b/src/app/dashboard/myjobs/[id]/page.tsxindex aaa071b..ba58e02 100644--- a/src/app/dashboard/myjobs/[id]/page.tsx+++ b/src/app/dashboard/myjobs/[id]/page.tsx@@ -8,20 +8,30 @@ import { getAllCompanies } from "@/actions/company.actions";import { getAllJobTitles } from "@/actions/jobtitle.actions";import { getAllJobLocations } from "@/actions/jobLocation.actions";import { getAllTags } from "@/actions/tag.actions";+import { getAllJobStageTypes } from "@/actions/jobStageType.actions";import { notFound } from "next/navigation";async function JobDetailsPage({ params }: { params: Promise<{ id: string }> }) {const { id } = await params;- const [{ job }, statuses, companies, titles, locations, sources, tags] =- await Promise.all([- getJobDetails(id),- getStatusList(),- getAllCompanies(),- getAllJobTitles(),- getAllJobLocations(),- getJobSourceList(),- getAllTags(),- ]);+ const [+ { job },+ statuses,+ companies,+ titles,+ locations,+ sources,+ tags,+ stageTypes,+ ] = await Promise.all([+ getJobDetails(id),+ getStatusList(),+ getAllCompanies(),+ getAllJobTitles(),+ getAllJobLocations(),+ getJobSourceList(),+ getAllTags(),+ getAllJobStageTypes(),+ ]);// A link to a job that was deleted (or never belonged to this user) would// otherwise crash JobDetails on the first job.* read.@@ -37,6 +47,7 @@ async function JobDetailsPage({ params }: { params: Promise<{ id: string }> }) {locations={locations}sources={sources}tags={tags ?? []}+ stageTypes={stageTypes ?? []}/></div>);diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsxindex c839a61..438cb6f 100644--- a/src/components/myjobs/JobDetails.tsx+++ b/src/components/myjobs/JobDetails.tsx@@ -40,10 +40,14 @@ import { JobTabEmptyState } from "./job-details/JobTabEmptyState";import { CoverLetterTab } from "./job-details/CoverLetterTab";import { useAutoMatch } from "./job-details/useAutoMatch";import { JobContactsTab } from "./job-details/JobContactsTab";+import { JobTimelineTab } from "./job-details/timeline/JobTimelineTab";+import { useJobStages } from "./job-details/timeline/useJobStages";+import type { JobStage, JobStageTypeRef } from "@/models/jobStage.model";const JOB_DETAIL_TABS = ["description","match",+ "timeline","letter","notes","contacts",@@ -57,6 +61,7 @@ type JobDetailsProps = {locations: JobLocation[];sources: JobSource[];tags: Tag[];+ stageTypes: JobStageTypeRef[];};function JobDetails({@@ -67,6 +72,7 @@ function JobDetails({locations,sources,tags,+ stageTypes,}: JobDetailsProps) {const {open: openChat,@@ -84,6 +90,20 @@ function JobDetails({const [deleteAlertOpen, setDeleteAlertOpen] = useState(false);const [noteOpenTrigger, setNoteOpenTrigger] = useState(0);const [notesCount, setNotesCount] = useState(0);+ const {+ stages,+ currentStage,+ selectedStageId,+ selectStage,+ reload: reloadStages,+ } = useJobStages(job.id, job.stages ?? []);+ // Phase 6 renders the three stage dialogs against this same state; until+ // then the timeline's buttons are deliberately inert.+ const [, setAddStageTarget] = useState<+ { mode: "create" } | { mode: "edit"; stage: JobStage } | null+ >(null);+ const [, setLinkInterviewersOpen] = useState(false);+ const [, setPrepQuestionsOpen] = useState(false);const router = useRouter();const [activeTab, handleTabChange] = useTabQueryParam(JOB_DETAIL_TABS,@@ -158,6 +178,9 @@ function JobDetails({const { success, message } = await updateJobStatus(job.id, status);if (success) {setCurrentStatus(status);+ // The status change appends a stage server-side, so the timeline has to+ // catch up or the stepper keeps showing the previous current stage.+ void reloadStages();toastSuccess(`Job has been updated successfully`);} else {toastError(message);@@ -202,6 +225,14 @@ function JobDetails({<TabsList><TabsTrigger value="description">Description</TabsTrigger><TabsTrigger value="match">AI Match</TabsTrigger>+ <TabsTrigger value="timeline">+ Timeline+ {stages.length > 0 && (+ <Badge variant="secondary" className="ml-2">+ {stages.length}+ </Badge>+ )}+ </TabsTrigger><TabsTrigger value="letter">Cover Letter</TabsTrigger><TabsTrigger value="notes">Notes@@ -242,6 +273,20 @@ function JobDetails({)}</Card></TabsContent>+ <TabsContent value="timeline" className="mt-4">+ <JobTimelineTab+ stages={stages}+ stageTypes={stageTypes}+ selectedStageId={selectedStageId}+ currentStageId={currentStage?.id ?? null}+ onSelect={selectStage}+ onAddStage={() => setAddStageTarget({ mode: "create" })}+ onEditStage={(stage) => setAddStageTarget({ mode: "edit", stage })}+ onLinkInterviewers={() => setLinkInterviewersOpen(true)}+ onAddPrepQuestions={() => setPrepQuestionsOpen(true)}+ onChanged={reloadStages}+ />+ </TabsContent><TabsContent value="letter" className="mt-4"><Card className="p-6"><CoverLetterTabdiff --git a/src/components/myjobs/job-details/JobTabEmptyState.tsx b/src/components/myjobs/job-details/JobTabEmptyState.tsxindex fbc8f44..a72bca8 100644--- a/src/components/myjobs/job-details/JobTabEmptyState.tsx+++ b/src/components/myjobs/job-details/JobTabEmptyState.tsx@@ -11,6 +11,7 @@ type JobTabEmptyStateProps = {onAction?: () => void;actionDisabled?: boolean;actionTitle?: string;+ actionTestId?: string;};export function JobTabEmptyState({@@ -21,6 +22,7 @@ export function JobTabEmptyState({onAction,actionDisabled,actionTitle,+ actionTestId,}: JobTabEmptyStateProps) {return (<div className="flex flex-col items-center gap-3 py-8 text-center">@@ -37,6 +39,7 @@ export function JobTabEmptyState({onClick={onAction}disabled={actionDisabled}title={actionTitle}+ data-testid={actionTestId}><Icon className="h-4 w-4 mr-2" />{actionLabel}diff --git a/src/components/myjobs/job-details/timeline/JobTimelineTab.tsx b/src/components/myjobs/job-details/timeline/JobTimelineTab.tsxnew file mode 100644index 0000000..c478777--- /dev/null+++ b/src/components/myjobs/job-details/timeline/JobTimelineTab.tsx@@ -0,0 +1,87 @@+"use client";+import { CalendarClock } from "lucide-react";+import type { JobStage, JobStageTypeRef } from "@/models/jobStage.model";+import { JobTabEmptyState } from "../JobTabEmptyState";+import { StageStepper } from "./StageStepper";+import { StageHistoryList } from "./StageHistoryList";+import { StageDetailPanel } from "./StageDetailPanel";+import { terminalStagesFor } from "./stageDisplay";++type JobTimelineTabProps = {+ stages: JobStage[];+ stageTypes: JobStageTypeRef[];+ selectedStageId: string | null;+ currentStageId: string | null;+ onSelect: (stageId: string) => void;+ onAddStage: () => void;+ onEditStage: (stage: JobStage) => void;+ onLinkInterviewers: () => void;+ onAddPrepQuestions: () => void;+ onChanged: () => void;+};++export function JobTimelineTab({+ stages,+ stageTypes,+ selectedStageId,+ currentStageId,+ onSelect,+ onAddStage,+ onEditStage,+ onLinkInterviewers,+ onAddPrepQuestions,+ onChanged,+}: JobTimelineTabProps) {+ // A job restored from a pre-feature backup is permanently stageless, so+ // this is a supported state, not a transient one.+ if (stages.length === 0) {+ return (+ <JobTabEmptyState+ icon={CalendarClock}+ title="No stages recorded yet"+ description="Add the first stage to start this job's timeline. Its status stays as it is until a stage sets it."+ actionLabel="Add stage"+ onAction={onAddStage}+ actionTestId="timeline-add-stage-btn"+ />+ );+ }++ const selected = stages.find((s) => s.id === selectedStageId) ?? null;+ const terminalTypes = terminalStagesFor(stages, stageTypes);++ return (+ <div className="@container/timeline space-y-6">+ <StageStepper+ stages={stages}+ selectedStageId={selectedStageId}+ currentStageId={currentStageId}+ terminalTypes={terminalTypes}+ onSelect={onSelect}+ />++ <div className="flex flex-col gap-6 @3xl/timeline:flex-row @3xl/timeline:items-start">+ <div className="w-full shrink-0 @3xl/timeline:w-[340px]">+ <StageHistoryList+ stages={stages}+ selectedStageId={selectedStageId}+ currentStageId={currentStageId}+ terminalTypes={terminalTypes}+ onSelect={onSelect}+ onAddStage={onAddStage}+ />+ </div>+ {selected && (+ <StageDetailPanel+ stage={selected}+ isCurrent={selected.id === currentStageId}+ onEdit={() => onEditStage(selected)}+ onLinkInterviewers={onLinkInterviewers}+ onAddPrepQuestions={onAddPrepQuestions}+ onChanged={onChanged}+ />+ )}+ </div>+ </div>+ );+}