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
Enhance various components with DialogDescription for improved user guidance and update test cases for better data handling
Khuram Niazbaf90cdb1707
diff --git a/__tests__/ActivitiesContainer.spec.tsx b/__tests__/ActivitiesContainer.spec.tsxindex d16c210..4fdfa3a 100644--- a/__tests__/ActivitiesContainer.spec.tsx+++ b/__tests__/ActivitiesContainer.spec.tsx@@ -392,11 +392,33 @@ describe("ActivitiesContainer Search Functionality", () => {describe("Infinite Scroll with Search", () => {it("should preserve search term when loading more via scroll", async () => {- (getActivitiesList as any).mockResolvedValue({- success: true,- data: mockActivities,- total: 50,- });+ (getActivitiesList as any)+ .mockResolvedValueOnce({+ success: true,+ data: mockActivities,+ total: 50,+ })+ .mockResolvedValueOnce({+ success: true,+ data: mockActivities,+ total: 50,+ })+ .mockResolvedValueOnce({+ success: true,+ data: [+ {+ id: "4",+ activityName: "Interview Prep",+ startTime: new Date("2024-06-21T09:00:00"),+ endTime: new Date("2024-06-21T10:00:00"),+ duration: 60,+ description: "Practicing interview questions",+ createdAt: new Date("2024-06-21"),+ activityType: { id: "1", label: "Learning", value: "learning" },+ },+ ],+ total: 50,+ });renderComponent();diff --git a/__tests__/AddExperience.spec.tsx b/__tests__/AddExperience.spec.tsxindex 0620afa..7ae538e 100644--- a/__tests__/AddExperience.spec.tsx+++ b/__tests__/AddExperience.spec.tsx@@ -570,7 +570,8 @@ describe("AddExperience Component", () => {);await waitFor(() => {- expect(screen.getByTestId("combobox-title")).toBeInTheDocument();+ const jobTitleSelect = screen.getByTestId("combobox-title") as HTMLSelectElement;+ expect(jobTitleSelect.options.length).toBeGreaterThan(1);});const jobTitleSelect = screen.getByTestId(diff --git a/__tests__/CompaniesContainer.spec.tsx b/__tests__/CompaniesContainer.spec.tsxindex cc14f23..2d21a80 100644--- a/__tests__/CompaniesContainer.spec.tsx+++ b/__tests__/CompaniesContainer.spec.tsx@@ -227,10 +227,13 @@ describe("CompaniesContainer Search Functionality", () => {});it("should preserve search term when loading more companies", async () => {- (getCompanyList as any).mockResolvedValue({- data: mockCompanies,- total: 5,- });+ (getCompanyList as any)+ .mockResolvedValueOnce({ data: mockCompanies, total: 5 })+ .mockResolvedValueOnce({ data: mockCompanies, total: 5 })+ .mockResolvedValueOnce({+ data: [{ id: "3", label: "Meta", value: "meta", createdBy: "user-1" }],+ total: 5,+ });render(<CompaniesContainer />);diff --git a/__tests__/JobTitlesContainer.spec.tsx b/__tests__/JobTitlesContainer.spec.tsxindex dc22351..363011f 100644--- a/__tests__/JobTitlesContainer.spec.tsx+++ b/__tests__/JobTitlesContainer.spec.tsx@@ -161,10 +161,20 @@ describe("JobTitlesContainer Search Functionality", () => {});it("should preserve search term when loading more job titles", async () => {- (getJobTitleList as any).mockResolvedValue({- data: mockTitles,- total: 5,- });+ (getJobTitleList as any)+ .mockResolvedValueOnce({ data: mockTitles, total: 5 })+ .mockResolvedValueOnce({ data: mockTitles, total: 5 })+ .mockResolvedValueOnce({+ data: [+ {+ id: "3",+ label: "Designer",+ value: "designer",+ createdBy: "user-1",+ },+ ],+ total: 5,+ });render(<JobTitlesContainer />);diff --git a/__tests__/JobsContainer.spec.tsx b/__tests__/JobsContainer.spec.tsxindex 67ffe42..f8e242f 100644--- a/__tests__/JobsContainer.spec.tsx+++ b/__tests__/JobsContainer.spec.tsx@@ -625,11 +625,51 @@ describe("JobsContainer Search Functionality", () => {describe("Infinite Scroll with Search", () => {it("should preserve search term when loading more via scroll", async () => {- (getJobsList as any).mockResolvedValue({- success: true,- data: mockJobs,- total: 50,- });+ (getJobsList as any)+ .mockResolvedValueOnce({+ success: true,+ data: mockJobs,+ total: 50,+ })+ .mockResolvedValueOnce({+ success: true,+ data: mockJobs,+ total: 50,+ })+ .mockResolvedValueOnce({+ success: true,+ data: [+ {+ id: "3",+ userId: "user-1",+ JobTitle: {+ id: "3",+ label: "Backend Developer",+ value: "backend developer",+ createdBy: "user-1",+ },+ Company: {+ id: "3",+ label: "Meta",+ value: "meta",+ createdBy: "user-1",+ logoUrl: "",+ },+ Location: {+ id: "3",+ label: "New York",+ value: "new york",+ createdBy: "user-1",+ },+ Status: { id: "1", label: "Applied", value: "applied" },+ JobSource: { id: "1", label: "Indeed", value: "indeed" },+ jobType: "FT",+ appliedDate: new Date("2024-06-21"),+ dueDate: new Date("2024-06-26"),+ },+ ],+ total: 50,+ });renderComponent();diff --git a/__tests__/TagsContainer.spec.tsx b/__tests__/TagsContainer.spec.tsxindex 66a3ce7..76bbe6e 100644--- a/__tests__/TagsContainer.spec.tsx+++ b/__tests__/TagsContainer.spec.tsx@@ -155,7 +155,21 @@ describe("TagsContainer Search Functionality", () => {});it("should preserve search term when loading more skills", async () => {- (getTagList as any).mockResolvedValue({ data: mockTags, total: 5 });+ (getTagList as any)+ .mockResolvedValueOnce({ data: mockTags, total: 5 })+ .mockResolvedValueOnce({ data: mockTags, total: 5 })+ .mockResolvedValueOnce({+ data: [+ {+ id: "3",+ label: "TypeScript",+ value: "typescript",+ createdBy: "user-1",+ _count: { jobs: 0, questions: 0, skills: 0 },+ },+ ],+ total: 5,+ });render(<TagsContainer />);diff --git a/__tests__/TasksContainer.spec.tsx b/__tests__/TasksContainer.spec.tsxindex a5e05b5..4fcf25d 100644--- a/__tests__/TasksContainer.spec.tsx+++ b/__tests__/TasksContainer.spec.tsx@@ -1,5 +1,5 @@import TasksContainer from "@/components/tasks/TasksContainer";-import { screen, render, waitFor } from "@testing-library/react";+import { screen, render, waitFor, act } from "@testing-library/react";import userEvent from "@testing-library/user-event";import {getTasksList,@@ -781,10 +781,12 @@ describe("TasksContainer Component", () => {});// Simulate sentinel becoming visible- intersectionCallback(- [{ isIntersecting: true }] as IntersectionObserverEntry[],- {} as IntersectionObserver,- );+ await act(async () => {+ intersectionCallback(+ [{ isIntersecting: true }] as IntersectionObserverEntry[],+ {} as IntersectionObserver,+ );+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(2, 25, undefined, [@@ -923,7 +925,9 @@ describe("TasksContainer Component", () => {expect(getTasksList).not.toHaveBeenCalled();// Fast-forward past the 300ms debounce- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -964,7 +968,9 @@ describe("TasksContainer Component", () => {"Task 1");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(screen.getByText("Task 1")).toBeInTheDocument();@@ -997,7 +1003,9 @@ describe("TasksContainer Component", () => {"nonexistent");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(screen.getByText(/No tasks found/i)).toBeInTheDocument();@@ -1049,7 +1057,9 @@ describe("TasksContainer Component", () => {"Task");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1091,7 +1101,9 @@ describe("TasksContainer Component", () => {"Development");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1135,7 +1147,9 @@ describe("TasksContainer Component", () => {"Task");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1150,10 +1164,12 @@ describe("TasksContainer Component", () => {vi.clearAllMocks();// Simulate sentinel becoming visible- intersectionCallback(- [{ isIntersecting: true }] as IntersectionObserverEntry[],- {} as IntersectionObserver,- );+ await act(async () => {+ intersectionCallback(+ [{ isIntersecting: true }] as IntersectionObserverEntry[],+ {} as IntersectionObserver,+ );+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1187,7 +1203,9 @@ describe("TasksContainer Component", () => {"first search");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1210,7 +1228,9 @@ describe("TasksContainer Component", () => {"second search");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(@@ -1248,7 +1268,9 @@ describe("TasksContainer Component", () => {await typingUser.type(searchInput, "Task");// Only after full debounce should API be called- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenLastCalledWith(@@ -1288,7 +1310,9 @@ describe("TasksContainer Component", () => {"Task");- vi.advanceTimersByTime(300);+ await act(async () => {+ vi.advanceTimersByTime(300);+ });await waitFor(() => {expect(getTasksList).toHaveBeenCalledWith(diff --git a/__tests__/jobDedupe.spec.ts b/__tests__/jobDedupe.spec.tsindex 5fb4fa1..829fee1 100644--- a/__tests__/jobDedupe.spec.ts+++ b/__tests__/jobDedupe.spec.ts@@ -5,7 +5,7 @@ import { PrismaClient } from "@prisma/client";const prisma = new PrismaClient();vi.mock("@prisma/client", () => {- const m = { job: { findMany: vi.fn() } };+ const m = { job: { findMany: vi.fn(), findFirst: vi.fn() } };return { PrismaClient: vi.fn(function () { return m; }) };});@@ -123,7 +123,10 @@ describe("add_job Tier 1 URL matching via the dedupe map", () => {});describe("findExistingJobByUrl", () => {- beforeEach(() => (prisma.job.findMany as any).mockReset());+ beforeEach(() => {+ (prisma.job.findMany as any).mockReset();+ (prisma.job.findFirst as any).mockReset().mockResolvedValue(null);+ });it("returns null when the user has no jobs", async () => {mockJobs([]);@@ -131,7 +134,27 @@ describe("findExistingJobByUrl", () => {expect(hit).toBeNull();});- it("scopes the query to the given user and excludes null jobUrls", async () => {+ it("tries an indexed exact match before scanning", async () => {+ (prisma.job.findFirst as any).mockResolvedValue(+ row({ id: "j1", jobUrl: "https://ex.com/j/1", title: "Engineer", company: "Acme" }),+ );++ const hit = await findExistingJobByUrl("user-1", "https://ex.com/j/1");++ expect(hit).toEqual({ id: "j1", title: "Engineer", company: "Acme" });+ expect(prisma.job.findMany).not.toHaveBeenCalled();+ });++ it("scopes the exact-match query to the given user and normalized URL", async () => {+ mockJobs([]);+ await findExistingJobByUrl("user-42", "https://ex.com/j/1/?utm_source=li");+ expect((prisma.job.findFirst as any).mock.calls[0][0].where).toEqual({+ userId: "user-42",+ jobUrl: "https://ex.com/j/1",+ });+ });++ it("falls back to scanning and scopes to the given user, excluding null jobUrls", async () => {mockJobs([]);await findExistingJobByUrl("user-42", "https://ex.com/j/1");expect((prisma.job.findMany as any).mock.calls[0][0].where).toEqual({@@ -140,7 +163,7 @@ describe("findExistingJobByUrl", () => {});});- it("finds a match and reports its identity", async () => {+ it("falls back to a scan and finds a match by identity", async () => {mockJobs([row({ id: "j1", jobUrl: "https://ex.com/j/1", title: "Engineer", company: "Acme" }),]);@@ -150,12 +173,12 @@ describe("findExistingJobByUrl", () => {expect(hit).toEqual({ id: "j1", title: "Engineer", company: "Acme" });});- it("matches a normalized URL variant (www + tracking params)", async () => {+ it("falls back to a scan and matches a canonical URL variant (www + host case)", async () => {mockJobs([row({ id: "j1", jobUrl: "https://ex.com/j/1" })]);const hit = await findExistingJobByUrl("user-1",- "https://www.ex.com/j/1?utm_source=li",+ "https://Www.Ex.com/j/1",);expect(hit?.id).toBe("j1");diff --git a/e2e/add-job.spec.ts b/e2e/add-job.spec.tsindex 1e304c5..9f93147 100644--- a/e2e/add-job.spec.ts+++ b/e2e/add-job.spec.ts@@ -31,7 +31,9 @@ test.describe("Add New Job", () => {);await expect(page.getByLabel("Job Source")).toContainText("Indeed");await expect(page.getByLabel("Select Job Status")).toContainText("Draft");- await expect(page.getByRole("paragraph")).toContainText("test description");+ await expect(+ page.getByLabel("Job Description").getByRole("paragraph"),+ ).toContainText("test description");await page.getByText("test description").click();await page.getByLabel("Job Description")diff --git a/e2e/dashboard.spec.ts b/e2e/dashboard.spec.tsindex 2046af0..13d3556 100644--- a/e2e/dashboard.spec.ts+++ b/e2e/dashboard.spec.ts@@ -111,7 +111,10 @@ test.describe("Dashboard page", () => {page.getByRole("heading", { name: "Activity Calendar", exact: true }),).toBeVisible();const currentYear = new Date().getFullYear().toString();- await expect(page.getByRole("tab", { name: currentYear })).toBeVisible();+ await page.getByLabel("Select year").click();+ await expect(+ page.getByRole("option", { name: currentYear, exact: true }),+ ).toBeVisible();});test("should navigate to create a new job and a new task from dashboard quick actions", async ({diff --git a/src/components/activities/ActivitiesContainer.tsx b/src/components/activities/ActivitiesContainer.tsxindex 9a9d32f..2a9fe9a 100644--- a/src/components/activities/ActivitiesContainer.tsx+++ b/src/components/activities/ActivitiesContainer.tsx@@ -9,6 +9,7 @@ import { useCallback, useEffect, useRef, useState } from "react";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,DialogTrigger,@@ -177,6 +178,9 @@ function ActivitiesContainer() {<DialogContent className="sm:max-w-[725px] max-h-[90vh] overflow-y-auto"><DialogHeader><DialogTitle>Add New Activity</DialogTitle>+ <DialogDescription>+ Log a new activity to track your time and progress.+ </DialogDescription></DialogHeader><div className="p-4"><ActivityFormdiff --git a/src/components/dashboard/RecentCardToggle.tsx b/src/components/dashboard/RecentCardToggle.tsxindex e97e1a2..9d38ffd 100644--- a/src/components/dashboard/RecentCardToggle.tsx+++ b/src/components/dashboard/RecentCardToggle.tsx@@ -1,6 +1,5 @@"use client";-import { useEffect, useState } from "react";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";import { Button } from "@/components/ui/button";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";@@ -8,10 +7,7 @@ import { StatusBadge } from "@/components/StatusBadge";import { getJobStatusBadgeColor } from "@/lib/badge-colors";import { cn } from "@/lib/utils";import { APP_CONSTANTS } from "@/lib/constants";-import {- getFromLocalStorage,- saveToLocalStorage,-} from "@/utils/localstorage.utils";+import { usePersistedTabIndex } from "@/hooks/usePersistedTabIndex";import { useActivity } from "@/context/ActivityContext";import { useActivitySwitchConfirm } from "@/hooks/useActivitySwitchConfirm";import { JobResponse } from "@/models/job.model";@@ -76,27 +72,13 @@ export default function RecentCardToggle({jobs,activities,}: RecentCardToggleProps) {- const [activeIndex, setActiveIndex] = useState(0);+ const [activeIndex, selectTab] = usePersistedTabIndex(+ APP_CONSTANTS.DASHBOARD_RECENT_CARD_STORAGE_KEY,+ tabs,+ );const { startActivity } = useActivity();const { requestStart, confirmDialog } = useActivitySwitchConfirm();- const selectTab = (index: number) => {- setActiveIndex(index);- saveToLocalStorage(- APP_CONSTANTS.DASHBOARD_RECENT_CARD_STORAGE_KEY,- tabs[index],- );- };-- useEffect(() => {- const savedTab = getFromLocalStorage(- APP_CONSTANTS.DASHBOARD_RECENT_CARD_STORAGE_KEY,- null,- );- const savedIndex = tabs.indexOf(savedTab);- if (savedIndex !== -1) setActiveIndex(savedIndex);- }, []);-return (<Card className="mb-2"><CardHeader>diff --git a/src/components/dashboard/WeeklyBarChartToggle.tsx b/src/components/dashboard/WeeklyBarChartToggle.tsxindex bd53543..50c1813 100644--- a/src/components/dashboard/WeeklyBarChartToggle.tsx+++ b/src/components/dashboard/WeeklyBarChartToggle.tsx@@ -5,10 +5,7 @@ import { ResponsiveBar } from "@nivo/bar";import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";import { cn } from "@/lib/utils";import { APP_CONSTANTS } from "@/lib/constants";-import {- getFromLocalStorage,- saveToLocalStorage,-} from "@/utils/localstorage.utils";+import { usePersistedTabIndex } from "@/hooks/usePersistedTabIndex";type ChartConfig = {label: string;@@ -26,29 +23,13 @@ type WeeklyBarChartToggleProps = {export default function WeeklyBarChartToggle({charts,}: WeeklyBarChartToggleProps) {- const [activeIndex, setActiveIndex] = useState(0);+ const [activeIndex, selectTab] = usePersistedTabIndex(+ APP_CONSTANTS.DASHBOARD_WEEKLY_CHART_STORAGE_KEY,+ charts.map((chart) => chart.label),+ );const [isSmallScreen, setIsSmallScreen] = useState(false);const current = charts[activeIndex];- const selectTab = (index: number) => {- setActiveIndex(index);- saveToLocalStorage(- APP_CONSTANTS.DASHBOARD_WEEKLY_CHART_STORAGE_KEY,- charts[index].label,- );- };-- useEffect(() => {- const savedLabel = getFromLocalStorage(- APP_CONSTANTS.DASHBOARD_WEEKLY_CHART_STORAGE_KEY,- null,- );- const savedIndex = charts.findIndex((chart) => chart.label === savedLabel);- if (savedIndex !== -1) setActiveIndex(savedIndex);- // Restore the saved tab once on mount only.- // eslint-disable-next-line react-hooks/exhaustive-deps- }, []);-useEffect(() => {const mq = window.matchMedia("(max-width: 640px)");setIsSmallScreen(mq.matches);diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsxindex ac6c628..7295acc 100644--- a/src/components/myjobs/AddJob.tsx+++ b/src/components/myjobs/AddJob.tsx@@ -2,6 +2,7 @@import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogOverlay,DialogTitle,@@ -197,6 +198,9 @@ export function AddJob({}const pageTitle = editJob ? "Edit Job" : "Add Job";+ const pageDescription = editJob+ ? "Update the details of this job application."+ : "Track a new job application.";const addJobForm = () => {reset(newJobDefaultValues);@@ -244,6 +248,7 @@ export function AddJob({<DialogTitle data-testid="add-job-dialog-title">{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><form@@ -429,7 +434,7 @@ export function AddJob({<FormItem className="flex flex-row"><Switchid="applied-switch"- checked={field.value}+ checked={field.value ?? false}onCheckedChange={(a) => {field.onChange(a);jobAppliedChange(a);diff --git a/src/components/myjobs/NoteDialog.tsx b/src/components/myjobs/NoteDialog.tsxindex 63979c0..ae180d3 100644--- a/src/components/myjobs/NoteDialog.tsx+++ b/src/components/myjobs/NoteDialog.tsx@@ -2,6 +2,7 @@import {Dialog,DialogContent,+ DialogDescription,DialogFooter,DialogHeader,DialogTitle,@@ -87,6 +88,11 @@ export function NoteDialog({<DialogContent className="sm:max-w-[600px] max-h-[80vh] overflow-y-auto"><DialogHeader><DialogTitle>{editNote ? "Edit Note" : "Add Note"}</DialogTitle>+ <DialogDescription>+ {editNote+ ? "Update this note on the job application."+ : "Add a note to this job application."}+ </DialogDescription></DialogHeader><Form {...form}><form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">diff --git a/src/components/profile/AddCertification.tsx b/src/components/profile/AddCertification.tsxindex 89e7818..2072b5c 100644--- a/src/components/profile/AddCertification.tsx+++ b/src/components/profile/AddCertification.tsx@@ -7,6 +7,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,} from "../ui/dialog";@@ -47,6 +48,9 @@ function AddCertification({const pageTitle = certificationToEdit? "Edit Certification / License": "Add Certification / License";+ const pageDescription = certificationToEdit+ ? "Update this certification or license on your resume."+ : "Add a certification or license to your resume.";const [isPending, startTransition] = useTransition();const form = useForm<z.infer<typeof AddCertificationFormSchema>>({@@ -127,6 +131,7 @@ function AddCertification({<DialogContent className="h-full md:h-[85%] lg:max-h-screen md:max-w-[40rem] overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/AddContactInfo.tsx b/src/components/profile/AddContactInfo.tsxindex 8520b39..ad9aefb 100644--- a/src/components/profile/AddContactInfo.tsx+++ b/src/components/profile/AddContactInfo.tsx@@ -4,6 +4,7 @@ import { Button } from "../ui/button";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,} from "../ui/dialog";@@ -45,6 +46,9 @@ function AddContactInfo({const pageTitle = contactInfoToEdit? "Edit Contact Info": "Add Contact Info";+ const pageDescription = contactInfoToEdit+ ? "Update your contact information on your resume."+ : "Add your contact information to your resume.";const form = useForm<z.infer<typeof AddContactInfoFormSchema>>({resolver: zodResolver(AddContactInfoFormSchema),@@ -121,6 +125,7 @@ function AddContactInfo({<DialogContent className="lg:max-h-screen overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/AddEducation.tsx b/src/components/profile/AddEducation.tsxindex 27680f7..3d7c3d9 100644--- a/src/components/profile/AddEducation.tsx+++ b/src/components/profile/AddEducation.tsx@@ -7,6 +7,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,} from "../ui/dialog";@@ -46,6 +47,9 @@ function AddEducation({educationToEdit,}: AddEducationProps) {const pageTitle = educationToEdit ? "Edit Education" : "Add Education";+ const pageDescription = educationToEdit+ ? "Update this education entry on your resume."+ : "Add an education entry to your resume.";const [isPending, startTransition] = useTransition();const [locations, setLocations] = useState<JobLocation[]>([]);@@ -149,6 +153,7 @@ function AddEducation({<DialogContent className="h-full md:h-[85%] lg:max-h-screen md:max-w-[40rem] overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/AddExperience.tsx b/src/components/profile/AddExperience.tsxindex f578a3a..fb55043 100644--- a/src/components/profile/AddExperience.tsx+++ b/src/components/profile/AddExperience.tsx@@ -8,6 +8,7 @@ import { z } from "zod";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,} from "../ui/dialog";@@ -51,6 +52,9 @@ function AddExperience({const [locations, setLocations] = useState<JobLocation[]>([]);const [jobTitles, setJobTitles] = useState<JobTitle[]>([]);const pageTitle = experienceToEdit ? "Edit Experience" : "Add Experience";+ const pageDescription = experienceToEdit+ ? "Update this work experience on your resume."+ : "Add a work experience to your resume.";const [isPending, startTransition] = useTransition();const getTitleCompanyAndLocationData = useCallback(async () => {const [_companies, _titles, _locations] = await Promise.all([@@ -148,6 +152,7 @@ function AddExperience({<DialogContent className="h-full md:h-[85%] lg:max-h-screen md:max-w-[40rem] overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><form@@ -254,7 +259,7 @@ function AddExperience({render={({ field }) => (<FormItem className="flex flex-row"><Switch- checked={field.value}+ checked={field.value ?? false}onCheckedChange={(c) => {field.onChange(c);onCurrentJob(c);diff --git a/src/components/profile/AddResumeSummary.tsx b/src/components/profile/AddResumeSummary.tsxindex 9be57b8..6bf79fd 100644--- a/src/components/profile/AddResumeSummary.tsx+++ b/src/components/profile/AddResumeSummary.tsx@@ -2,6 +2,7 @@ import { useForm } from "react-hook-form";import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogTitle,} from "../ui/dialog";@@ -43,6 +44,9 @@ function AddResumeSummary({const [isPending, startTransition] = useTransition();const pageTitle = summaryToEdit ? "Edit Summary" : "Add Summary";+ const pageDescription = summaryToEdit+ ? "Update the professional summary on your resume."+ : "Add a professional summary to your resume.";const form = useForm<z.infer<typeof AddSummarySectionFormSchema>>({resolver: zodResolver(AddSummarySectionFormSchema),@@ -101,6 +105,7 @@ function AddResumeSummary({<DialogContent className="lg:max-h-screen overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/AddSkills.tsx b/src/components/profile/AddSkills.tsxindex a5d2cc6..935663b 100644--- a/src/components/profile/AddSkills.tsx+++ b/src/components/profile/AddSkills.tsx@@ -7,6 +7,7 @@ import { PlusCircle, X } from "lucide-react";import {Dialog,DialogContent,+ DialogDescription,DialogFooter,DialogHeader,DialogTitle,@@ -145,10 +146,10 @@ function AddSkills({<DialogContent className="max-h-[85vh] md:max-w-[40rem] overflow-y-auto"><DialogHeader><DialogTitle>{isEditing ? "Edit Skills" : "Add Skills"}</DialogTitle>- <p className="text-sm text-muted-foreground">+ <DialogDescription>Group your skills into categories. Leave a name blank to list skillswithout a heading.- </p>+ </DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/CreateCoverLetter.tsx b/src/components/profile/CreateCoverLetter.tsxindex 7928f8d..9881c48 100644--- a/src/components/profile/CreateCoverLetter.tsx+++ b/src/components/profile/CreateCoverLetter.tsx@@ -9,6 +9,7 @@ import { useEffect, useTransition } from "react";import {Dialog,DialogContent,+ DialogDescription,DialogFooter,DialogHeader,DialogTitle,@@ -48,6 +49,9 @@ function CreateCoverLetter({const pageTitle = coverLetterToEdit? "Edit Cover Letter": "Create Cover Letter";+ const pageDescription = coverLetterToEdit+ ? "Update this cover letter."+ : "Create a new cover letter for your profile.";const form = useForm<z.infer<typeof CoverLetterFormSchema>>({resolver: zodResolver(CoverLetterFormSchema),@@ -104,6 +108,7 @@ function CreateCoverLetter({<DialogContent className="lg:max-w-screen-md lg:max-h-screen overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/profile/CreateResume.tsx b/src/components/profile/CreateResume.tsxindex 10a4e0d..525231f 100644--- a/src/components/profile/CreateResume.tsx+++ b/src/components/profile/CreateResume.tsx@@ -9,6 +9,7 @@ import { useEffect, useState, useTransition } from "react";import {Dialog,DialogContent,+ DialogDescription,DialogFooter,DialogHeader,DialogTitle,@@ -59,6 +60,9 @@ function CreateResume({const router = useRouter();const pageTitle = resumeToEdit ? "Edit Resume Title" : "Create Resume";+ const pageDescription = resumeToEdit+ ? "Update the title of this resume."+ : "Create a new resume for your profile.";const form = useForm<z.infer<typeof CreateResumeFormSchema>>({resolver: zodResolver(CreateResumeFormSchema),@@ -193,6 +197,7 @@ function CreateResume({<DialogContent className="lg:max-h-screen overflow-y-scroll"><DialogHeader><DialogTitle>{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/questions/QuestionForm.tsx b/src/components/questions/QuestionForm.tsxindex 5b347c4..b5e1c67 100644--- a/src/components/questions/QuestionForm.tsx+++ b/src/components/questions/QuestionForm.tsx@@ -2,6 +2,7 @@import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogOverlay,DialogTitle,@@ -116,6 +117,9 @@ export function QuestionForm({}const pageTitle = editQuestion ? "Edit Question" : "Add Question";+ const pageDescription = editQuestion+ ? "Update this question in your question bank."+ : "Add a question to your question bank.";const closeDialog = () => {reset();@@ -131,6 +135,7 @@ export function QuestionForm({<DialogTitle data-testid="question-form-dialog-title">{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/tasks/TaskForm.tsx b/src/components/tasks/TaskForm.tsxindex acc58eb..31a204c 100644--- a/src/components/tasks/TaskForm.tsx+++ b/src/components/tasks/TaskForm.tsx@@ -2,6 +2,7 @@import {Dialog,DialogContent,+ DialogDescription,DialogHeader,DialogOverlay,DialogTitle,@@ -131,6 +132,9 @@ export function TaskForm({);const pageTitle = editTask ? "Edit Task" : "Add Task";+ const pageDescription = editTask+ ? "Update the details of this task."+ : "Add a new task to track.";const closeDialog = () => {reset();@@ -146,6 +150,7 @@ export function TaskForm({<DialogTitle data-testid="task-form-dialog-title">{pageTitle}</DialogTitle>+ <DialogDescription>{pageDescription}</DialogDescription></DialogHeader><Form {...form}><formdiff --git a/src/components/tasks/TasksContainer.tsx b/src/components/tasks/TasksContainer.tsxindex 02157c6..d7dc38d 100644--- a/src/components/tasks/TasksContainer.tsx+++ b/src/components/tasks/TasksContainer.tsx@@ -18,7 +18,7 @@ import {updateTaskStatus,startActivityFromTask,} from "@/actions/task.actions";-import { toast } from "../ui/use-toast";+import { toastActionResult, toastError } from "@/lib/toast";import { Task, TaskStatus, TASK_STATUSES } from "@/models/task.model";import {Select,@@ -112,11 +112,7 @@ function TasksContainer({setTotalTasks(total);setPage(pageNum);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}setInitialLoading(false);setLoadingMore(false);@@ -130,30 +126,17 @@ function TasksContainer({}, [loadTasks, filterKey, statusFilter, searchTerm, onTasksChanged]);const onDeleteTask = async (taskId: string) => {- const { success, message } = await deleteTaskById(taskId);- if (success) {- toast({- variant: "success",- description: "Task has been deleted successfully",- });- reloadTasks();- } else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });- }+ const result = await deleteTaskById(taskId);+ toastActionResult(result, {+ success: "Task has been deleted successfully",+ onSuccess: () => reloadTasks(),+ });};const onEditTask = async (taskId: string) => {const { data, success, message } = await getTaskById(taskId);if (!success) {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);return;}setEditTask(data);@@ -171,39 +154,22 @@ function TasksContainer({prev.map((task) => (task.id === taskId ? { ...task, status } : task)),);- const { success, message } = await updateTaskStatus(taskId, status);- if (success) {- toast({- variant: "success",- description: "Task status updated successfully",- });+ const result = await updateTaskStatus(taskId, status);+ if (result.success) {onTasksChanged?.();} else {setTasks(originalTasks);- toast({- variant: "destructive",- title: "Error!",- description: message,- });}+ toastActionResult(result, { success: "Task status updated successfully" });};const onStartActivity = (taskId: string) => {requestStart(async () => {- const { success, message } = await startActivityFromTask(taskId);- if (success) {- await refreshCurrentActivity();- toast({- variant: "success",- description: "Activity started from task",- });- } else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });- }+ const result = await startActivityFromTask(taskId);+ toastActionResult(result, {+ success: "Activity started from task",+ onSuccess: () => refreshCurrentActivity(),+ });});};diff --git a/src/hooks/usePersistedTabIndex.ts b/src/hooks/usePersistedTabIndex.tsnew file mode 100644index 0000000..69488d8--- /dev/null+++ b/src/hooks/usePersistedTabIndex.ts@@ -0,0 +1,29 @@+import { useEffect, useState } from "react";+import {+ getFromLocalStorage,+ saveToLocalStorage,+} from "@/utils/localstorage.utils";++// Persists the active tab by label (not index) so a reordered `labels` array+// still restores the right tab, and restores it once on mount.+export function usePersistedTabIndex(+ storageKey: string,+ labels: readonly string[],+) {+ const [activeIndex, setActiveIndex] = useState(0);++ const selectTab = (index: number) => {+ setActiveIndex(index);+ saveToLocalStorage(storageKey, labels[index]);+ };++ useEffect(() => {+ const savedLabel = getFromLocalStorage(storageKey, null);+ const savedIndex = labels.indexOf(savedLabel);+ if (savedIndex !== -1) setActiveIndex(savedIndex);+ // Restore the saved tab once on mount only.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);++ return [activeIndex, selectTab] as const;+}diff --git a/src/lib/jobs/jobDedupe.ts b/src/lib/jobs/jobDedupe.tsindex 29c9072..a97fe57 100644--- a/src/lib/jobs/jobDedupe.ts+++ b/src/lib/jobs/jobDedupe.ts@@ -1,5 +1,5 @@import prisma from "@/lib/db";-import { jobDedupeKey } from "@/lib/scraper/utils";+import { jobDedupeKey, normalizeJobUrl } from "@/lib/scraper/utils";export interface ExistingJobRef {id: string;@@ -48,19 +48,39 @@ export async function getExistingJobDedupeMap(// (which the batch automation runner needs, since it must also dedupe// URL-less jobs by title/company/location), a single add only ever checks// one URL, so this skips the Location join and jobs that have no URL at all.+const existingJobByUrlSelect = {+ id: true,+ jobUrl: true,+ JobTitle: { select: { label: true } },+ Company: { select: { label: true } },+} as const;+export async function findExistingJobByUrl(userId: string,jobUrl: string,): Promise<ExistingJobRef | null> {+ // Fast path: jobUrl is stored normalized (normalizeJobUrl), so an exact+ // match on the same normalization covers the overwhelming majority of+ // adds without scanning every URL-bearing job.+ const exact = await prisma.job.findFirst({+ where: { userId, jobUrl: normalizeJobUrl(jobUrl) },+ select: existingJobByUrlSelect,+ });+ if (exact) {+ return {+ id: exact.id,+ title: exact.JobTitle.label,+ company: exact.Company.label,+ };+ }++ // Fallback: urlDedupeKey folds host case/www, which normalizeJobUrl+ // deliberately doesn't, so a small number of stored URLs may only match+ // via the aggressive canonical key. Scan only when the fast path misses.const key = jobDedupeKey({ url: jobUrl });const jobs = await prisma.job.findMany({where: { userId, jobUrl: { not: null } },- select: {- id: true,- jobUrl: true,- JobTitle: { select: { label: true } },- Company: { select: { label: true } },- },+ select: existingJobByUrlSelect,});for (const job of jobs) {if (jobDedupeKey({ url: job.jobUrl }) === key) {