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 Update Status header menu, fold the status picker into it and gate the stage actions with a visible reason
Khuram Niazddeda475db07
diff --git a/__tests__/JobDetails.spec.tsx b/__tests__/JobDetails.spec.tsxindex d56e614..33250c8 100644--- a/__tests__/JobDetails.spec.tsx+++ b/__tests__/JobDetails.spec.tsx@@ -359,6 +359,21 @@ describe("JobDetails – tabs", () => {expect(screen.getByTestId("timeline-add-stage-btn")).toBeInTheDocument();});+ // Escape first: an open Radix menu is modal, so the second trigger would+ // sit under a pointer-events:none layer.+ it("keeps only one status control, in the Update Status menu", async () => {+ render(<JobDetails {...baseProps} job={makeJob()} />);++ await userEvent.click(screen.getByTestId("job-details-actions-menu-btn"));+ expect(screen.queryByRole("menuitem", { name: /Change status/ })).toBeNull();+ await userEvent.keyboard("{Escape}");++ await userEvent.click(screen.getByTestId("update-status-menu-btn"));+ expect(+ screen.getByRole("menuitem", { name: /Change status/ }),+ ).toBeInTheDocument();+ });+it("opens on the Description tab", () => {render(<JobDetails {...baseProps} job={makeJob()} />);diff --git a/__tests__/UpdateStatusMenu.spec.tsx b/__tests__/UpdateStatusMenu.spec.tsxnew file mode 100644index 0000000..942e798--- /dev/null+++ b/__tests__/UpdateStatusMenu.spec.tsx@@ -0,0 +1,89 @@+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { UpdateStatusMenu } from "@/components/myjobs/job-details/timeline/UpdateStatusMenu";++const stage = (statusValue: string, label: string) =>+ ({+ id: "st1",+ StageType: { label, Status: { value: statusValue } },+ }) as any;++const jobStatuses = [+ { id: "s-int", label: "Interview", value: "interview" },+ { id: "s-off", label: "Offer", value: "offer" },+] as any;++const base = {+ jobStatuses,+ currentStatusId: "s-int",+ onChangeStatus: () => {},+ onAddStage: () => {},+ onLinkInterviewers: () => {},+ onAddPrepQuestions: () => {},+};++const open = async () =>+ userEvent.click(screen.getByRole("button", { name: /Update Status/ }));++describe("UpdateStatusMenu", () => {+ // The old ⋮ submenu moved in here, so this menu is the single answer to+ // "where is this job now".+ it("carries the status picker as its first item", async () => {+ render(+ <UpdateStatusMenu {...base} targetStage={stage("interview", "Screening")} />,+ );+ await open();++ expect(+ screen.getByRole("menuitem", { name: /Change status/ }),+ ).toBeInTheDocument();+ });++ it("enables all three items on an interview stage", async () => {+ render(+ <UpdateStatusMenu+ {...base}+ targetStage={stage("interview", "Final / Onsite Interview")}+ />,+ );+ await open();++ expect(screen.getByRole("menuitem", { name: /Add Stage/ })).not.toHaveAttribute("aria-disabled", "true");+ expect(screen.getByRole("menuitem", { name: /Link Interviewers/ })).not.toHaveAttribute("aria-disabled", "true");+ expect(screen.getByRole("menuitem", { name: /Add to Prep List/ })).not.toHaveAttribute("aria-disabled", "true");+ });++ // Disabled with a visible reason, not hidden: a menu whose items come and+ // go as you change tabs is harder to learn than one that greys out.+ it("disables the stage-scoped items with a reason on a non-interview stage", async () => {+ render(<UpdateStatusMenu {...base} targetStage={stage("applied", "Applied")} />);+ await open();++ expect(screen.getByRole("menuitem", { name: /Link Interviewers/ })).toHaveAttribute("aria-disabled", "true");+ expect(screen.getByRole("menuitem", { name: /Add to Prep List/ })).toHaveAttribute("aria-disabled", "true");+ expect(screen.getAllByText(/Applied is not an interview stage/).length).toBeGreaterThan(0);+ });++ it("keeps Add Stage enabled with no stage at all", async () => {+ render(<UpdateStatusMenu {...base} targetStage={null} />);+ await open();++ expect(screen.getByRole("menuitem", { name: /Add Stage/ })).not.toHaveAttribute("aria-disabled", "true");+ expect(screen.getByRole("menuitem", { name: /Link Interviewers/ })).toHaveAttribute("aria-disabled", "true");+ });++ it("fires the handler for the item clicked", async () => {+ const onAddStage = vi.fn();+ render(+ <UpdateStatusMenu+ {...base}+ targetStage={stage("interview", "Screening")}+ onAddStage={onAddStage}+ />,+ );+ await open();+ await userEvent.click(screen.getByRole("menuitem", { name: /Add Stage/ }));++ expect(onAddStage).toHaveBeenCalled();+ });+});diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsxindex 438cb6f..521bada 100644--- a/src/components/myjobs/JobDetails.tsx+++ b/src/components/myjobs/JobDetails.tsx@@ -42,6 +42,7 @@ 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 { UpdateStatusMenu } from "./job-details/timeline/UpdateStatusMenu";import type { JobStage, JobStageTypeRef } from "@/models/jobStage.model";const JOB_DETAIL_TABS = [@@ -93,17 +94,16 @@ function JobDetails({const {stages,currentStage,+ selectedStage,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<+ const [addStageTarget, setAddStageTarget] = useState<{ mode: "create" } | { mode: "edit"; stage: JobStage } | null>(null);- const [, setLinkInterviewersOpen] = useState(false);- const [, setPrepQuestionsOpen] = useState(false);+ const [linkInterviewersOpen, setLinkInterviewersOpen] = useState(false);+ const [prepQuestionsOpen, setPrepQuestionsOpen] = useState(false);const router = useRouter();const [activeTab, handleTabChange] = useTabQueryParam(JOB_DETAIL_TABS,@@ -202,8 +202,6 @@ function JobDetails({<div className="py-6 space-y-6"><JobDetailsHeaderjob={job}- jobStatuses={jobStatuses}- currentStatus={currentStatus}coverLetterBlockedReason={coverLetterBlockedReason}chatBusy={chatBusy}onBack={goBack}@@ -212,7 +210,17 @@ function JobDetails({onEdit={onEditJob}onDelete={() => setDeleteAlertOpen(true)}onAddNote={onAddNote}- onChangeStatus={onChangeStatus}+ updateStatusMenu={+ <UpdateStatusMenu+ targetStage={selectedStage ?? currentStage}+ jobStatuses={jobStatuses}+ currentStatusId={currentStatus.id}+ onChangeStatus={onChangeStatus}+ onAddStage={() => setAddStageTarget({ mode: "create" })}+ onLinkInterviewers={() => setLinkInterviewersOpen(true)}+ onAddPrepQuestions={() => setPrepQuestionsOpen(true)}+ />+ }/><JobSummaryCarddiff --git a/src/components/myjobs/job-details/JobDetailsHeader.tsx b/src/components/myjobs/job-details/JobDetailsHeader.tsxindex e530e39..62c226d 100644--- a/src/components/myjobs/job-details/JobDetailsHeader.tsx+++ b/src/components/myjobs/job-details/JobDetailsHeader.tsx@@ -7,7 +7,6 @@ import {Pencil,Sparkles,StickyNote,- Tags,Trash,Trash2,} from "lucide-react";@@ -19,17 +18,11 @@ import {DropdownMenuGroup,DropdownMenuItem,DropdownMenuLabel,- DropdownMenuPortal,DropdownMenuSeparator,- DropdownMenuSub,- DropdownMenuSubContent,- DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import { JobStatusMenuItems } from "@/components/myjobs/JobStatusMenuItems";import {JobResponse,- JobStatus,getJobTypeLabel,getWorkplaceTypeLabel,} from "@/models/job.model";@@ -37,8 +30,7 @@ import { CompanyLogo } from "../CompanyLogo";type JobDetailsHeaderProps = {job: JobResponse;- jobStatuses: JobStatus[];- currentStatus: JobStatus;+ updateStatusMenu?: React.ReactNode;coverLetterBlockedReason?: string;chatBusy: boolean;onBack: () => void;@@ -47,13 +39,11 @@ type JobDetailsHeaderProps = {onEdit: () => void;onDelete: () => void;onAddNote: () => void;- onChangeStatus: (status: JobStatus) => void;};export function JobDetailsHeader({job,- jobStatuses,- currentStatus,+ updateStatusMenu,coverLetterBlockedReason,chatBusy,onBack,@@ -62,7 +52,6 @@ export function JobDetailsHeader({onEdit,onDelete,onAddNote,- onChangeStatus,}: JobDetailsHeaderProps) {const details = [job.Location?.label,@@ -99,6 +88,7 @@ export function JobDetailsHeader({</div></div><div className="flex flex-wrap justify-end gap-2">+ {updateStatusMenu}<Buttonvariant="outline"className="cursor-pointer"@@ -169,22 +159,6 @@ export function JobDetailsHeader({Add a Note</DropdownMenuItem><DropdownMenuSeparator />- <DropdownMenuSub>- <DropdownMenuSubTrigger>- <Tags className="mr-2 h-4 w-4" />- Change status- </DropdownMenuSubTrigger>- <DropdownMenuPortal>- <DropdownMenuSubContent className="p-0">- <JobStatusMenuItems- jobStatuses={jobStatuses}- currentStatusId={currentStatus.id}- onSelectStatus={onChangeStatus}- />- </DropdownMenuSubContent>- </DropdownMenuPortal>- </DropdownMenuSub>- <DropdownMenuSeparator /><DropdownMenuItemclassName="text-red-600 cursor-pointer"onClick={onDelete}diff --git a/src/components/myjobs/job-details/timeline/UpdateStatusMenu.tsx b/src/components/myjobs/job-details/timeline/UpdateStatusMenu.tsxnew file mode 100644index 0000000..09a8634--- /dev/null+++ b/src/components/myjobs/job-details/timeline/UpdateStatusMenu.tsx@@ -0,0 +1,112 @@+"use client";+import { ChevronDown, HelpCircle, Plus, Tags, Users } from "lucide-react";+import { Button } from "@/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { JobStatusMenuItems } from "@/components/myjobs/JobStatusMenuItems";+import type { JobStatus } from "@/models/job.model";+import type { JobStage } from "@/models/jobStage.model";+import { isInterviewStage } from "./stageDisplay";++type UpdateStatusMenuProps = {+ targetStage: JobStage | null;+ jobStatuses: JobStatus[];+ currentStatusId: string;+ onChangeStatus: (status: JobStatus) => void;+ onAddStage: () => void;+ onLinkInterviewers: () => void;+ onAddPrepQuestions: () => void;+};++export function UpdateStatusMenu({+ targetStage,+ jobStatuses,+ currentStatusId,+ onChangeStatus,+ onAddStage,+ onLinkInterviewers,+ onAddPrepQuestions,+}: UpdateStatusMenuProps) {+ // Disabled with a visible reason rather than hidden: an item that comes and+ // goes as you change tabs is harder to learn than one that greys out.+ const reason = !targetStage+ ? "Add a stage first"+ : isInterviewStage(targetStage)+ ? null+ : `${targetStage.StageType.label} is not an interview stage`;++ const items: {+ key: string;+ label: string;+ icon: typeof Plus;+ onSelect: () => void;+ reason: string | null;+ }[] = [+ { key: "add", label: "Add Stage", icon: Plus, onSelect: onAddStage, reason: null },+ { key: "link", label: "Link Interviewers", icon: Users, onSelect: onLinkInterviewers, reason },+ { key: "prep", label: "Add to Prep List", icon: HelpCircle, onSelect: onAddPrepQuestions, reason },+ ];++ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button className="cursor-pointer" data-testid="update-status-menu-btn">+ Update Status+ <ChevronDown className="ml-2 h-3.5 w-3.5" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-[260px] p-2">+ {/* Moved out of the ⋮ menu: one control answers "where is this job+ now", instead of two with near-identical names. */}+ <DropdownMenuSub>+ <DropdownMenuSubTrigger className="gap-3 p-2.5">+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary/15">+ <Tags className="h-3.5 w-3.5 text-primary" />+ </span>+ <span className="flex-1 text-[13px] font-semibold">Change status</span>+ </DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent className="p-0">+ <JobStatusMenuItems+ jobStatuses={jobStatuses}+ currentStatusId={currentStatusId}+ onSelectStatus={onChangeStatus}+ />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSeparator />++ {items.map(({ key, label, icon: Icon, onSelect, reason: itemReason }) => (+ <DropdownMenuItem+ key={key}+ className="cursor-pointer gap-3 p-2.5"+ disabled={!!itemReason}+ onSelect={onSelect}+ >+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary/15">+ <Icon className="h-3.5 w-3.5 text-primary" />+ </span>+ <span className="flex-1">+ <span className="block text-[13px] font-semibold">{label}</span>+ {itemReason && (+ <span className="block text-xs text-muted-foreground">+ {itemReason}+ </span>+ )}+ </span>+ </DropdownMenuItem>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}