Skip to content

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.

feat: Actions menu to job details page

Khuram Niaz61f97175140b
diff --git a/__tests__/JobDetails.spec.tsx b/__tests__/JobDetails.spec.tsx
index 730d854..c01c196 100644
--- a/__tests__/JobDetails.spec.tsx
+++ b/__tests__/JobDetails.spec.tsx
@@ -4,7 +4,9 @@ import { JobResponse, Tag } from "@/models/job.model";
import { render, screen, act } from "@testing-library/react";
vi.mock("next/navigation", () => ({
- useRouter: vi.fn(() => ({ back: vi.fn() })),
+ useRouter: vi.fn(() => ({ back: vi.fn(), push: vi.fn(), replace: vi.fn() })),
+ useSearchParams: vi.fn(() => new URLSearchParams()),
+ usePathname: vi.fn(() => "/dashboard/myjobs/job-1"),
}));
let capturedOnMatchSaved: ((score: number, data: string) => void) | undefined;
@@ -38,6 +40,15 @@ vi.mock("@/components/CircularScore", () => ({
),
}));
+const baseProps = {
+ jobStatuses: [],
+ companies: [],
+ titles: [],
+ locations: [],
+ sources: [],
+ tags: [],
+};
+
const makeJob = (overrides: Partial<JobResponse> = {}): JobResponse => ({
id: "job-1",
userId: "user-1",
@@ -85,7 +96,7 @@ describe("JobDetails – skill badges", () => {
},
{ id: "tag-3", label: "Node.js", value: "node.js", createdBy: "user-1" },
];
- render(<JobDetails job={makeJob({ tags })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ tags })} />);
expect(screen.getByText("React")).toBeInTheDocument();
expect(screen.getByText("TypeScript")).toBeInTheDocument();
@@ -93,7 +104,7 @@ describe("JobDetails – skill badges", () => {
});
it("renders no tag badges when the job has no tags", () => {
- render(<JobDetails job={makeJob({ tags: [] })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ tags: [] })} />);
// Verify tag area is simply absent; badges for these labels shouldn't exist
expect(screen.queryByText("React")).not.toBeInTheDocument();
@@ -103,7 +114,7 @@ describe("JobDetails – skill badges", () => {
it("renders no tag badges when tags property is undefined", () => {
const job = makeJob();
delete job.tags;
- render(<JobDetails job={job} />);
+ render(<JobDetails {...baseProps} job={job} />);
// Should render without crashing and show no skill badges
expect(screen.getByText("Frontend Developer")).toBeInTheDocument();
@@ -113,7 +124,7 @@ describe("JobDetails – skill badges", () => {
const tags: Tag[] = [
{ id: "tag-1", label: "GraphQL", value: "graphql", createdBy: "user-1" },
];
- render(<JobDetails job={makeJob({ tags })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ tags })} />);
expect(screen.getByText("GraphQL")).toBeInTheDocument();
});
@@ -123,7 +134,7 @@ describe("JobDetails – skill badges", () => {
{ id: "tag-1", label: "React", value: "react", createdBy: "user-1" },
{ id: "tag-2", label: "Vue", value: "vue", createdBy: "user-1" },
];
- render(<JobDetails job={makeJob({ tags })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ tags })} />);
// getAllByText returns an array; each label should appear exactly once in the badge area
expect(screen.getAllByText("React")).toHaveLength(1);
@@ -141,7 +152,7 @@ describe("JobDetails – match data display", () => {
matchScore: 85,
summary: "Good match",
});
- render(<JobDetails job={makeJob({ matchScore: 85, matchData })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ matchScore: 85, matchData })} />);
expect(screen.getByText("AI Match Analysis")).toBeInTheDocument();
expect(screen.getByText("85%")).toBeInTheDocument();
@@ -149,14 +160,14 @@ describe("JobDetails – match data display", () => {
});
it("does not show inline match section when job has no matchData", () => {
- render(<JobDetails job={makeJob()} />);
+ render(<JobDetails {...baseProps} job={makeJob()} />);
expect(screen.queryByText("AI Match Analysis")).not.toBeInTheDocument();
expect(screen.queryByTestId("match-details")).not.toBeInTheDocument();
});
it("updates inline match display when onMatchSaved is called", () => {
- render(<JobDetails job={makeJob()} />);
+ render(<JobDetails {...baseProps} job={makeJob()} />);
// Initially no match section
expect(screen.queryByText("AI Match Analysis")).not.toBeInTheDocument();
@@ -181,7 +192,7 @@ describe("JobDetails – match data display", () => {
matchScore: 60,
summary: "Old match",
});
- render(<JobDetails job={makeJob({ matchScore: 60, matchData: oldMatchData })} />);
+ render(<JobDetails {...baseProps} job={makeJob({ matchScore: 60, matchData: oldMatchData })} />);
expect(screen.getByText("60%")).toBeInTheDocument();
diff --git a/src/app/dashboard/myjobs/[id]/page.tsx b/src/app/dashboard/myjobs/[id]/page.tsx
index 417251d..02e44cf 100644
--- a/src/app/dashboard/myjobs/[id]/page.tsx
+++ b/src/app/dashboard/myjobs/[id]/page.tsx
@@ -1,13 +1,38 @@
-import { getJobDetails } from "@/actions/job.actions";
+import {
+ getJobDetails,
+ getJobSourceList,
+ getStatusList,
+} from "@/actions/job.actions";
import JobDetails from "@/components/myjobs/JobDetails";
+import { getAllCompanies } from "@/actions/company.actions";
+import { getAllJobTitles } from "@/actions/jobtitle.actions";
+import { getAllJobLocations } from "@/actions/jobLocation.actions";
+import { getAllTags } from "@/actions/tag.actions";
async function JobDetailsPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
- const { job } = await getJobDetails(id);
+ const [{ job }, statuses, companies, titles, locations, sources, tags] =
+ await Promise.all([
+ getJobDetails(id),
+ getStatusList(),
+ getAllCompanies(),
+ getAllJobTitles(),
+ getAllJobLocations(),
+ getJobSourceList(),
+ getAllTags(),
+ ]);
return (
<div className="col-span-3">
- <JobDetails job={job} />
+ <JobDetails
+ job={job}
+ jobStatuses={statuses}
+ companies={companies}
+ titles={titles}
+ locations={locations}
+ sources={sources}
+ tags={tags ?? []}
+ />
</div>
);
}
diff --git a/src/components/activities/ActivitiesTable.tsx b/src/components/activities/ActivitiesTable.tsx
index cf5961d..56a7796 100644
--- a/src/components/activities/ActivitiesTable.tsx
+++ b/src/components/activities/ActivitiesTable.tsx
@@ -1,5 +1,5 @@
"use client";
-import { CirclePlay, MoreHorizontal, Trash } from "lucide-react";
+import { CirclePlay, MoreVertical, Trash } from "lucide-react";
import {
Table,
TableBody,
@@ -50,7 +50,7 @@ function ActivitiesTable({
setAlertOpen(true);
setActivityIdToDelete(id);
},
- []
+ [],
);
const deleteActivity = async () => {
@@ -118,7 +118,7 @@ function ActivitiesTable({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/ActivityTypesTable.tsx b/src/components/admin/ActivityTypesTable.tsx
index 0157428..63800a3 100644
--- a/src/components/admin/ActivityTypesTable.tsx
+++ b/src/components/admin/ActivityTypesTable.tsx
@@ -15,7 +15,7 @@ import {
TableHeader,
TableRow,
} from "../ui/table";
-import { MoreHorizontal, Trash } from "lucide-react";
+import { MoreVertical, Trash } from "lucide-react";
import { useState } from "react";
import { deleteActivityTypeById } from "@/actions/activity.actions";
import { toast } from "../ui/use-toast";
@@ -127,7 +127,7 @@ function ActivityTypesTable({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/CompaniesTable.tsx b/src/components/admin/CompaniesTable.tsx
index 66b0027..05dc52f 100644
--- a/src/components/admin/CompaniesTable.tsx
+++ b/src/components/admin/CompaniesTable.tsx
@@ -16,7 +16,7 @@ import {
TableRow,
} from "../ui/table";
import { Company } from "@/models/job.model";
-import { Briefcase, MoreHorizontal, Pencil, Trash } from "lucide-react";
+import { Briefcase, MoreVertical, Pencil, Trash } from "lucide-react";
import { useState } from "react";
import Link from "next/link";
import { deleteCompanyById } from "@/actions/company.actions";
@@ -130,7 +130,7 @@ function CompaniesTable({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/JobLocationsTable.tsx b/src/components/admin/JobLocationsTable.tsx
index 25bc2d2..8de7afb 100644
--- a/src/components/admin/JobLocationsTable.tsx
+++ b/src/components/admin/JobLocationsTable.tsx
@@ -19,7 +19,7 @@ import {
TableRow,
} from "../ui/table";
import { JobLocation } from "@/models/job.model";
-import { Briefcase, MoreHorizontal, Trash } from "lucide-react";
+import { Briefcase, MoreVertical, Trash } from "lucide-react";
import Link from "next/link";
import { AlertDialog } from "@/models/alertDialog.model";
import { toast } from "../ui/use-toast";
@@ -111,7 +111,7 @@ function JobLocationsTable({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/JobSourcesTable.tsx b/src/components/admin/JobSourcesTable.tsx
index e6e59a4..4506806 100644
--- a/src/components/admin/JobSourcesTable.tsx
+++ b/src/components/admin/JobSourcesTable.tsx
@@ -18,7 +18,7 @@ import {
TableRow,
} from "../ui/table";
import { JobSource } from "@/models/job.model";
-import { Briefcase, MoreHorizontal, Trash } from "lucide-react";
+import { Briefcase, MoreVertical, Trash } from "lucide-react";
import Link from "next/link";
import { AlertDialog } from "@/models/alertDialog.model";
import { DeleteAlertDialog } from "../DeleteAlertDialog";
@@ -114,7 +114,7 @@ function JobSourcesTable({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/JobTitlesTable.tsx b/src/components/admin/JobTitlesTable.tsx
index 65b5024..21caf50 100644
--- a/src/components/admin/JobTitlesTable.tsx
+++ b/src/components/admin/JobTitlesTable.tsx
@@ -18,7 +18,7 @@ import {
TableRow,
} from "../ui/table";
import { JobTitle } from "@/models/job.model";
-import { Briefcase, MoreHorizontal, Trash } from "lucide-react";
+import { Briefcase, MoreVertical, Trash } from "lucide-react";
import Link from "next/link";
import { AlertDialog } from "@/models/alertDialog.model";
import { DeleteAlertDialog } from "../DeleteAlertDialog";
@@ -110,7 +110,7 @@ function JobTitlesTable({ jobTitles, reloadJobTitles }: JobTitlesTableProps) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/admin/TagsTable.tsx b/src/components/admin/TagsTable.tsx
index 2851875..6e94173 100644
--- a/src/components/admin/TagsTable.tsx
+++ b/src/components/admin/TagsTable.tsx
@@ -16,7 +16,7 @@ import {
TableRow,
} from "../ui/table";
import { Tag } from "@/models/job.model";
-import { MoreHorizontal, Trash } from "lucide-react";
+import { MoreVertical, Trash } from "lucide-react";
import { useState } from "react";
import { deleteTagById } from "@/actions/tag.actions";
import { toast } from "../ui/use-toast";
@@ -110,7 +110,7 @@ function TagsTable({ tags, reloadTags }: TagsTableProps) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-haspopup="true" size="icon" variant="ghost">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/automations/AutomationList.tsx b/src/components/automations/AutomationList.tsx
index 1c804ee..bfb10e5 100644
--- a/src/components/automations/AutomationList.tsx
+++ b/src/components/automations/AutomationList.tsx
@@ -24,7 +24,7 @@ import {
} from "@/components/ui/alert-dialog";
import { toast } from "@/components/ui/use-toast";
import {
- MoreHorizontal,
+ MoreVertical,
Pause,
Play,
Pencil,
@@ -118,7 +118,8 @@ export function AutomationList({
<Zap className="h-12 w-12 text-muted-foreground mb-4" />
<h3 className="text-lg font-medium">No automations yet</h3>
<p className="text-muted-foreground text-center mt-2">
- Create your first automation to start discovering jobs automatically.
+ Create your first automation to start discovering jobs
+ automatically.
</p>
</CardContent>
</Card>
@@ -165,7 +166,9 @@ export function AutomationList({
{automation.jobBoard}
</Badge>
<Badge
- variant={automation.status === "active" ? "default" : "secondary"}
+ variant={
+ automation.status === "active" ? "default" : "secondary"
+ }
>
{automation.status}
</Badge>
@@ -220,16 +223,22 @@ export function AutomationList({
) : (
<div className="flex flex-wrap gap-x-6 gap-y-1 text-sm text-muted-foreground">
<span>
- <span className="font-medium text-foreground">Keywords:</span>{" "}
+ <span className="font-medium text-foreground">
+ Keywords:
+ </span>{" "}
{automation.keywords}
</span>
<span>
- <span className="font-medium text-foreground">Location:</span>{" "}
+ <span className="font-medium text-foreground">
+ Location:
+ </span>{" "}
{automation.location}
</span>
{automation.resume && (
<span>
- <span className="font-medium text-foreground">Resume:</span>{" "}
+ <span className="font-medium text-foreground">
+ Resume:
+ </span>{" "}
{automation.resume.title}
</span>
)}
@@ -240,7 +249,8 @@ export function AutomationList({
<div className="flex items-center gap-1">
<Clock className="h-4 w-4" />
<span>
- {automation.scheduleHour.toString().padStart(2, "0")}:00 daily
+ {automation.scheduleHour.toString().padStart(2, "0")}:00
+ daily
</span>
</div>
<div className="flex items-center gap-1">
@@ -249,12 +259,14 @@ export function AutomationList({
</div>
{automation.nextRunAt && automation.status === "active" && (
<span className="text-xs">
- Next: {format(new Date(automation.nextRunAt), "MMM d, h:mm a")}
+ Next:{" "}
+ {format(new Date(automation.nextRunAt), "MMM d, h:mm a")}
</span>
)}
{automation.lastRunAt && (
<span className="text-xs">
- Last: {format(new Date(automation.lastRunAt), "MMM d, h:mm a")}
+ Last:{" "}
+ {format(new Date(automation.lastRunAt), "MMM d, h:mm a")}
</span>
)}
</div>
@@ -263,12 +275,14 @@ export function AutomationList({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon" disabled={isLoading}>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{automation.status === "active" ? (
- <DropdownMenuItem onClick={() => handlePause(automation.id)}>
+ <DropdownMenuItem
+ onClick={() => handlePause(automation.id)}
+ >
<Pause className="h-4 w-4 mr-2" />
Pause
</DropdownMenuItem>
@@ -305,8 +319,9 @@ export function AutomationList({
<AlertDialogHeader>
<AlertDialogTitle>Delete Automation</AlertDialogTitle>
<AlertDialogDescription>
- Are you sure you want to delete this automation? This action cannot be
- undone. Discovered jobs will remain but lose their automation reference.
+ Are you sure you want to delete this automation? This action
+ cannot be undone. Discovered jobs will remain but lose their
+ automation reference.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsx
index 038d7e6..fc07f56 100644
--- a/src/components/myjobs/AddJob.tsx
+++ b/src/components/myjobs/AddJob.tsx
@@ -62,6 +62,8 @@ type AddJobProps = {
editJob?: JobResponse | null;
resetEditJob: () => void;
initialOpen?: boolean;
+ hideTrigger?: boolean;
+ redirectPath?: string;
};
export function AddJob({
@@ -74,6 +76,8 @@ export function AddJob({
editJob,
resetEditJob,
initialOpen,
+ hideTrigger,
+ redirectPath,
}: AddJobProps) {
const router = useRouter();
const searchParams = useSearchParams();
@@ -190,7 +194,7 @@ export function AddJob({
description: message,
});
}
- redirect("/dashboard/myjobs");
+ redirect(redirectPath ?? "/dashboard/myjobs");
});
toast({
variant: "success",
@@ -227,18 +231,20 @@ export function AddJob({
return (
<>
- <Button
- size="sm"
- variant="outline"
- className="h-8 gap-1"
- onClick={addJobForm}
- data-testid="add-job-btn"
- >
- <PlusCircle className="h-3.5 w-3.5" />
- <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
- New Job
- </span>
- </Button>
+ {!hideTrigger && (
+ <Button
+ size="sm"
+ variant="outline"
+ className="h-8 gap-1"
+ onClick={addJobForm}
+ data-testid="add-job-btn"
+ >
+ <PlusCircle className="h-3.5 w-3.5" />
+ <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
+ New Job
+ </span>
+ </Button>
+ )}
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
<DialogOverlay>
<DialogContent className="h-full xl:h-[85vh] lg:h-[95vh] lg:max-w-screen-lg lg:max-h-screen overflow-y-scroll">
diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsx
index d28f805..5975bdc 100644
--- a/src/components/myjobs/JobDetails.tsx
+++ b/src/components/myjobs/JobDetails.tsx
@@ -2,7 +2,15 @@
import { format } from "date-fns";
import { Badge } from "../ui/badge";
import { cn, formatUrl } from "@/lib/utils";
-import { JobResponse } from "@/models/job.model";
+import {
+ Company,
+ JobLocation,
+ JobResponse,
+ JobSource,
+ JobStatus,
+ JobTitle,
+ Tag,
+} from "@/models/job.model";
import { TipTapContentViewer } from "../TipTapContentViewer";
import {
Card,
@@ -12,7 +20,15 @@ import {
CardTitle,
} from "../ui/card";
import { Button } from "../ui/button";
-import { ArrowLeft, Sparkles } from "lucide-react";
+import {
+ ArrowLeft,
+ MoreVertical,
+ Pencil,
+ Sparkles,
+ StickyNote,
+ Tags,
+ Trash,
+} from "lucide-react";
import { useRouter } from "next/navigation";
import { AiJobMatchSection } from "../profile/AiJobMatchSection";
import { NotesSection } from "./NotesSection";
@@ -21,11 +37,52 @@ import { DownloadFileButton } from "../profile/DownloadFileButton";
import { MatchDetails } from "../automations/MatchDetails";
import type { JobMatchData } from "@/models/ai.schemas";
import { CircularScore } from "@/components/CircularScore";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuPortal,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+} from "../ui/dropdown-menu";
+import { DeleteAlertDialog } from "../DeleteAlertDialog";
+import { AddJob } from "./AddJob";
+import { deleteJobById, updateJobStatus } from "@/actions/job.actions";
+import { toast } from "../ui/use-toast";
-function JobDetails({ job }: { job: JobResponse }) {
+type JobDetailsProps = {
+ job: JobResponse;
+ jobStatuses: JobStatus[];
+ companies: Company[];
+ titles: JobTitle[];
+ locations: JobLocation[];
+ sources: JobSource[];
+ tags: Tag[];
+};
+
+function JobDetails({
+ job,
+ jobStatuses,
+ companies,
+ titles,
+ locations,
+ sources,
+ tags,
+}: JobDetailsProps) {
const [aiSectionOpen, setAiSectionOpen] = useState(false);
const [currentMatchScore, setCurrentMatchScore] = useState(job.matchScore);
const [currentMatchData, setCurrentMatchData] = useState(job.matchData);
+ const [currentStatus, setCurrentStatus] = useState(job.Status);
+ const [editJobTarget, setEditJobTarget] = useState<JobResponse | null>(
+ null,
+ );
+ const [deleteAlertOpen, setDeleteAlertOpen] = useState(false);
+ const [noteOpenTrigger, setNoteOpenTrigger] = useState(0);
const router = useRouter();
const goBack = () => router.back();
@@ -48,6 +105,51 @@ function JobDetails({ job }: { job: JobResponse }) {
const getAiJobMatch = async () => {
setAiSectionOpen(true);
};
+
+ const onEditJob = () => {
+ setEditJobTarget({ ...job, Status: currentStatus });
+ };
+
+ const resetEditJob = () => setEditJobTarget(null);
+
+ const onAddNote = () => {
+ setNoteOpenTrigger((prev) => prev + 1);
+ };
+
+ const onChangeStatus = async (status: JobStatus) => {
+ const { success, message } = await updateJobStatus(job.id, status);
+ if (success) {
+ setCurrentStatus(status);
+ toast({
+ variant: "success",
+ description: `Job has been updated successfully`,
+ });
+ } else {
+ toast({
+ variant: "destructive",
+ title: "Error!",
+ description: message,
+ });
+ }
+ };
+
+ const onDeleteJob = async () => {
+ const { success, message } = await deleteJobById(job.id);
+ if (success) {
+ toast({
+ variant: "success",
+ description: `Job has been deleted successfully`,
+ });
+ router.push("/dashboard/myjobs");
+ } else {
+ toast({
+ variant: "destructive",
+ title: "Error!",
+ description: message,
+ });
+ }
+ };
+
const getJobType = (code: string) => {
switch (code) {
case "FT":
@@ -66,18 +168,75 @@ function JobDetails({ job }: { job: JobResponse }) {
<Button title="Go Back" size="sm" variant="outline" onClick={goBack}>
<ArrowLeft />
</Button>
- <Button
- size="sm"
- variant="outline"
- className="h-8 gap-1 cursor-pointer"
- onClick={getAiJobMatch}
- // disabled={loading}
- >
- <Sparkles className="h-3.5 w-3.5" />
- <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
- Match with AI
- </span>
- </Button>
+ <div className="flex items-center gap-2">
+ <Button
+ size="sm"
+ variant="outline"
+ className="h-8 gap-1 cursor-pointer"
+ onClick={getAiJobMatch}
+ // disabled={loading}
+ >
+ <Sparkles className="h-3.5 w-3.5" />
+ <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
+ Match with AI
+ </span>
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ aria-haspopup="true"
+ size="icon"
+ variant="ghost"
+ data-testid="job-details-actions-menu-btn"
+ >
+ <MoreVertical className="h-4 w-4" />
+ <span className="sr-only">Toggle menu</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-[200px]">
+ <DropdownMenuLabel>Actions</DropdownMenuLabel>
+ <DropdownMenuGroup>
+ <DropdownMenuItem className="cursor-pointer" onClick={onEditJob}>
+ <Pencil className="mr-2 h-4 w-4" />
+ Edit Job
+ </DropdownMenuItem>
+ <DropdownMenuItem className="cursor-pointer" onClick={onAddNote}>
+ <StickyNote className="mr-2 h-4 w-4" />
+ Add a Note
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <Tags className="mr-2 h-4 w-4" />
+ Change status
+ </DropdownMenuSubTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuSubContent className="p-0">
+ {jobStatuses.map((status) => (
+ <DropdownMenuItem
+ className="cursor-pointer"
+ key={status.id}
+ onSelect={() => onChangeStatus(status)}
+ disabled={status.id === currentStatus.id}
+ >
+ <span>{status.label}</span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuSubContent>
+ </DropdownMenuPortal>
+ </DropdownMenuSub>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="text-red-600 cursor-pointer"
+ onClick={() => setDeleteAlertOpen(true)}
+ >
+ <Trash className="mr-2 h-4 w-4" />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
</div>
{job?.id && (
<Card className="col-span-3">
@@ -106,17 +265,17 @@ function JobDetails({ job }: { job: JobResponse }) {
</div>
</CardHeader>
<h3 className="ml-4">
- {new Date() > job.dueDate && job.Status?.value === "draft" ? (
+ {new Date() > job.dueDate && currentStatus?.value === "draft" ? (
<Badge className="bg-red-500">Expired</Badge>
) : (
<Badge
className={cn(
"w-[70px] justify-center",
- job.Status?.value === "applied" && "bg-cyan-500",
- job.Status?.value === "interview" && "bg-green-500",
+ currentStatus?.value === "applied" && "bg-cyan-500",
+ currentStatus?.value === "interview" && "bg-green-500",
)}
>
- {job.Status?.label}
+ {currentStatus?.label}
</Badge>
)}
<span className="ml-2">
@@ -163,7 +322,7 @@ function JobDetails({ job }: { job: JobResponse }) {
<MatchDetails matchData={parsedMatchData} />
</div>
)}
- <NotesSection jobId={job.id} />
+ <NotesSection jobId={job.id} openTrigger={noteOpenTrigger} />
<CardFooter></CardFooter>
</Card>
)}
@@ -175,6 +334,24 @@ function JobDetails({ job }: { job: JobResponse }) {
onMatchSaved={handleMatchSaved}
/>
}
+ <AddJob
+ jobStatuses={jobStatuses}
+ companies={companies}
+ jobTitles={titles}
+ locations={locations}
+ jobSources={sources}
+ tags={tags}
+ editJob={editJobTarget}
+ resetEditJob={resetEditJob}
+ hideTrigger
+ redirectPath={`/dashboard/myjobs/${job.id}`}
+ />
+ <DeleteAlertDialog
+ pageTitle="job"
+ open={deleteAlertOpen}
+ onOpenChange={setDeleteAlertOpen}
+ onDelete={onDeleteJob}
+ />
</>
);
}
diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsx
index f22ce5f..0b0d7ee 100644
--- a/src/components/myjobs/MyJobsTable.tsx
+++ b/src/components/myjobs/MyJobsTable.tsx
@@ -9,7 +9,7 @@ import {
} from "../ui/table";
import {
ListCollapse,
- MoreHorizontal,
+ MoreVertical,
Pencil,
StickyNote,
Tags,
@@ -159,7 +159,7 @@ function MyJobsTable({
variant="ghost"
data-testid="job-actions-menu-btn"
>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
diff --git a/src/components/myjobs/NotesSection.tsx b/src/components/myjobs/NotesSection.tsx
index 5d416da..a55a28a 100644
--- a/src/components/myjobs/NotesSection.tsx
+++ b/src/components/myjobs/NotesSection.tsx
@@ -1,5 +1,5 @@
"use client";
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import { NoteResponse } from "@/models/note.model";
import { getNotesByJobId, deleteNote } from "@/actions/note.actions";
import { NoteCard } from "./NoteCard";
@@ -17,9 +17,10 @@ import { toast } from "../ui/use-toast";
type NotesSectionProps = {
jobId: string;
+ openTrigger?: number;
};
-export function NotesSection({ jobId }: NotesSectionProps) {
+export function NotesSection({ jobId, openTrigger }: NotesSectionProps) {
const [notes, setNotes] = useState<NoteResponse[]>([]);
const [isOpen, setIsOpen] = useState(false);
const [dialogOpen, setDialogOpen] = useState(false);
@@ -71,6 +72,15 @@ export function NotesSection({ jobId }: NotesSectionProps) {
setDialogOpen(true);
};
+ const lastOpenTrigger = useRef(openTrigger);
+ useEffect(() => {
+ if (openTrigger === undefined || openTrigger === lastOpenTrigger.current) {
+ return;
+ }
+ lastOpenTrigger.current = openTrigger;
+ handleAddNote();
+ }, [openTrigger]);
+
const handleSaved = () => {
setEditNote(null);
loadNotes();
diff --git a/src/components/profile/ResumeContainer.tsx b/src/components/profile/ResumeContainer.tsx
index ccc3275..dfaa0a4 100644
--- a/src/components/profile/ResumeContainer.tsx
+++ b/src/components/profile/ResumeContainer.tsx
@@ -36,7 +36,7 @@ import {
import { Button } from "../ui/button";
import { Badge } from "../ui/badge";
import {
- MoreHorizontal,
+ MoreVertical,
FileDown,
Sparkles,
Check,
@@ -44,7 +44,10 @@ import {
Loader,
AlertTriangle,
} from "lucide-react";
-import { deleteResumeById, deleteSkillsSection } from "@/actions/profile.actions";
+import {
+ deleteResumeById,
+ deleteSkillsSection,
+} from "@/actions/profile.actions";
import {
resolveImportCard,
ImportCardPayload,
@@ -80,12 +83,9 @@ function filterUnrecognizedSections(sections: string[]): string[] {
});
}
-
// Accepts partial data so cards can render progressively as the import stream
// arrives. Entries are only shown once their key identifying field is present.
-function buildPendingCards(
- data: DeepPartial<ResumeImportData>,
-): PendingCard[] {
+function buildPendingCards(data: DeepPartial<ResumeImportData>): PendingCard[] {
const cards: PendingCard[] = [];
if (!data) return cards;
@@ -730,7 +730,7 @@ function ResumeContainer({ resume }: { resume: Resume }) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button size="sm" variant="outline">
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -781,8 +781,8 @@ function ResumeContainer({ resume }: { resume: Resume }) {
) : (
<>
<Sparkles className="h-4 w-4 text-blue-500" />
- We pre-filled this from your document. Review each item and
- accept the ones you want.
+ We pre-filled this from your document. Review each item
+ and accept the ones you want.
{importTruncated &&
" Only the first 5 pages were imported."}
</>
diff --git a/src/components/profile/ResumeTable.tsx b/src/components/profile/ResumeTable.tsx
index 9203f09..6c27513 100644
--- a/src/components/profile/ResumeTable.tsx
+++ b/src/components/profile/ResumeTable.tsx
@@ -1,7 +1,7 @@
"use client";
import {
FilePenLine,
- MoreHorizontal,
+ MoreVertical,
Paperclip,
Pencil,
Trash,
@@ -46,22 +46,20 @@ function DocumentTable({
reloadDocuments,
}: DocumentTableProps) {
const [alertOpen, setAlertOpen] = useState(false);
- const [documentToDelete, setDocumentToDelete] =
- useState<ProfileDocument>();
+ const [documentToDelete, setDocumentToDelete] = useState<ProfileDocument>();
const onDeleteDocument = useMemo(
() => (doc: ProfileDocument) => {
if (!doc.id) return;
setAlertOpen(true);
setDocumentToDelete(doc);
},
- []
+ [],
);
const deleteDocument = async (doc: ProfileDocument) => {
if (!doc.id) return;
if (doc.jobCount > 0) {
- const label =
- doc.type === "resume" ? "resume" : "cover letter";
+ const label = doc.type === "resume" ? "resume" : "cover letter";
return toast({
variant: "destructive",
title: "Error!",
@@ -75,8 +73,7 @@ function DocumentTable({
: await deleteCoverLetterById(doc.id);
if (success) {
- const label =
- doc.type === "resume" ? "Resume" : "Cover letter";
+ const label = doc.type === "resume" ? "Resume" : "Cover letter";
toast({
variant: "success",
description: `${label} has been deleted successfully`,
@@ -133,9 +130,7 @@ function DocumentTable({
)}
</TableCell>
<TableCell>
- <Badge
- variant={isResume ? "default" : "secondary"}
- >
+ <Badge variant={isResume ? "default" : "secondary"}>
{isResume ? "Resume" : "Cover Letter"}
</Badge>
</TableCell>
@@ -155,7 +150,7 @@ function DocumentTable({
variant="ghost"
data-testid="document-actions-menu-btn"
>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>
@@ -170,9 +165,7 @@ function DocumentTable({
<Pencil className="mr-2 h-4 w-4" />
Edit Resume Title
</DropdownMenuItem>
- <Link
- href={`/dashboard/profile/resume/${doc.id}`}
- >
+ <Link href={`/dashboard/profile/resume/${doc.id}`}>
<DropdownMenuItem className="cursor-pointer">
<FilePenLine className="mr-2 h-4 w-4" />
View/Edit Resume
@@ -205,9 +198,7 @@ function DocumentTable({
</Table>
<DeleteAlertDialog
pageTitle={
- documentToDelete?.type === "cover-letter"
- ? "cover letter"
- : "resume"
+ documentToDelete?.type === "cover-letter" ? "cover letter" : "resume"
}
open={alertOpen}
onOpenChange={setAlertOpen}
diff --git a/src/components/questions/QuestionCard.tsx b/src/components/questions/QuestionCard.tsx
index 207aefa..9a095d7 100644
--- a/src/components/questions/QuestionCard.tsx
+++ b/src/components/questions/QuestionCard.tsx
@@ -3,7 +3,7 @@ import { useState } from "react";
import { Question } from "@/models/question.model";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
-import { MoreHorizontal, Pencil, Trash2 } from "lucide-react";
+import { MoreVertical, Pencil, Trash2 } from "lucide-react";
import {
DropdownMenu,
DropdownMenuContent,
@@ -60,7 +60,7 @@ export function QuestionCard({
className="h-8 w-8 p-0"
onClick={(e) => e.stopPropagation()}
>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/src/components/tasks/TasksTable.tsx b/src/components/tasks/TasksTable.tsx
index b656246..ed81672 100644
--- a/src/components/tasks/TasksTable.tsx
+++ b/src/components/tasks/TasksTable.tsx
@@ -8,7 +8,7 @@ import {
TableRow,
} from "../ui/table";
import {
- MoreHorizontal,
+ MoreVertical,
Pencil,
Tags,
Trash,
@@ -289,7 +289,7 @@ function TasksTable({
variant="ghost"
data-testid="task-actions-menu-btn"
>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreVertical className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>
</DropdownMenuTrigger>