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
refactor: migrate toast system from Radix to Sonner
Khuram Niaza37c3439ff3d
diff --git a/__tests__/ActivityContext.spec.tsx b/__tests__/ActivityContext.spec.tsxindex e7b792c..35c43d3 100644--- a/__tests__/ActivityContext.spec.tsx+++ b/__tests__/ActivityContext.spec.tsx@@ -10,7 +10,7 @@ import {startActivityById,stopActivityById,} from "@/actions/activity.actions";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { APP_CONSTANTS } from "@/lib/constants";vi.mock("@/actions/activity.actions", () => ({@@ -20,8 +20,9 @@ vi.mock("@/actions/activity.actions", () => ({deleteActivityById: vi.fn(),}));-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastSuccess: vi.fn(),+ toastError: vi.fn(),}));function TestHarness() {@@ -75,13 +76,10 @@ describe("ActivityContext stopActivity duration guard", () => {expect(deleteActivityById).toHaveBeenCalledWith("act-short");});expect(stopActivityById).not.toHaveBeenCalled();- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- description: expect.stringContaining(- `less than ${APP_CONSTANTS.ACTIVITY_MIN_DURATION_MINUTES} minutes`- ),- })+ expect(toastError).toHaveBeenCalledWith(+ expect.stringContaining(+ `less than ${APP_CONSTANTS.ACTIVITY_MIN_DURATION_MINUTES} minutes`+ ));await waitFor(() =>expect(screen.getByTestId("current")).toHaveTextContent("none")@@ -105,9 +103,7 @@ describe("ActivityContext stopActivity duration guard", () => {);});expect(deleteActivityById).not.toHaveBeenCalled();- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({ variant: "success" })- );+ expect(toastSuccess).toHaveBeenCalledWith("Activity stopped successfully");await waitFor(() =>expect(screen.getByTestId("current")).toHaveTextContent("none"));@@ -132,13 +128,7 @@ describe("ActivityContext stopActivity duration guard", () => {await user.click(screen.getByText("Stop"));await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error!",- description: "Failed to delete activity.",- })- );+ expect(toastError).toHaveBeenCalledWith("Failed to delete activity.");});expect(stopActivityById).not.toHaveBeenCalled();expect(screen.getByTestId("current")).toHaveTextContent("act-fail");diff --git a/__tests__/AddContactInfo.spec.tsx b/__tests__/AddContactInfo.spec.tsxindex c9af6a2..b87c971 100644--- a/__tests__/AddContactInfo.spec.tsx+++ b/__tests__/AddContactInfo.spec.tsx@@ -2,14 +2,18 @@ import { render, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";import AddContactInfo from "@/components/profile/AddContactInfo";import { addContactInfo, updateContactInfo } from "@/actions/profile.actions";-import { toast } from "@/components/ui/use-toast";+import { toastActionResult } from "@/lib/toast";vi.mock("@/actions/profile.actions", () => ({addContactInfo: vi.fn(),updateContactInfo: vi.fn(),}));-vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));+vi.mock("@/lib/toast", () => ({+ toastActionResult: vi.fn((result, opts) => {+ if (result?.success) opts.onSuccess?.(result.data);+ }),+}));const contactInfoToEdit = {id: "contact-1",@@ -246,11 +250,9 @@ describe("AddContactInfo Component", () => {await waitFor(() => {expect(mockSetDialogOpen).toHaveBeenCalledWith(false);});- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: expect.stringContaining("created"),- }),+ expect(toastActionResult).toHaveBeenCalledWith(+ expect.anything(),+ expect.objectContaining({ success: "Contact Info has been created successfully" }),);});@@ -264,11 +266,9 @@ describe("AddContactInfo Component", () => {await user.click(screen.getByRole("button", { name: /save/i }));await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: expect.stringContaining("updated"),- }),+ expect(toastActionResult).toHaveBeenCalledWith(+ expect.anything(),+ expect.objectContaining({ success: "Contact Info has been updated successfully" }),);});});@@ -284,12 +284,9 @@ describe("AddContactInfo Component", () => {await user.click(screen.getByRole("button", { name: /save/i }));await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error",- description: "Failed to create contact info.",- }),+ expect(toastActionResult).toHaveBeenCalledWith(+ expect.objectContaining({ success: false, message: "Failed to create contact info." }),+ expect.objectContaining({ success: "Contact Info has been created successfully" }),);});expect(mockSetDialogOpen).not.toHaveBeenCalledWith(false);diff --git a/__tests__/AddEducation.spec.tsx b/__tests__/AddEducation.spec.tsxindex c43a48e..c683112 100644--- a/__tests__/AddEducation.spec.tsx+++ b/__tests__/AddEducation.spec.tsx@@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event";import AddEducation from "@/components/profile/AddEducation";import { addEducation, updateEducation } from "@/actions/profile.actions";import { getAllJobLocations } from "@/actions/jobLocation.actions";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";// Mock the actionsvi.mock("@/actions/profile.actions", () => ({@@ -16,8 +16,9 @@ vi.mock("@/actions/jobLocation.actions", () => ({}));// Mock toast-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastSuccess: vi.fn(),+ toastError: vi.fn(),}));// Mock Combobox component@@ -480,11 +481,8 @@ describe("AddEducation Component", () => {await waitFor(() => {expect(mockSetDialogOpen).toHaveBeenCalledWith(false);- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: expect.stringContaining("added"),- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Education has been added successfully");});});@@ -546,13 +544,7 @@ describe("AddEducation Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error!",- description: "Failed to add education",- })- );+ expect(toastError).toHaveBeenCalledWith("Failed to add education");expect(mockSetDialogOpen).not.toHaveBeenCalledWith(false);});});@@ -618,11 +610,8 @@ describe("AddEducation Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: expect.stringContaining("updated"),- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Education has been updated successfully");});});diff --git a/__tests__/AddExperience.spec.tsx b/__tests__/AddExperience.spec.tsxindex 7ae538e..4cfc51f 100644--- a/__tests__/AddExperience.spec.tsx+++ b/__tests__/AddExperience.spec.tsx@@ -6,7 +6,7 @@ import { getAllJobLocations } from "@/actions/jobLocation.actions";import { screen, render, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { ResumeSection } from "@/models/profile.model";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";vi.mock("@/actions/profile.actions", () => ({addExperience: vi.fn(),@@ -79,8 +79,9 @@ vi.mock("@/components/DatePicker", () => ({}));// Mock toast-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastSuccess: vi.fn(),+ toastError: vi.fn(),}));describe("AddExperience Component", () => {@@ -543,11 +544,8 @@ describe("AddExperience Component", () => {await waitFor(() => {expect(mockSetDialogOpen).toHaveBeenCalledWith(false);- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: "Experience has been added successfully",- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Experience has been added successfully");});});@@ -606,13 +604,7 @@ describe("AddExperience Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error!",- description: "Failed to add experience",- })- );+ expect(toastError).toHaveBeenCalledWith("Failed to add experience");expect(mockSetDialogOpen).not.toHaveBeenCalledWith(false);});});@@ -676,11 +668,8 @@ describe("AddExperience Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: "Experience has been updated successfully",- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Experience has been updated successfully");});});diff --git a/__tests__/AddJob.spec.tsx b/__tests__/AddJob.spec.tsxindex 61b6b21..537d658 100644--- a/__tests__/AddJob.spec.tsx+++ b/__tests__/AddJob.spec.tsx@@ -7,7 +7,7 @@ import { getCurrentUser } from "@/utils/user.utils";import userEvent from "@testing-library/user-event";import { format } from "date-fns";import { addJob, updateJob } from "@/actions/job.actions";-import { toast } from "@/components/ui/use-toast";+import { toastActionResult } from "@/lib/toast";import type { JobResponse } from "@/models/job.model";vi.mock("@/utils/user.utils", () => ({getCurrentUser: vi.fn(),@@ -25,8 +25,10 @@ vi.mock("@/actions/note.actions", () => ({deleteNote: vi.fn(),}));-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastActionResult: vi.fn((result, opts) => {+ if (result?.success) opts.onSuccess?.(result.data);+ }),}));vi.mock("next/navigation", () => ({@@ -443,12 +445,9 @@ describe("AddJob Component - Error Handling", () => {await user.click(screen.getByTestId("save-job-btn"));await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error",- description: "Failed to save job",- }),+ expect(toastActionResult).toHaveBeenCalledWith(+ expect.objectContaining({ success: false, message: "Failed to save job" }),+ expect.objectContaining({ success: "Job has been created successfully" }),);});}, 10000);diff --git a/__tests__/AddResumeSummary.spec.tsx b/__tests__/AddResumeSummary.spec.tsxindex b83b359..4805815 100644--- a/__tests__/AddResumeSummary.spec.tsx+++ b/__tests__/AddResumeSummary.spec.tsx@@ -6,7 +6,7 @@ import {import { screen, render, waitFor, fireEvent } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { ResumeSection } from "@/models/profile.model";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";vi.mock("@/actions/profile.actions", () => ({addResumeSummary: vi.fn(),@@ -28,8 +28,9 @@ vi.mock("@/components/TiptapEditor", () => ({}));// Mock toast-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastSuccess: vi.fn(),+ toastError: vi.fn(),}));describe("AddResumeSummary Component", () => {@@ -261,11 +262,8 @@ describe("AddResumeSummary Component", () => {await waitFor(() => {expect(mockSetDialogOpen).toHaveBeenCalledWith(false);- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: "Summary has been created successfully",- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Summary has been created successfully");});});@@ -300,13 +298,7 @@ describe("AddResumeSummary Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error!",- description: "Failed to create summary",- })- );+ expect(toastError).toHaveBeenCalledWith("Failed to create summary");expect(mockSetDialogOpen).not.toHaveBeenCalledWith(false);});});@@ -386,11 +378,8 @@ describe("AddResumeSummary Component", () => {await user.click(saveButton);await waitFor(() => {- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: "Summary has been updated successfully",- })+ expect(toastSuccess).toHaveBeenCalledWith(+ "Summary has been updated successfully");});});diff --git a/__tests__/AiJobMatchSection.spec.tsx b/__tests__/AiJobMatchSection.spec.tsxindex 949e92b..dc297fa 100644--- a/__tests__/AiJobMatchSection.spec.tsx+++ b/__tests__/AiJobMatchSection.spec.tsx@@ -31,9 +31,11 @@ vi.mock("@/utils/ai.utils", () => ({checkOllamaConnection: vi.fn().mockResolvedValue({ isConnected: true }),}));-const mockToast = vi.fn();-vi.mock("@/components/ui/use-toast", () => ({- toast: (...args: any[]) => mockToast(...args),+const mockToastSuccess = vi.fn();+const mockToastError = vi.fn();+vi.mock("@/lib/toast", () => ({+ toastSuccess: (...args: any[]) => mockToastSuccess(...args),+ toastError: (...args: any[]) => mockToastError(...args),}));vi.mock("@/components/profile/AiJobMatchResponseContent", () => ({@@ -150,7 +152,7 @@ describe("AiJobMatchSection – auto-save", () => {render(<AiJobMatchSection {...defaultProps} />);await waitFor(() => {- expect(mockToast).toHaveBeenCalledWith({ title: "Match result saved" });+ expect(mockToastSuccess).toHaveBeenCalledWith("Match result saved");});});@@ -208,11 +210,7 @@ describe("AiJobMatchSection – auto-save", () => {render(<AiJobMatchSection {...defaultProps} />);await waitFor(() => {- expect(mockToast).toHaveBeenCalledWith({- variant: "destructive",- title: "Error!",- description: "DB error",- });+ expect(mockToastError).toHaveBeenCalledWith("DB error");});expect(defaultProps.onMatchSaved).not.toHaveBeenCalled();diff --git a/__tests__/AiResumeReviewSection.spec.tsx b/__tests__/AiResumeReviewSection.spec.tsxindex 0f99a83..5f478c9 100644--- a/__tests__/AiResumeReviewSection.spec.tsx+++ b/__tests__/AiResumeReviewSection.spec.tsx@@ -10,6 +10,7 @@ import {import AiResumeReviewSection from "@/components/profile/AiResumeReviewSection";import { Resume, SectionType } from "@/models/profile.model";import type { ResumeReviewResult } from "@/utils/streamResumeReview.utils";+import { buildInsufficientSectionsMessage } from "@/lib/resumeSections";const mockStreamResumeReview = vi.fn();vi.mock("@/utils/streamResumeReview.utils", () => ({@@ -33,9 +34,11 @@ vi.mock("@/utils/ai.utils", () => ({checkOllamaConnection: vi.fn().mockResolvedValue({ isConnected: true }),}));-const mockToast = vi.fn();-vi.mock("@/components/ui/use-toast", () => ({- toast: (...args: any[]) => mockToast(...args),+const mockToastSuccess = vi.fn();+const mockToastError = vi.fn();+vi.mock("@/lib/toast", () => ({+ toastSuccess: (...args: any[]) => mockToastSuccess(...args),+ toastError: (...args: any[]) => mockToastError(...args),}));vi.mock("@/components/profile/AiResumeReviewResponseContent", () => ({@@ -143,11 +146,12 @@ describe("AiResumeReviewSection – Generate AI Review button", () => {it("shows toast error when resume has fewer than 2 sections", () => {render(<AiResumeReviewSection resume={makeResume(1)} />);fireEvent.click(getGenerateButton());- expect(mockToast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Not enough content",- }),+ expect(mockToastError).toHaveBeenCalledWith(+ buildInsufficientSectionsMessage(+ "running a review",+ "e.g. Summary and Experience",+ ),+ "Not enough content",);expect(mockStreamResumeReview).not.toHaveBeenCalled();});@@ -260,7 +264,7 @@ describe("AiResumeReviewSection – auto-save", () => {fireEvent.click(getGenerateButton());await waitFor(() => {- expect(mockToast).toHaveBeenCalledWith({ title: "Review saved" });+ expect(mockToastSuccess).toHaveBeenCalledWith("Review saved");});});@@ -337,11 +341,7 @@ describe("AiResumeReviewSection – auto-save", () => {fireEvent.click(getGenerateButton());await waitFor(() => {- expect(mockToast).toHaveBeenCalledWith({- variant: "destructive",- title: "Error!",- description: "DB error",- });+ expect(mockToastError).toHaveBeenCalledWith("DB error");});expect(onReviewSaved).not.toHaveBeenCalled();diff --git a/__tests__/ComboBox.spec.tsx b/__tests__/ComboBox.spec.tsxindex 3a3d347..ba30f9a 100644--- a/__tests__/ComboBox.spec.tsx+++ b/__tests__/ComboBox.spec.tsx@@ -5,7 +5,7 @@ import { addCompany } from "@/actions/company.actions";import { createLocation, createJobSource } from "@/actions/job.actions";import { createJobTitle } from "@/actions/jobtitle.actions";import { createActivityType } from "@/actions/activity.actions";-import { toast } from "@/components/ui/use-toast";+import { toastError } from "@/lib/toast";import { useForm } from "react-hook-form";import { Form, FormField, FormItem } from "@/components/ui/form";import {@@ -32,8 +32,8 @@ vi.mock("@/actions/activity.actions", () => ({createActivityType: vi.fn(),}));-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastError: vi.fn(),}));// jsdom lacks scrollIntoView, which cmdk calls when selecting an item@@ -321,7 +321,7 @@ describe("Combobox Enter key", () => {await user.type(input, "Toronto{Enter}");- await waitFor(() => expect(toast).toHaveBeenCalled());+ await waitFor(() => expect(toastError).toHaveBeenCalled());expect(onChange).not.toHaveBeenCalled();});@@ -338,7 +338,7 @@ describe("Combobox Enter key", () => {await user.type(input, "Referral{Enter}");- await waitFor(() => expect(toast).toHaveBeenCalled());+ await waitFor(() => expect(toastError).toHaveBeenCalled());expect(onChange).not.toHaveBeenCalled();});});diff --git a/__tests__/CopyResumeDialog.spec.tsx b/__tests__/CopyResumeDialog.spec.tsxindex a7ae7aa..817db55 100644--- a/__tests__/CopyResumeDialog.spec.tsx+++ b/__tests__/CopyResumeDialog.spec.tsx@@ -12,9 +12,11 @@ vi.mock("@/actions/profile.actions", () => ({getResumeCopyTitleSuggestion: vi.fn(),}));-const mockToast = vi.fn();-vi.mock("@/components/ui/use-toast", () => ({- toast: (args: any) => mockToast(args),+const mockToastError = vi.fn();+const mockToastSuccess = vi.fn();+vi.mock("@/lib/toast", () => ({+ toastError: (...args: any[]) => mockToastError(...args),+ toastSuccess: (...args: any[]) => mockToastSuccess(...args),}));const sourceDoc: ProfileDocument = {@@ -88,8 +90,8 @@ describe("CopyResumeDialog", () => {);await waitFor(() => expect(onCopied).toHaveBeenCalled());expect(setOpen).toHaveBeenCalledWith(false);- expect(mockToast).toHaveBeenCalledWith(- expect.objectContaining({ variant: "success" }),+ expect(mockToastSuccess).toHaveBeenCalledWith(+ 'Copy created: "Backend Resume (Copy)"',);});@@ -109,12 +111,7 @@ describe("CopyResumeDialog", () => {await user.click(screen.getByRole("button", { name: /create copy/i }));await waitFor(() =>- expect(mockToast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- description: "Failed to copy resume.",- }),- ),+ expect(mockToastError).toHaveBeenCalledWith("Failed to copy resume."),);expect(onCopied).not.toHaveBeenCalled();});diff --git a/__tests__/TagInput.spec.tsx b/__tests__/TagInput.spec.tsxindex 29fcc13..6179387 100644--- a/__tests__/TagInput.spec.tsx+++ b/__tests__/TagInput.spec.tsx@@ -4,14 +4,14 @@ import { Tag } from "@/models/job.model";import { render, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { createTag } from "@/actions/tag.actions";-import { toast } from "@/components/ui/use-toast";+import { toastError } from "@/lib/toast";vi.mock("@/actions/tag.actions", () => ({createTag: vi.fn(),}));-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("@/lib/toast", () => ({+ toastError: vi.fn(),}));// Required by Radix UI Popover / Command components@@ -280,12 +280,7 @@ describe("TagInput Component", () => {await waitFor(() => {expect(createTag).toHaveBeenCalledWith("GraphQL");- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- description: "Server error",- }),- );+ expect(toastError).toHaveBeenCalledWith("Server error");});});diff --git a/__tests__/resumeSections.utils.spec.ts b/__tests__/resumeSections.utils.spec.tsindex efc3500..29bafa5 100644--- a/__tests__/resumeSections.utils.spec.ts+++ b/__tests__/resumeSections.utils.spec.ts@@ -1,22 +1,19 @@import { warnInsufficientResumeSections } from "@/utils/resumeSections.utils";import { buildInsufficientSectionsMessage } from "@/lib/resumeSections";-const mockToast = vi.fn();-vi.mock("@/components/ui/use-toast", () => ({- toast: (...args: any[]) => mockToast(...args),+const mockToastError = vi.fn();+vi.mock("@/lib/toast", () => ({+ toastError: (...args: any[]) => mockToastError(...args),}));describe("warnInsufficientResumeSections", () => {it("shows a destructive toast with the built message", () => {warnInsufficientResumeSections("setting this resume as default");- expect(mockToast).toHaveBeenCalledWith({- variant: "destructive",- title: "Not enough content",- description: buildInsufficientSectionsMessage(- "setting this resume as default",- ),- });+ expect(mockToastError).toHaveBeenCalledWith(+ buildInsufficientSectionsMessage("setting this resume as default"),+ "Not enough content",+ );});it("forwards the hint through to the built message", () => {@@ -25,13 +22,12 @@ describe("warnInsufficientResumeSections", () => {"e.g. Summary and Experience",);- expect(mockToast).toHaveBeenCalledWith({- variant: "destructive",- title: "Not enough content",- description: buildInsufficientSectionsMessage(+ expect(mockToastError).toHaveBeenCalledWith(+ buildInsufficientSectionsMessage("running a review","e.g. Summary and Experience",),- });+ "Not enough content",+ );});});diff --git a/__tests__/toast.spec.ts b/__tests__/toast.spec.tsindex a95a550..e33957d 100644--- a/__tests__/toast.spec.ts+++ b/__tests__/toast.spec.ts@@ -1,8 +1,8 @@-import { toast } from "@/components/ui/use-toast";+import { toast } from "sonner";import { toastSuccess, toastError, toastActionResult } from "@/lib/toast";-vi.mock("@/components/ui/use-toast", () => ({- toast: vi.fn(),+vi.mock("sonner", () => ({+ toast: { success: vi.fn(), error: vi.fn() },}));beforeEach(() => {@@ -10,49 +10,41 @@ beforeEach(() => {});describe("toastSuccess", () => {- it("toasts a success variant with the given description", () => {+ it("calls toast.success with just the message when no title is given", () => {toastSuccess("Job has been created successfully");- expect(toast).toHaveBeenCalledWith({- variant: "success",- title: undefined,- description: "Job has been created successfully",- });+ expect(toast.success).toHaveBeenCalledWith("Job has been created successfully");});- it("accepts an optional title", () => {- toastSuccess("Saved", "Nice");- expect(toast).toHaveBeenCalledWith({- variant: "success",- title: "Nice",- description: "Saved",+ it("promotes the title to the message and the message to the description", () => {+ toastSuccess("Saved to Downloads.", "PDF exported");+ expect(toast.success).toHaveBeenCalledWith("PDF exported", {+ description: "Saved to Downloads.",});});});describe("toastError", () => {- it("defaults the title to 'Error'", () => {+ it("calls toast.error with just the message when no title is given", () => {toastError("Failed to save job");- expect(toast).toHaveBeenCalledWith({- variant: "destructive",- title: "Error",- description: "Failed to save job",- });+ expect(toast.error).toHaveBeenCalledWith("Failed to save job");});- it("falls back to a generic message when no description is given", () => {- toastError();- expect(toast).toHaveBeenCalledWith({- variant: "destructive",- title: "Error",- description: "Something went wrong. Please try again.",+ it("does not pass an options object when there is no title", () => {+ toastError("Failed to save job");+ expect(toast.error).toHaveBeenCalledTimes(1);+ expect(vi.mocked(toast.error).mock.calls[0]).toHaveLength(1);+ });++ it("promotes the title to the message and the message to the description", () => {+ toastError("Remove it from resumes first.", "Skill is in use!");+ expect(toast.error).toHaveBeenCalledWith("Skill is in use!", {+ description: "Remove it from resumes first.",});});- it("allows overriding the title", () => {- toastError("Nope", "Custom Title");- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({ title: "Custom Title" }),- );+ it("falls back to a generic message when no message is given", () => {+ toastError();+ expect(toast.error).toHaveBeenCalledWith("Something went wrong. Please try again.");});});@@ -64,12 +56,7 @@ describe("toastActionResult", () => {{ success: "Job has been created successfully", onSuccess },);- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "success",- description: "Job has been created successfully",- }),- );+ expect(toast.success).toHaveBeenCalledWith("Job has been created successfully");expect(onSuccess).toHaveBeenCalledWith({ id: "1" });});@@ -80,38 +67,22 @@ describe("toastActionResult", () => {{ success: "Job has been created successfully", onSuccess },);- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error",- description: "Failed to save job",- }),- );+ expect(toast.error).toHaveBeenCalledWith("Failed to save job");expect(onSuccess).not.toHaveBeenCalled();});- it("toasts the fallback error when result is undefined", () => {+ it("toasts the error override when result is undefined", () => {toastActionResult(undefined, {success: "Job has been created successfully",error: "Could not create job",});- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- title: "Error",- description: "Could not create job",- }),- );+ expect(toast.error).toHaveBeenCalledWith("Could not create job");});it("falls back to the generic message when result is undefined and no error override is given", () => {toastActionResult(undefined, { success: "Job has been created successfully" });- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- description: "Something went wrong. Please try again.",- }),- );+ expect(toast.error).toHaveBeenCalledWith("Something went wrong. Please try again.");});});diff --git a/package-lock.json b/package-lock.jsonindex c1b3a6f..534d25d 100644--- a/package-lock.json+++ b/package-lock.json@@ -32,7 +32,6 @@"@radix-ui/react-slot": "^1.2.4","@radix-ui/react-switch": "^1.1.2","@radix-ui/react-tabs": "^1.1.2",- "@radix-ui/react-toast": "^1.2.3","@radix-ui/react-toggle": "^1.1.1","@radix-ui/react-tooltip": "^1.1.5","@react-pdf/renderer": "^4.5.1",@@ -60,6 +59,7 @@"react-day-picker": "^9.12.0","react-dom": "19.2.4","react-hook-form": "^7.54.2",+ "sonner": "^2.0.7","tailwind-merge": "^2.5.5","tailwindcss-animate": "^1.0.7","unpdf": "^1.6.2",@@ -3750,40 +3750,6 @@}}},- "node_modules/@radix-ui/react-toast": {- "version": "1.2.15",- "resolved": "https://registry.npmjs.org/@radix-ui/react-toast/-/react-toast-1.2.15.tgz",- "integrity": "sha512-3OSz3TacUWy4WtOXV38DggwxoqJK4+eDkNMl5Z/MJZaoUPaP4/9lf81xXMe1I2ReTAptverZUpbPY4wWwWyL5g==",- "license": "MIT",- "dependencies": {- "@radix-ui/primitive": "1.1.3",- "@radix-ui/react-collection": "1.1.7",- "@radix-ui/react-compose-refs": "1.1.2",- "@radix-ui/react-context": "1.1.2",- "@radix-ui/react-dismissable-layer": "1.1.11",- "@radix-ui/react-portal": "1.1.9",- "@radix-ui/react-presence": "1.1.5",- "@radix-ui/react-primitive": "2.1.3",- "@radix-ui/react-use-callback-ref": "1.1.1",- "@radix-ui/react-use-controllable-state": "1.2.2",- "@radix-ui/react-use-layout-effect": "1.1.1",- "@radix-ui/react-visually-hidden": "1.2.3"- },- "peerDependencies": {- "@types/react": "*",- "@types/react-dom": "*",- "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",- "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"- },- "peerDependenciesMeta": {- "@types/react": {- "optional": true- },- "@types/react-dom": {- "optional": true- }- }- },"node_modules/@radix-ui/react-toggle": {"version": "1.1.10","resolved": "https://registry.npmjs.org/@radix-ui/react-toggle/-/react-toggle-1.1.10.tgz",@@ -12769,6 +12735,16 @@"dev": true,"license": "ISC"},+ "node_modules/sonner": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",+ "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",+ "license": "MIT",+ "peerDependencies": {+ "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",+ "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"+ }+ },"node_modules/source-map-js": {"version": "1.2.1","resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",diff --git a/package.json b/package.jsonindex 30b74a6..b39585f 100644--- a/package.json+++ b/package.json@@ -44,7 +44,6 @@"@radix-ui/react-slot": "^1.2.4","@radix-ui/react-switch": "^1.1.2","@radix-ui/react-tabs": "^1.1.2",- "@radix-ui/react-toast": "^1.2.3","@radix-ui/react-toggle": "^1.1.1","@radix-ui/react-tooltip": "^1.1.5","@react-pdf/renderer": "^4.5.1",@@ -72,6 +71,7 @@"react-day-picker": "^9.12.0","react-dom": "19.2.4","react-hook-form": "^7.54.2",+ "sonner": "^2.0.7","tailwind-merge": "^2.5.5","tailwindcss-animate": "^1.0.7","unpdf": "^1.6.2",diff --git a/src/app/dashboard/automations/[id]/page.tsx b/src/app/dashboard/automations/[id]/page.tsxindex 5f67b71..957c891 100644--- a/src/app/dashboard/automations/[id]/page.tsx+++ b/src/app/dashboard/automations/[id]/page.tsx@@ -25,7 +25,7 @@ import {AlertDialogTitle,} from "@/components/ui/alert-dialog";import { buttonVariants } from "@/components/ui/button";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {ArrowLeft,Pause,@@ -186,11 +186,7 @@ export default function AutomationDetailPage() {setAutomation(automationResult.data);setRuns(automationResult.data.runs || []);} else {- toast({- title: "Error",- description: automationResult.message || "Automation not found",- variant: "destructive",- });+ toastError(automationResult.message || "Automation not found");router.push("/dashboard/automations");return;}@@ -210,11 +206,7 @@ export default function AutomationDetailPage() {}}} catch (error) {- toast({- title: "Error",- description: "Failed to load automation details",- variant: "destructive",- });+ toastError("Failed to load automation details");}if (showLoading) setLoading(false);},@@ -400,19 +392,12 @@ export default function AutomationDetailPage() {setActionLoading(false);if (result.success) {- toast({- title:- automation.status === "active"- ? "Automation paused"- : "Automation resumed",- });+ toastSuccess(+ automation.status === "active" ? "Automation paused" : "Automation resumed",+ );loadData();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};@@ -438,13 +423,14 @@ export default function AutomationDetailPage() {// Run is terminal; drop the live-follow signal so a later LogsTab remount// (e.g. switching tabs) doesn't re-init its badge to "Running".setRunKey(0);- toast({- title:- latest.status === "cancelled"- ? "Run cancelled"- : "Automation run complete",- description: `Saved ${latest.jobsSaved} new jobs`,- });+ if (latest.status === "cancelled") {+ toastError(`Saved ${latest.jobsSaved} new jobs`, "Run cancelled");+ } else {+ toastSuccess(+ `Saved ${latest.jobsSaved} new jobs`,+ "Automation run complete",+ );+ }loadData();};@@ -486,11 +472,7 @@ export default function AutomationDetailPage() {setRunKey(0);setLogData((prev) => ({ ...prev, isRunning: false }));}- toast({- title: "Error",- description: data.message || "Failed to start run",- variant: "destructive",- });+ toastError(data.message || "Failed to start run");}// On success the run is running in the background; the watcher effect// above handles completion.@@ -498,11 +480,7 @@ export default function AutomationDetailPage() {setRunNowLoading(false);setRunKey(0);setLogData((prev) => ({ ...prev, isRunning: false }));- toast({- title: "Error",- description: "Failed to start run",- variant: "destructive",- });+ toastError("Failed to start run");}};@@ -526,14 +504,10 @@ export default function AutomationDetailPage() {setDeleteConfirmOpen(false);if (result.success) {- toast({ title: "Automation deleted" });+ toastSuccess("Automation deleted");router.push("/dashboard/automations");} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsxindex 6f36c9b..726e490 100644--- a/src/app/dashboard/layout.tsx+++ b/src/app/dashboard/layout.tsx@@ -1,7 +1,6 @@import { cookies } from "next/headers";import Header from "@/components/Header";import Sidebar from "@/components/Sidebar";-import { Toaster } from "@/components/ui/toaster";import { ActivityProvider } from "@/context/ActivityContext";import { GlobalActivityBanner } from "@/components/activities/GlobalActivityBanner";import { SidebarProvider } from "@/context/SidebarContext";@@ -28,7 +27,6 @@ export default async function RootLayout({<main className="flex-1 md:block lg:grid items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-4 lg:grid-cols-3 xl:grid-cols-3">{children}</main>- <Toaster /></SidebarInset></div></SidebarProvider>diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex afcccc7..1f7a767 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -3,6 +3,7 @@ import localFont from "next/font/local";import "./globals.css";import { cn } from "@/lib/utils";import { ThemeProvider } from "@/components/theme-provider";+import { Toaster } from "@/components/ui/sonner";export const dynamic = "force-dynamic";@@ -40,6 +41,7 @@ export default function RootLayout({ children }: Readonly<Props>) {disableTransitionOnChange>{children}+ <Toaster /></ThemeProvider></body></html>diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsxindex c3de3b9..825685d 100644--- a/src/components/ComboBox.tsx+++ b/src/components/ComboBox.tsx@@ -25,7 +25,7 @@ import { createLocation } from "@/actions/job.actions";import { JobForm } from "@/models/job.model";import { addCompany } from "@/actions/company.actions";import { createJobTitle } from "@/actions/jobtitle.actions";-import { toast } from "./ui/use-toast";+import { toastError } from "@/lib/toast";import { createActivityType } from "@/actions/activity.actions";import { createJobSource } from "@/actions/job.actions";@@ -74,22 +74,14 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {case "location":const { data, success, message } = await createLocation(label);if (!success) {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}response = data;break;case "source":const sourceRes = await createJobSource(label);if (!sourceRes.success) {- toast({- variant: "destructive",- title: "Error!",- description: sourceRes.message,- });+ toastError(sourceRes.message);}response = sourceRes.data;if (!sourceRes.success) return;diff --git a/src/components/activities/ActivitiesContainer.tsx b/src/components/activities/ActivitiesContainer.tsxindex 41da614..f3741b7 100644--- a/src/components/activities/ActivitiesContainer.tsx+++ b/src/components/activities/ActivitiesContainer.tsx@@ -17,7 +17,7 @@ import {import { ActivityForm } from "./ActivityForm";import { getActivitiesList } from "@/actions/activity.actions";import { Activity } from "@/models/activity.model";-import { toast } from "../ui/use-toast";+import { toastError } from "@/lib/toast";import Loading from "../Loading";import { APP_CONSTANTS } from "@/lib/constants";import { RecordsCount } from "../RecordsCount";@@ -56,18 +56,10 @@ function ActivitiesContainer() {setTotalActivities(total);setPage(page);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}} catch (error) {- toast({- variant: "destructive",- title: "Error!",- description: "Failed to load activities. Please try again.",- });+ toastError("Failed to load activities. Please try again.");} finally {setInitialLoading(false);setLoadingMore(false);diff --git a/src/components/activities/ActivitiesTable.tsx b/src/components/activities/ActivitiesTable.tsxindex b938d75..ecbc56b 100644--- a/src/components/activities/ActivitiesTable.tsx+++ b/src/components/activities/ActivitiesTable.tsx@@ -20,7 +20,7 @@ import { Button } from "../ui/button";import { format } from "date-fns";import { Activity, ActivityType } from "@/models/activity.model";import { deleteActivityById } from "@/actions/activity.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { useMemo, useState } from "react";import { DeleteAlertDialog } from "../DeleteAlertDialog";@@ -54,17 +54,10 @@ function ActivitiesTable({const deleteActivity = async () => {const { success, message } = await deleteActivityById(activityIdToDelete!);if (success) {- toast({- variant: "success",- description: `Activity has been deleted successfully`,- });+ toastSuccess(`Activity has been deleted successfully`);reloadActivities();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};return (diff --git a/src/components/admin/ActivityTypesTable.tsx b/src/components/admin/ActivityTypesTable.tsxindex 63800a3..41a1e22 100644--- a/src/components/admin/ActivityTypesTable.tsx+++ b/src/components/admin/ActivityTypesTable.tsx@@ -18,7 +18,7 @@ import {import { MoreVertical, Trash } from "lucide-react";import { useState } from "react";import { deleteActivityTypeById } from "@/actions/activity.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { AlertDialog } from "@/models/alertDialog.model";@@ -75,17 +75,10 @@ function ActivityTypesTable({if (!id) return;const { success, message } = await deleteActivityTypeById(id);if (success) {- toast({- variant: "success",- description: "Activity type has been deleted successfully",- });+ toastSuccess("Activity type has been deleted successfully");reloadActivityTypes();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};diff --git a/src/components/admin/AddActivityType.tsx b/src/components/admin/AddActivityType.tsxindex 58aa6f1..eb30f59 100644--- a/src/components/admin/AddActivityType.tsx+++ b/src/components/admin/AddActivityType.tsx@@ -22,7 +22,7 @@ import {FormMessage,} from "../ui/form";import { Input } from "../ui/input";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { createActivityType } from "@/actions/activity.actions";const AddActivityTypeFormSchema = z.object({@@ -58,19 +58,12 @@ function AddActivityType({ reloadActivityTypes }: AddActivityTypeProps) {startTransition(async () => {try {await createActivityType(values.label);- toast({- variant: "success",- description: "Activity type has been added successfully.",- });+ toastSuccess("Activity type has been added successfully.");setDialogOpen(false);reset();reloadActivityTypes();} catch {- toast({- variant: "destructive",- title: "Error!",- description: "Failed to create activity type.",- });+ toastError("Failed to create activity type.");}});};diff --git a/src/components/admin/AddTag.tsx b/src/components/admin/AddTag.tsxindex d18a97e..0baee4e 100644--- a/src/components/admin/AddTag.tsx+++ b/src/components/admin/AddTag.tsx@@ -22,7 +22,7 @@ import {FormMessage,} from "../ui/form";import { Input } from "../ui/input";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { createTag } from "@/actions/tag.actions";const AddTagFormSchema = z.object({@@ -56,19 +56,12 @@ function AddTag({ reloadTags }: AddTagProps) {startTransition(async () => {const result = await createTag(values.label);if (result?.success) {- toast({- variant: "success",- description: "Skill tag has been added successfully.",- });+ toastSuccess("Skill tag has been added successfully.");setDialogOpen(false);reset();reloadTags();} else {- toast({- variant: "destructive",- title: "Error!",- description: result?.message ?? "Failed to create skill tag.",- });+ toastError(result?.message ?? "Failed to create skill tag.");}});};diff --git a/src/components/admin/CompaniesTable.tsx b/src/components/admin/CompaniesTable.tsxindex 0852886..c8e9c32 100644--- a/src/components/admin/CompaniesTable.tsx+++ b/src/components/admin/CompaniesTable.tsx@@ -20,7 +20,7 @@ import { Briefcase, MoreVertical, Pencil, Trash } from "lucide-react";import { useState } from "react";import Link from "next/link";import { deleteCompanyById } from "@/actions/company.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { AlertDialog } from "@/models/alertDialog.model";@@ -64,17 +64,10 @@ function CompaniesTable({if (companyId) {const { res, success, message } = await deleteCompanyById(companyId);if (success) {- toast({- variant: "success",- description: `Company has been deleted successfully`,- });+ toastSuccess(`Company has been deleted successfully`);reloadCompanies();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}}};diff --git a/src/components/admin/JobLocationsTable.tsx b/src/components/admin/JobLocationsTable.tsxindex 83cf803..cd65e5e 100644--- a/src/components/admin/JobLocationsTable.tsx+++ b/src/components/admin/JobLocationsTable.tsx@@ -22,7 +22,7 @@ import { JobLocation } from "@/models/job.model";import { Briefcase, MoreVertical, Trash } from "lucide-react";import Link from "next/link";import { AlertDialog } from "@/models/alertDialog.model";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { deleteJobLocationById } from "@/actions/jobLocation.actions";type JobLocationsTableProps = {@@ -61,17 +61,10 @@ function JobLocationsTable({if (locationId) {const { success, message } = await deleteJobLocationById(locationId);if (success) {- toast({- variant: "success",- description: `Job location has been deleted successfully`,- });+ toastSuccess(`Job location has been deleted successfully`);reloadJobLocations();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}}};diff --git a/src/components/admin/JobSourcesTable.tsx b/src/components/admin/JobSourcesTable.tsxindex 8694646..9db4143 100644--- a/src/components/admin/JobSourcesTable.tsx+++ b/src/components/admin/JobSourcesTable.tsx@@ -23,7 +23,7 @@ import Link from "next/link";import { AlertDialog } from "@/models/alertDialog.model";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { deleteJobSourceById } from "@/actions/jobSource.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";type JobSourcesTableProps = {jobSources: JobSource[];@@ -63,17 +63,10 @@ function JobSourcesTable({if (sourceId) {const { success, message } = await deleteJobSourceById(sourceId);if (success) {- toast({- variant: "success",- description: `Job source has been deleted successfully`,- });+ toastSuccess(`Job source has been deleted successfully`);reloadJobSources();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}}};diff --git a/src/components/admin/JobTitlesTable.tsx b/src/components/admin/JobTitlesTable.tsxindex de68bb9..8630fbe 100644--- a/src/components/admin/JobTitlesTable.tsx+++ b/src/components/admin/JobTitlesTable.tsx@@ -23,7 +23,7 @@ import Link from "next/link";import { AlertDialog } from "@/models/alertDialog.model";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { deleteJobTitleById } from "@/actions/jobtitle.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";type JobTitlesTableProps = {jobTitles: JobTitle[];@@ -59,17 +59,10 @@ function JobTitlesTable({ jobTitles, reloadJobTitles }: JobTitlesTableProps) {if (titleId) {const { success, message } = await deleteJobTitleById(titleId);if (success) {- toast({- variant: "success",- description: `Job title has been deleted successfully`,- });+ toastSuccess(`Job title has been deleted successfully`);reloadJobTitles();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}}};diff --git a/src/components/admin/TagsTable.tsx b/src/components/admin/TagsTable.tsxindex 6e94173..17ae9a4 100644--- a/src/components/admin/TagsTable.tsx+++ b/src/components/admin/TagsTable.tsx@@ -19,7 +19,7 @@ import { Tag } from "@/models/job.model";import { MoreVertical, Trash } from "lucide-react";import { useState } from "react";import { deleteTagById } from "@/actions/tag.actions";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { DeleteAlertDialog } from "../DeleteAlertDialog";import { AlertDialog } from "@/models/alertDialog.model";@@ -67,17 +67,10 @@ function TagsTable({ tags, reloadTags }: TagsTableProps) {if (!tagId) return;const { success, message } = await deleteTagById(tagId);if (success) {- toast({- variant: "success",- description: "Skill tag has been deleted successfully",- });+ toastSuccess("Skill tag has been deleted successfully");reloadTags();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};diff --git a/src/components/automations/AtsSearchStep.tsx b/src/components/automations/AtsSearchStep.tsxindex 8e63a92..b991894 100644--- a/src/components/automations/AtsSearchStep.tsx+++ b/src/components/automations/AtsSearchStep.tsx@@ -39,7 +39,7 @@ import { getAllJobTitles, createJobTitle } from "@/actions/jobtitle.actions";import { getAllTags, createTag } from "@/actions/tag.actions";import { getAllJobLocations } from "@/actions/jobLocation.actions";import { createLocation } from "@/actions/job.actions";-import { toast } from "@/components/ui/use-toast";+import { toastError } from "@/lib/toast";import { APP_CONSTANTS } from "@/lib/constants";import { cn } from "@/lib/utils";import type {@@ -143,11 +143,7 @@ function EntityStringChipInput({startCreate(async () => {const created = await createOption(lbl);if (!created) {- toast({- variant: "destructive",- title: "Error",- description: `Failed to create ${noun}.`,- });+ toastError(`Failed to create ${noun}.`);return;}setOptions((prev) =>diff --git a/src/components/automations/AutomationContainer.tsx b/src/components/automations/AutomationContainer.tsxindex 7c439bd..facbf2d 100644--- a/src/components/automations/AutomationContainer.tsx+++ b/src/components/automations/AutomationContainer.tsx@@ -6,7 +6,7 @@ import { Card, CardContent, CardTitle } from "@/components/ui/card";import { ResponsiveCardHeader } from "@/components/ResponsiveCardHeader";import { Button } from "@/components/ui/button";import { Plus, RefreshCw } from "lucide-react";-import { toast } from "@/components/ui/use-toast";+import { toastError } from "@/lib/toast";import { getAutomationsList } from "@/actions/automation.actions";import type { AutomationWithResume } from "@/models/automation.model";import { AutomationList } from "./AutomationList";@@ -39,11 +39,7 @@ export function AutomationContainer({ resumes }: AutomationContainerProps) {if (result.success && result.data) {setAutomations(result.data);} else {- toast({- title: "Error",- description: result.message || "Failed to load automations",- variant: "destructive",- });+ toastError(result.message || "Failed to load automations");}setLoading(false);}, []);diff --git a/src/components/automations/AutomationList.tsx b/src/components/automations/AutomationList.tsxindex 510a0dc..06f9374 100644--- a/src/components/automations/AutomationList.tsx+++ b/src/components/automations/AutomationList.tsx@@ -22,7 +22,7 @@ import {AlertDialogHeader,AlertDialogTitle,} from "@/components/ui/alert-dialog";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {MoreVertical,Pause,@@ -65,14 +65,10 @@ export function AutomationList({setLoadingAction(null);if (result.success) {- toast({ title: "Automation paused" });+ toastSuccess("Automation paused");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};@@ -82,14 +78,10 @@ export function AutomationList({setLoadingAction(null);if (result.success) {- toast({ title: "Automation resumed" });+ toastSuccess("Automation resumed");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};@@ -102,14 +94,10 @@ export function AutomationList({setDeleteId(null);if (result.success) {- toast({ title: "Automation deleted" });+ toastSuccess("Automation deleted");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};diff --git a/src/components/automations/AutomationWizard.tsx b/src/components/automations/AutomationWizard.tsxindex ddcfa09..d8343cc 100644--- a/src/components/automations/AutomationWizard.tsx+++ b/src/components/automations/AutomationWizard.tsx@@ -39,7 +39,7 @@ import {createAutomation,updateAutomation,} from "@/actions/automation.actions";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import type { AutomationWithResume, JobBoard } from "@/models/automation.model";import { isAtsBoard } from "@/models/automation.model";import { AtsSearchStep, type AtsConfigValue } from "./AtsSearchStep";@@ -150,29 +150,21 @@ export function AutomationWizard({: await createAutomation(data);if (result.success) {- toast({- title: editAutomation ? "Automation updated" : "Automation created",- description: editAutomation+ toastSuccess(+ editAutomation? "Your automation has been updated successfully.": "Your automation has been created and will run at the scheduled time.",- });+ editAutomation ? "Automation updated" : "Automation created",+ );form.reset();setStep(0);onOpenChange(false);onSuccess();} else {- toast({- title: "Error",- description: result.message || "Something went wrong",- variant: "destructive",- });+ toastError(result.message || "Something went wrong");}} catch (error) {- toast({- title: "Error",- description: "Failed to save automation",- variant: "destructive",- });+ toastError("Failed to save automation");} finally {setIsSubmitting(false);}@@ -605,11 +597,7 @@ export function AutomationWizard({onSubmit={form.handleSubmit(onSubmit, (errors) => {const firstError = Object.values(errors)[0];if (firstError?.message) {- toast({- title: "Validation Error",- description: firstError.message as string,- variant: "destructive",- });+ toastError(firstError.message as string, "Validation Error");}})}>diff --git a/src/components/automations/DiscoveredJobDetail.tsx b/src/components/automations/DiscoveredJobDetail.tsxindex 39b6c49..519b709 100644--- a/src/components/automations/DiscoveredJobDetail.tsx+++ b/src/components/automations/DiscoveredJobDetail.tsx@@ -12,7 +12,7 @@ import {import { Button } from "@/components/ui/button";import { Badge } from "@/components/ui/badge";import { ScrollArea } from "@/components/ui/scroll-area";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {Building2,MapPin,@@ -63,18 +63,14 @@ export function DiscoveredJobDetail({try {const result = await analyzeDiscoveredJob(job.id);if (result.success) {- toast({ title: "Match analyzed", description: "AI match score is ready." });+ toastSuccess("AI match score is ready.", "Match analyzed");onOpenChange(false);onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({ title: "Error", description: "Failed to analyze job", variant: "destructive" });+ toastError("Failed to analyze job");} finally {setLoadingAction(null);}@@ -85,18 +81,14 @@ export function DiscoveredJobDetail({try {const result = await acceptDiscoveredJob(job.id);if (result.success) {- toast({ title: "Job accepted", description: "The job has been added to your tracked jobs." });+ toastSuccess("The job has been added to your tracked jobs.", "Job accepted");onOpenChange(false);onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({ title: "Error", description: "Failed to accept job", variant: "destructive" });+ toastError("Failed to accept job");} finally {setLoadingAction(null);}@@ -107,18 +99,14 @@ export function DiscoveredJobDetail({try {const result = await dismissDiscoveredJob(job.id);if (result.success) {- toast({ title: "Job dismissed" });+ toastSuccess("Job dismissed");onOpenChange(false);onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({ title: "Error", description: "Failed to dismiss job", variant: "destructive" });+ toastError("Failed to dismiss job");} finally {setLoadingAction(null);}diff --git a/src/components/automations/DiscoveredJobsList.tsx b/src/components/automations/DiscoveredJobsList.tsxindex 140d967..67d9ac4 100644--- a/src/components/automations/DiscoveredJobsList.tsx+++ b/src/components/automations/DiscoveredJobsList.tsx@@ -17,7 +17,7 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {AlertDialog,AlertDialogAction,@@ -169,24 +169,13 @@ export function DiscoveredJobsList({try {const result = await analyzeDiscoveredJob(jobId);if (result.success) {- toast({- title: "Match analyzed",- description: "AI match score is ready.",- });+ toastSuccess("AI match score is ready.", "Match analyzed");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({- title: "Error",- description: "Failed to analyze job",- variant: "destructive",- });+ toastError("Failed to analyze job");} finally {setLoadingAction(null);}@@ -197,24 +186,13 @@ export function DiscoveredJobsList({try {const result = await acceptDiscoveredJob(job.id);if (result.success) {- toast({- title: "Job accepted",- description: "The job has been added to your tracked jobs.",- });+ toastSuccess("The job has been added to your tracked jobs.", "Job accepted");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({- title: "Error",- description: "Failed to accept job",- variant: "destructive",- });+ toastError("Failed to accept job");} finally {setLoadingAction(null);}@@ -225,21 +203,13 @@ export function DiscoveredJobsList({try {const result = await dismissDiscoveredJob(jobId);if (result.success) {- toast({ title: "Job dismissed" });+ toastSuccess("Job dismissed");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}} catch {- toast({- title: "Error",- description: "Failed to dismiss job",- variant: "destructive",- });+ toastError("Failed to dismiss job");} finally {setLoadingAction(null);}@@ -255,17 +225,10 @@ export function DiscoveredJobsList({setClearOpen(false);if (result.success) {- toast({- title: "Discovered jobs cleared",- description: `Removed ${result.deleted ?? 0} job(s).`,- });+ toastSuccess(`Removed ${result.deleted ?? 0} job(s).`, "Discovered jobs cleared");onRefresh();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};diff --git a/src/components/automations/RunHistoryList.tsx b/src/components/automations/RunHistoryList.tsxindex e278ced..63b23d4 100644--- a/src/components/automations/RunHistoryList.tsx+++ b/src/components/automations/RunHistoryList.tsx@@ -37,7 +37,7 @@ import {import type { AutomationRun, FunnelStage } from "@/models/automation.model";import { DeleteAlertDialog } from "@/components/DeleteAlertDialog";import { deleteAutomationRun } from "@/actions/automation.actions";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";interface RunHistoryListProps {runs: AutomationRun[];@@ -139,14 +139,10 @@ export function RunHistoryList({const result = await deleteAutomationRun(deleteRunId);setDeleteRunId(null);if (result.success) {- toast({ title: "Run deleted" });+ toastSuccess("Run deleted");onDelete?.();} else {- toast({- title: "Error",- description: result.message,- variant: "destructive",- });+ toastError(result.message);}};diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsxindex 6d333d1..a646345 100644--- a/src/components/myjobs/JobDetails.tsx+++ b/src/components/myjobs/JobDetails.tsx@@ -59,7 +59,7 @@ import {import { DeleteAlertDialog } from "../DeleteAlertDialog";import { AddJob } from "./AddJob";import { deleteJobById, updateJobStatus } from "@/actions/job.actions";-import { toast } from "../ui/use-toast";+import { toastError, toastSuccess } from "@/lib/toast";type JobDetailsProps = {job: JobResponse;@@ -139,33 +139,19 @@ function JobDetails({const { success, message } = await updateJobStatus(job.id, status);if (success) {setCurrentStatus(status);- toast({- variant: "success",- description: `Job has been updated successfully`,- });+ toastSuccess(`Job has been updated successfully`);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};const onDeleteJob = async () => {const { success, message } = await deleteJobById(job.id);if (success) {- toast({- variant: "success",- description: `Job has been deleted successfully`,- });+ toastSuccess(`Job has been deleted successfully`);router.push("/dashboard/myjobs");} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};diff --git a/src/components/myjobs/JobsContainer.tsx b/src/components/myjobs/JobsContainer.tsxindex 5d0af04..46527e1 100644--- a/src/components/myjobs/JobsContainer.tsx+++ b/src/components/myjobs/JobsContainer.tsx@@ -16,7 +16,7 @@ import {getJobsList,updateJobStatus,} from "@/actions/job.actions";-import { toast } from "../ui/use-toast";+import { toastError, toastSuccess } from "@/lib/toast";import {Company,JobLocation,@@ -177,11 +177,7 @@ function JobsContainer({setTotalJobs(total);setPage(page);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}setInitialLoading(false);setLoadingMore(false);@@ -206,16 +202,9 @@ function JobsContainer({const onDeleteJob = async (jobId: string) => {const { res, success, message } = await deleteJobById(jobId);if (success) {- toast({- variant: "success",- description: `Job has been deleted successfully`,- });+ toastSuccess(`Job has been deleted successfully`);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}reloadJobs();};@@ -223,11 +212,7 @@ function JobsContainer({const onEditJob = async (jobId: string) => {const { job, success, message } = await getJobDetails(jobId);if (!success) {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);return;}setEditJob(job);@@ -237,16 +222,9 @@ function JobsContainer({const { success, message } = await updateJobStatus(jobId, jobStatus);if (success) {router.refresh();- toast({- variant: "success",- description: `Job has been updated successfully`,- });+ toastSuccess(`Job has been updated successfully`);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}reloadJobs();};@@ -334,17 +312,11 @@ function JobsContainer({document.body.appendChild(link);link.click();document.body.removeChild(link);- toast({- variant: "success",- title: "Downloaded successfully!",- });+ toastSuccess("Downloaded successfully!");} catch (error) {- toast({- variant: "destructive",- title: "Error!",- description:- error instanceof Error ? error.message : "Unknown error occurred.",- });+ toastError(+ error instanceof Error ? error.message : "Unknown error occurred.",+ );}};diff --git a/src/components/myjobs/NoteDialog.tsx b/src/components/myjobs/NoteDialog.tsxindex ae180d3..2294100 100644--- a/src/components/myjobs/NoteDialog.tsx+++ b/src/components/myjobs/NoteDialog.tsx@@ -14,7 +14,7 @@ import { z } from "zod";import { NoteFormSchema } from "@/models/note.schema";import { NoteResponse } from "@/models/note.model";import { addNote, updateNote } from "@/actions/note.actions";-import { toast } from "../ui/use-toast";+import { toastError, toastSuccess } from "@/lib/toast";import { useEffect, useTransition } from "react";import { Loader } from "lucide-react";import {@@ -66,19 +66,12 @@ export function NoteDialog({: await addNote(data);if (result.success) {- toast({- variant: "success",- description: `Note ${editNote ? "updated" : "added"} successfully`,- });+ toastSuccess(`Note ${editNote ? "updated" : "added"} successfully`);form.reset({ jobId, content: "" });onOpenChange(false);onSaved();} else {- toast({- variant: "destructive",- title: "Error!",- description: result.message,- });+ toastError(result.message);}});}diff --git a/src/components/myjobs/NotesCollapsibleSection.tsx b/src/components/myjobs/NotesCollapsibleSection.tsxindex 3f938c4..3f6aefb 100644--- a/src/components/myjobs/NotesCollapsibleSection.tsx+++ b/src/components/myjobs/NotesCollapsibleSection.tsx@@ -16,7 +16,7 @@ import {CollapsibleContent,CollapsibleTrigger,} from "../ui/collapsible";-import { toast } from "../ui/use-toast";+import { toastError, toastSuccess } from "@/lib/toast";import TiptapEditor from "../TiptapEditor";type NotesCollapsibleSectionProps = {@@ -77,18 +77,11 @@ export function NotesCollapsibleSection({: await addNote({ jobId, content: editorContent });if (result.success) {- toast({- variant: "success",- description: `Note ${editingNote ? "updated" : "added"} successfully`,- });+ toastSuccess(`Note ${editingNote ? "updated" : "added"} successfully`);handleCancel();loadNotes();} else {- toast({- variant: "destructive",- title: "Error!",- description: result.message,- });+ toastError(result.message);}});};@@ -103,18 +96,11 @@ export function NotesCollapsibleSection({startTransition(async () => {const result = await deleteNote(deleteConfirmId);if (result.success) {- toast({- variant: "success",- description: "Note deleted successfully",- });+ toastSuccess("Note deleted successfully");setDeleteConfirmId(null);loadNotes();} else {- toast({- variant: "destructive",- title: "Error!",- description: result.message,- });+ toastError(result.message);}});};diff --git a/src/components/myjobs/TagInput.tsx b/src/components/myjobs/TagInput.tsxindex a477a32..409cefd 100644--- a/src/components/myjobs/TagInput.tsx+++ b/src/components/myjobs/TagInput.tsx@@ -18,7 +18,7 @@ import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";import { Tag } from "@/models/job.model";import { createTag } from "@/actions/tag.actions";-import { toast } from "../ui/use-toast";+import { toastError } from "@/lib/toast";import { cn } from "@/lib/utils";import { APP_CONSTANTS } from "@/lib/constants";@@ -91,11 +91,7 @@ export function TagInput({startTransition(async () => {const result = await createTag(label);if (!result?.success) {- toast({- variant: "destructive",- title: "Error!",- description: result?.message ?? "Failed to create skill tag.",- });+ toastError(result?.message ?? "Failed to create skill tag.");return;}const newTag: Tag = result.data;diff --git a/src/components/profile/AddCertification.tsx b/src/components/profile/AddCertification.tsxindex 2072b5c..104e3f4 100644--- a/src/components/profile/AddCertification.tsx+++ b/src/components/profile/AddCertification.tsx@@ -24,7 +24,7 @@ import { Input } from "../ui/input";import { DatePicker } from "../DatePicker";import { Switch } from "../ui/switch";import { useEffect, useTransition } from "react";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {addCertification,updateCertification,@@ -106,20 +106,13 @@ function AddCertification({? await updateCertification(data): await addCertification(data);if (!res.success) {- toast({- variant: "destructive",- title: "Error!",- description: res.message,- });+ toastError(res.message);} else {reset();setDialogOpen(false);- toast({- variant: "success",- description: `Certification has been ${- certificationToEdit ? "updated" : "added"- } successfully`,- });+ toastSuccess(`Certification has been ${+ certificationToEdit ? "updated" : "added"+ } successfully`);}});};diff --git a/src/components/profile/AddEducation.tsx b/src/components/profile/AddEducation.tsxindex 3d7c3d9..4c3146d 100644--- a/src/components/profile/AddEducation.tsx+++ b/src/components/profile/AddEducation.tsx@@ -25,7 +25,7 @@ import { DatePicker } from "../DatePicker";import { Switch } from "../ui/switch";import TiptapEditor from "../TiptapEditor";import { useCallback, useEffect, useState, useTransition } from "react";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { Combobox } from "../ComboBox";import { JobLocation } from "@/models/job.model";import { addEducation, updateEducation } from "@/actions/profile.actions";@@ -128,20 +128,13 @@ function AddEducation({? await updateEducation(data): await addEducation(data);if (!res.success) {- toast({- variant: "destructive",- title: "Error!",- description: res.message,- });+ toastError(res.message);} else {reset();setDialogOpen(false);- toast({- variant: "success",- description: `Education has been ${- educationToEdit ? "updated" : "added"- } successfully`,- });+ toastSuccess(`Education has been ${+ educationToEdit ? "updated" : "added"+ } successfully`);}});};diff --git a/src/components/profile/AddExperience.tsx b/src/components/profile/AddExperience.tsxindex fb55043..1fe525e 100644--- a/src/components/profile/AddExperience.tsx+++ b/src/components/profile/AddExperience.tsx@@ -23,7 +23,7 @@ import {} from "../ui/form";import { Input } from "../ui/input";import TiptapEditor from "../TiptapEditor";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { Combobox } from "../ComboBox";import { DatePicker } from "../DatePicker";import { Company, JobLocation, JobTitle } from "@/models/job.model";@@ -121,20 +121,13 @@ function AddExperience({? await updateExperience(data): await addExperience(data);if (!res.success) {- toast({- variant: "destructive",- title: "Error!",- description: res.message,- });+ toastError(res.message);} else {reset();setDialogOpen(false);- toast({- variant: "success",- description: `Experience has been ${- experienceToEdit ? "updated" : "added"- } successfully`,- });+ toastSuccess(`Experience has been ${+ experienceToEdit ? "updated" : "added"+ } successfully`);}});};diff --git a/src/components/profile/AddResumeSummary.tsx b/src/components/profile/AddResumeSummary.tsxindex 6bf79fd..6f780bf 100644--- a/src/components/profile/AddResumeSummary.tsx+++ b/src/components/profile/AddResumeSummary.tsx@@ -19,7 +19,7 @@ import {} from "../ui/form";import { Input } from "../ui/input";import { useEffect, useTransition } from "react";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { z } from "zod";import TiptapEditor from "../TiptapEditor";import {@@ -80,20 +80,13 @@ function AddResumeSummary({? await updateResumeSummary(data): await addResumeSummary(data);if (!res.success) {- toast({- variant: "destructive",- title: "Error!",- description: res.message,- });+ toastError(res.message);} else {reset();setDialogOpen(false);- toast({- variant: "success",- description: `Summary has been ${- summaryToEdit ? "updated" : "created"- } successfully`,- });+ toastSuccess(`Summary has been ${+ summaryToEdit ? "updated" : "created"+ } successfully`);}});};diff --git a/src/components/profile/AddSkills.tsx b/src/components/profile/AddSkills.tsxindex 935663b..53c536f 100644--- a/src/components/profile/AddSkills.tsx+++ b/src/components/profile/AddSkills.tsx@@ -23,7 +23,7 @@ import {import { Input } from "../ui/input";import { Button } from "../ui/button";import { Loader } from "lucide-react";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { TagInput } from "../myjobs/TagInput";import { Tag } from "@/models/job.model";import { ResumeSection, Skill } from "@/models/profile.model";@@ -71,7 +71,7 @@ function AddSkills({if (Array.isArray(tags)) {setAllTags(tags);} else {- toast({ variant: "destructive", title: "Error", description: "Failed to load skills. Please close and reopen the dialog." });+ toastError("Failed to load skills. Please close and reopen the dialog.");}});@@ -125,18 +125,11 @@ function AddSkills({}if (!res.success) {- toast({- variant: "destructive",- title: "Error!",- description: res.message,- });+ toastError(res.message);} else {form.reset();setDialogOpen(false);- toast({- variant: "success",- description: `Skills section ${isEditing ? "updated" : "added"} successfully`,- });+ toastSuccess(`Skills section ${isEditing ? "updated" : "added"} successfully`);}});};diff --git a/src/components/profile/AiJobMatchSection.tsx b/src/components/profile/AiJobMatchSection.tsxindex 5cec5ed..e7896c1 100644--- a/src/components/profile/AiJobMatchSection.tsx+++ b/src/components/profile/AiJobMatchSection.tsx@@ -14,7 +14,7 @@ import { useCallback, useEffect, useRef, useState } from "react";import { useSheetAutoScroll } from "@/hooks/useSheetAutoScroll";import { useResizablePanel } from "@/hooks/useResizablePanel";import { Resume } from "@/models/profile.model";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {Select,SelectContent,@@ -104,13 +104,9 @@ export const AiJobMatchSection = ({saveJobMatchResult(jobId, scores.matchScore, matchData).then((res) => {if (res?.success) {onMatchSaved?.(scores.matchScore, matchData);- toast({ title: "Match result saved" });+ toastSuccess("Match result saved");} else {- toast({- variant: "destructive",- title: "Error!",- description: res?.message || "Failed to save match result",- });+ toastError(res?.message || "Failed to save match result");}});},@@ -134,11 +130,7 @@ export const AiJobMatchSection = ({} catch (error) {const message = "Error fetching resume list";const description = error instanceof Error ? error.message : message;- toast({- variant: "destructive",- title: "Error!",- description,- });+ toastError(description);}};@@ -164,12 +156,9 @@ export const AiJobMatchSection = ({} catch (err) {// Aborting (e.g. closing the sheet) is expected — don't toast.if (controller.signal.aborted) return;- toast({- variant: "destructive",- title: "Error!",- description:- err instanceof Error ? err.message : "Failed to get job match analysis",- });+ toastError(+ err instanceof Error ? err.message : "Failed to get job match analysis",+ );} finally {if (abortRef.current === controller) abortRef.current = null;setIsLoading(false);diff --git a/src/components/profile/AiResumeReviewSection.tsx b/src/components/profile/AiResumeReviewSection.tsxindex 8820a7c..7599e22 100644--- a/src/components/profile/AiResumeReviewSection.tsx+++ b/src/components/profile/AiResumeReviewSection.tsx@@ -15,7 +15,7 @@ import { useState, useEffect, useCallback, useRef } from "react";import { useSheetAutoScroll } from "@/hooks/useSheetAutoScroll";import { useResizablePanel } from "@/hooks/useResizablePanel";import { APP_CONSTANTS } from "@/lib/constants";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { Resume } from "@/models/profile.model";import { AiModel, AiProvider, defaultModel } from "@/models/ai.model";import { AiResumeReviewResponseContent } from "./AiResumeReviewResponseContent";@@ -115,13 +115,9 @@ const AiResumeReviewSection = ({ resume, onReviewSaved }: AiSectionProps) => {saveResumeReviewResult(resume.id!, reviewData).then((res) => {if (res?.success) {onReviewSaved?.(reviewData);- toast({ title: "Review saved" });+ toastSuccess("Review saved");} else {- toast({- variant: "destructive",- title: "Error!",- description: res?.message || "Failed to save review",- });+ toastError(res?.message || "Failed to save review");}});},@@ -155,12 +151,9 @@ const AiResumeReviewSection = ({ resume, onReviewSaved }: AiSectionProps) => {} catch (err) {// Aborting (e.g. closing the sheet) is expected — don't toast.if (controller.signal.aborted) return;- toast({- variant: "destructive",- title: "Error!",- description:- err instanceof Error ? err.message : "Failed to get AI review",- });+ toastError(+ err instanceof Error ? err.message : "Failed to get AI review",+ );} finally {if (abortRef.current === controller) abortRef.current = null;setIsLoading(false);diff --git a/src/components/profile/CreateCoverLetter.tsx b/src/components/profile/CreateCoverLetter.tsxindex 9881c48..ec4cca3 100644--- a/src/components/profile/CreateCoverLetter.tsx+++ b/src/components/profile/CreateCoverLetter.tsx@@ -24,7 +24,7 @@ import {} from "../ui/form";import { Input } from "../ui/input";import { CoverLetter } from "@/models/profile.model";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {createCoverLetter,updateCoverLetter,@@ -84,21 +84,14 @@ function CreateCoverLetter({: await createCoverLetter(data.title, data.content);if (!success) {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);} else {reset();setDialogOpen(false);reloadDocuments();- toast({- variant: "success",- description: `Cover letter has been ${- coverLetterToEdit ? "updated" : "created"- } successfully`,- });+ toastSuccess(`Cover letter has been ${+ coverLetterToEdit ? "updated" : "created"+ } successfully`);}});};diff --git a/src/components/profile/CreateResume.tsx b/src/components/profile/CreateResume.tsxindex 525231f..e41553d 100644--- a/src/components/profile/CreateResume.tsx+++ b/src/components/profile/CreateResume.tsx@@ -25,7 +25,7 @@ import {import { Input } from "../ui/input";import { Switch } from "../ui/switch";import { Resume } from "@/models/profile.model";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { AiModel, AiProvider, defaultModel } from "@/models/ai.model";import { getUserSettings } from "@/actions/userSettings.actions";import { checkOllamaConnection } from "@/utils/ai.utils";@@ -146,11 +146,7 @@ function CreateResume({});const response = await res.json();if (!response.success) {- toast({- variant: "destructive",- title: "Error!",- description: response?.message,- });+ toastError(response?.message);return;}@@ -183,10 +179,7 @@ function CreateResume({if (newResumeId) {setNewResumeId(newResumeId);}- toast({- variant: "success",- description: `Resume title has been ${resumeToEdit ? "updated" : "created"} successfully`,- });+ toastSuccess(`Resume title has been ${resumeToEdit ? "updated" : "created"} successfully`);});};diff --git a/src/components/profile/ProfileContainer.tsx b/src/components/profile/ProfileContainer.tsxindex 4202cdb..92ba68c 100644--- a/src/components/profile/ProfileContainer.tsx+++ b/src/components/profile/ProfileContainer.tsx@@ -15,7 +15,7 @@ import {import { APP_CONSTANTS } from "@/lib/constants";import Loading from "../Loading";import DocumentTable from "./ResumeTable";-import { toast } from "../ui/use-toast";+import { toastError } from "@/lib/toast";import { ChevronDown, PlusCircle } from "lucide-react";import { Button } from "../ui/button";import { RecordsCount } from "../RecordsCount";@@ -55,11 +55,7 @@ const ProfileContainer = () => {setTotalResumes(total);setPage(page);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}},[],@@ -74,11 +70,7 @@ const ProfileContainer = () => {setCoverLetters(data);setTotalCoverLetters(total);} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}}, []);diff --git a/src/components/profile/ResumeContainer.tsx b/src/components/profile/ResumeContainer.tsxindex 1ab8655..1f14679 100644--- a/src/components/profile/ResumeContainer.tsx+++ b/src/components/profile/ResumeContainer.tsx@@ -13,7 +13,7 @@ import {useTransition,} from "react";import { useRouter } from "next/navigation";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import SummarySectionCard from "./SummarySectionCard";import ExperienceCard from "./ExperienceCard";import EducationCard from "./EducationCard";@@ -438,11 +438,10 @@ function ResumeContainer({const cards = buildPendingCards(data);if (cards.length === 0) {setImportMode(false);- toast({- title: "No sections found",- description:- "No structured data could be extracted from the document.",- });+ toastError(+ "No structured data could be extracted from the document.",+ "No sections found",+ );return;}setPendingCards(cards);@@ -454,14 +453,9 @@ function ResumeContainer({// Client-initiated abort (unmount/navigation) — not a user-facing error.if (abortController.signal.aborted) return;setImportMode(false);- toast({- variant: "destructive",- title: "Error",- description:- error instanceof Error- ? error.message- : "Failed to contact AI service.",- });+ toastError(+ error instanceof Error ? error.message : "Failed to contact AI service.",+ );} finally {if (importAbortRef.current === abortController) {importAbortRef.current = null;@@ -555,11 +549,7 @@ function ResumeContainer({setPendingCards((prev) => prev.filter((c) => c.id !== cardId));router.refresh();} else {- toast({- variant: "destructive",- title: "Error",- description: result.message,- });+ toastError(result.message);}},[pendingCards, resume.id, router],@@ -576,11 +566,7 @@ function ResumeContainer({if (result?.success) {router.push("/dashboard/profile");} else {- toast({- variant: "destructive",- title: "Error",- description: result?.message,- });+ toastError(result?.message);}};@@ -631,12 +617,10 @@ function ResumeContainer({s.skills?.length,);if (!hasName && !hasSections) {- toast({- title: "Nothing to export",- description:- "Add your contact info and at least one section (Summary, Experience, or Education) before exporting.",- variant: "destructive",- });+ toastError(+ "Add your contact info and at least one section (Summary, Experience, or Education) before exporting.",+ "Nothing to export",+ );return;}@@ -648,19 +632,13 @@ function ResumeContainer({if (!resume.FileId) {triggerDownload(blob, filename);await uploadPdfAsAttachment(blob, filename, false);- toast({- title: "PDF exported",- description: "Saved to Downloads and attached to this resume.",- });+ toastSuccess("Saved to Downloads and attached to this resume.", "PDF exported");} else {setPendingPdf({ blob, filename });setShowAttachConfirm(true);}} catch {- toast({- title: "Failed to generate PDF. Please try again.",- variant: "destructive",- });+ toastError("Failed to generate PDF. Please try again.");} finally {setIsExporting(false);}@@ -675,21 +653,12 @@ function ResumeContainer({triggerDownload(blob, filename);if (choice === "replace") {await uploadPdfAsAttachment(blob, filename, true);- toast({- title: "PDF exported",- description: "Saved to Downloads and attachment replaced.",- });+ toastSuccess("Saved to Downloads and attachment replaced.", "PDF exported");} else {- toast({- title: "PDF exported",- description: "Saved to your Downloads folder.",- });+ toastSuccess("Saved to your Downloads folder.", "PDF exported");}} catch {- toast({- title: "Failed to upload PDF. Please try again.",- variant: "destructive",- });+ toastError("Failed to upload PDF. Please try again.");} finally {setIsExporting(false);setPendingPdf(null);@@ -742,11 +711,7 @@ function ResumeContainer({if (!skillsSection?.id) return;const result = await deleteSkillsSection(skillsSection.id);if (!result.success) {- toast({- variant: "destructive",- title: "Error",- description: result.message,- });+ toastError(result.message);} else {router.refresh();}@@ -772,17 +737,10 @@ function ResumeContainer({if (!resume?.id) return;const { success, message } = await setDefaultResume(resume.id);if (success) {- toast({- variant: "success",- description: "This resume is now your default.",- });+ toastSuccess("This resume is now your default.");router.refresh();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};diff --git a/src/components/profile/ResumeTable.tsx b/src/components/profile/ResumeTable.tsxindex f864f2b..27443d2 100644--- a/src/components/profile/ResumeTable.tsx+++ b/src/components/profile/ResumeTable.tsx@@ -28,7 +28,7 @@ import { format } from "date-fns";import Link from "next/link";import { Button } from "../ui/button";import { useMemo, useState } from "react";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { deleteResumeById, setDefaultResume } from "@/actions/profile.actions";import { deleteCoverLetterById } from "@/actions/coverLetter.actions";import { DeleteAlertDialog } from "../DeleteAlertDialog";@@ -83,17 +83,10 @@ function DocumentTable({if (!doc.id) return;const { success, message } = await setDefaultResume(doc.id);if (success) {- toast({- variant: "success",- description: `"${doc.title}" is now your default resume.`,- });+ toastSuccess(`"${doc.title}" is now your default resume.`);reloadDocuments();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};@@ -127,11 +120,7 @@ function DocumentTable({if (!doc.id) return;if (doc.jobCount > 0) {const label = doc.type === "resume" ? "resume" : "cover letter";- return toast({- variant: "destructive",- title: "Error!",- description: `Number of jobs using ${label} must be 0!`,- });+ return toastError(`Number of jobs using ${label} must be 0!`);}const { success, message } =@@ -141,17 +130,10 @@ function DocumentTable({if (success) {const label = doc.type === "resume" ? "Resume" : "Cover letter";- toast({- variant: "success",- description: `${label} has been deleted successfully`,- });+ toastSuccess(`${label} has been deleted successfully`);reloadDocuments();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}};diff --git a/src/components/questions/QuestionForm.tsx b/src/components/questions/QuestionForm.tsxindex b5e1c67..a68c120 100644--- a/src/components/questions/QuestionForm.tsx+++ b/src/components/questions/QuestionForm.tsx@@ -18,7 +18,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import { Question } from "@/models/question.model";import { Tag } from "@/models/job.model";import { z } from "zod";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {Form,FormControl,@@ -98,20 +98,13 @@ export function QuestionForm({: await createQuestion(data);if (success) {- toast({- variant: "success",- description: `Question has been ${editQuestion ? "updated" : "created"} successfully`,- });+ toastSuccess(`Question has been ${editQuestion ? "updated" : "created"} successfully`);reset();setDialogOpen(false);resetEditQuestion();onQuestionSaved();} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);}});}diff --git a/src/components/settings/AiSettings.tsx b/src/components/settings/AiSettings.tsxindex d5366df..9178779 100644--- a/src/components/settings/AiSettings.tsx+++ b/src/components/settings/AiSettings.tsx@@ -22,7 +22,7 @@ import {} from "../ui/select";import { Label } from "../ui/label";import { Button } from "../ui/button";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { XCircle, Loader2, RefreshCw } from "lucide-react";import { checkOllamaConnection } from "@/utils/ai.utils";import { getUserSettings, updateAiSettings } from "@/actions/userSettings.actions";@@ -173,11 +173,7 @@ function AiSettings() {const saveModelSettings = async () => {if (!selectedModel.model) {- toast({- variant: "destructive",- title: "Error",- description: "Please select a model to save.",- });+ toastError("Please select a model to save.");return;}setIsSaving(true);@@ -187,25 +183,13 @@ function AiSettings() {model: selectedModel.model,});if (result.success) {- toast({- variant: "success",- title: "Saved!",- description: "AI Settings saved successfully.",- });+ toastSuccess("AI Settings saved successfully.", "Saved!");} else {- toast({- variant: "destructive",- title: "Error",- description: result.message || "Failed to save AI settings.",- });+ toastError(result.message || "Failed to save AI settings.");}} catch (error) {console.error("Error saving AI settings:", error);- toast({- variant: "destructive",- title: "Error",- description: "Failed to save AI settings.",- });+ toastError("Failed to save AI settings.");} finally {setIsSaving(false);}diff --git a/src/components/settings/ApiKeySettings.tsx b/src/components/settings/ApiKeySettings.tsxindex 9bc84d2..4ff1225 100644--- a/src/components/settings/ApiKeySettings.tsx+++ b/src/components/settings/ApiKeySettings.tsx@@ -12,7 +12,7 @@ import { Button } from "../ui/button";import { Input } from "../ui/input";import { Badge } from "../ui/badge";import { Label } from "../ui/label";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {AlertDialog,AlertDialogAction,@@ -130,11 +130,7 @@ function ApiKeySettings() {const verifyData = await verifyRes.json();if (!verifyData.success) {- toast({- variant: "destructive",- title: "Verification failed",- description: verifyData.error || "Could not verify the key",- });+ toastError(verifyData.error || "Could not verify the key", "Verification failed");return;}@@ -145,28 +141,16 @@ function ApiKeySettings() {sensitive: providerConfig?.sensitive ?? true,});if (saveResult.success) {- toast({- variant: "success",- title: "API key saved",- description: `${PROVIDERS.find((p) => p.id === provider)?.name} key verified and saved.`,- });+ toastSuccess(`${PROVIDERS.find((p) => p.id === provider)?.name} key verified and saved.`, "API key saved");setEditingProvider(null);setInputValue("");await fetchKeys();} else {- toast({- variant: "destructive",- title: "Save failed",- description: saveResult.message || "Failed to save API key",- });+ toastError(saveResult.message || "Failed to save API key", "Save failed");}} catch (error) {console.error("Error saving API key:", error);- toast({- variant: "destructive",- title: "Error",- description: "An unexpected error occurred",- });+ toastError("An unexpected error occurred");} finally {setVerifying(false);}@@ -177,18 +161,10 @@ function ApiKeySettings() {try {const result = await deleteApiKey(provider);if (result.success) {- toast({- variant: "success",- title: "API key deleted",- description: `${PROVIDERS.find((p) => p.id === provider)?.name} key removed.`,- });+ toastSuccess(`${PROVIDERS.find((p) => p.id === provider)?.name} key removed.`, "API key deleted");await fetchKeys();} else {- toast({- variant: "destructive",- title: "Error",- description: result.message || "Failed to delete API key",- });+ toastError(result.message || "Failed to delete API key");}} catch (error) {console.error("Error deleting API key:", error);diff --git a/src/components/settings/DisplaySettings.tsx b/src/components/settings/DisplaySettings.tsxindex cfc8029..fcceb6f 100644--- a/src/components/settings/DisplaySettings.tsx+++ b/src/components/settings/DisplaySettings.tsx@@ -13,7 +13,7 @@ import {import { RadioGroup, RadioGroupItem } from "../ui/radio-group";import { useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { Button } from "../ui/button";import { useTheme } from "next-themes";import { Loader2 } from "lucide-react";@@ -70,24 +70,13 @@ function DisplaySettings() {const result = await updateDisplaySettings({ theme: data.theme });if (result.success) {setTheme(data.theme);- toast({- variant: "success",- title: "Your selected theme has been saved.",- });+ toastSuccess("Your selected theme has been saved.");} else {- toast({- variant: "destructive",- title: "Error",- description: result.message || "Failed to save display settings.",- });+ toastError(result.message || "Failed to save display settings.");}} catch (error) {console.error("Error saving display settings:", error);- toast({- variant: "destructive",- title: "Error",- description: "Failed to save display settings.",- });+ toastError("Failed to save display settings.");} finally {setIsSaving(false);}diff --git a/src/components/settings/McpAccessSettings.tsx b/src/components/settings/McpAccessSettings.tsxindex 5edecde..9b33ffe 100644--- a/src/components/settings/McpAccessSettings.tsx+++ b/src/components/settings/McpAccessSettings.tsx@@ -6,7 +6,7 @@ import { Button } from "../ui/button";import { Input } from "../ui/input";import { Badge } from "../ui/badge";import { Label } from "../ui/label";-import { toast } from "../ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import {Dialog,DialogContent,@@ -51,11 +51,7 @@ function CopyButton({ text }: { text: string }) {setCopied(true);setTimeout(() => setCopied(false), 2000);} catch {- toast({- title: "Copy failed",- description: "Couldn't copy to clipboard. Please copy the text manually.",- variant: "destructive",- });+ toastError("Couldn't copy to clipboard. Please copy the text manually.", "Copy failed");}};return (@@ -180,7 +176,7 @@ export default function McpAccessSettings() {const result = await createMcpToken({ name: tokenName.trim(), expiryDays });setGenerating(false);if (!result.success) {- toast({ title: "Error", description: result.message, variant: "destructive" });+ toastError(result.message);return;}setRevealedToken({ token: result.token, name: result.record.name });@@ -195,11 +191,11 @@ export default function McpAccessSettings() {const result = await revokeMcpToken(id);setRevoking(null);if (!result.success) {- toast({ title: "Error", description: result.message ?? "Failed to revoke", variant: "destructive" });+ toastError(result.message ?? "Failed to revoke");return;}setTokens((prev) => prev.filter((t) => t.id !== id));- toast({ title: "Token revoked" });+ toastSuccess("Token revoked");};return (diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsxnew file mode 100644index 0000000..1b899f3--- /dev/null+++ b/src/components/ui/sonner.tsx@@ -0,0 +1,17 @@+"use client";++import { useTheme } from "next-themes";+import { Toaster as Sonner } from "sonner";++export function Toaster() {+ const { resolvedTheme } = useTheme();++ return (+ <Sonner+ theme={resolvedTheme as "light" | "dark" | undefined}+ position="bottom-right"+ richColors+ closeButton+ />+ );+}diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsxdeleted file mode 100644index 4237f20..0000000--- a/src/components/ui/toast.tsx+++ /dev/null@@ -1,130 +0,0 @@-"use client";--import * as React from "react";-import * as ToastPrimitives from "@radix-ui/react-toast";-import { cva, type VariantProps } from "class-variance-authority";-import { X } from "lucide-react";--import { cn } from "@/lib/utils";--const ToastProvider = ToastPrimitives.Provider;--const ToastViewport = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Viewport>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>->(({ className, ...props }, ref) => (- <ToastPrimitives.Viewport- ref={ref}- className={cn(- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",- className- )}- {...props}- />-));-ToastViewport.displayName = ToastPrimitives.Viewport.displayName;--const toastVariants = cva(- "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",- {- variants: {- variant: {- default: "border bg-background text-foreground",- destructive:- "destructive group border-destructive bg-destructive text-destructive-foreground",- success: "success group border-green-500 bg-green-500 text-foreground",- },- },- defaultVariants: {- variant: "default",- },- }-);--const Toast = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Root>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &- VariantProps<typeof toastVariants>->(({ className, variant, ...props }, ref) => {- return (- <ToastPrimitives.Root- ref={ref}- className={cn(toastVariants({ variant }), className)}- {...props}- />- );-});-Toast.displayName = ToastPrimitives.Root.displayName;--const ToastAction = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Action>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>->(({ className, ...props }, ref) => (- <ToastPrimitives.Action- ref={ref}- className={cn(- "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",- className- )}- {...props}- />-));-ToastAction.displayName = ToastPrimitives.Action.displayName;--const ToastClose = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Close>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>->(({ className, ...props }, ref) => (- <ToastPrimitives.Close- ref={ref}- className={cn(- "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",- className- )}- toast-close=""- {...props}- >- <X className="h-4 w-4" />- </ToastPrimitives.Close>-));-ToastClose.displayName = ToastPrimitives.Close.displayName;--const ToastTitle = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Title>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>->(({ className, ...props }, ref) => (- <ToastPrimitives.Title- ref={ref}- className={cn("text-sm font-semibold", className)}- {...props}- />-));-ToastTitle.displayName = ToastPrimitives.Title.displayName;--const ToastDescription = React.forwardRef<- React.ElementRef<typeof ToastPrimitives.Description>,- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>->(({ className, ...props }, ref) => (- <ToastPrimitives.Description- ref={ref}- className={cn("text-sm opacity-90", className)}- {...props}- />-));-ToastDescription.displayName = ToastPrimitives.Description.displayName;--type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;--type ToastActionElement = React.ReactElement<typeof ToastAction>;--export {- type ToastProps,- type ToastActionElement,- ToastProvider,- ToastViewport,- Toast,- ToastTitle,- ToastDescription,- ToastClose,- ToastAction,-};diff --git a/src/components/ui/toaster.tsx b/src/components/ui/toaster.tsxdeleted file mode 100644index e223385..0000000--- a/src/components/ui/toaster.tsx+++ /dev/null@@ -1,35 +0,0 @@-"use client"--import {- Toast,- ToastClose,- ToastDescription,- ToastProvider,- ToastTitle,- ToastViewport,-} from "@/components/ui/toast"-import { useToast } from "@/components/ui/use-toast"--export function Toaster() {- const { toasts } = useToast()-- return (- <ToastProvider>- {toasts.map(function ({ id, title, description, action, ...props }) {- return (- <Toast key={id} {...props}>- <div className="grid gap-1">- {title && <ToastTitle>{title}</ToastTitle>}- {description && (- <ToastDescription>{description}</ToastDescription>- )}- </div>- {action}- <ToastClose />- </Toast>- )- })}- <ToastViewport />- </ToastProvider>- )-}diff --git a/src/components/ui/use-toast.ts b/src/components/ui/use-toast.tsdeleted file mode 100644index c8ef765..0000000--- a/src/components/ui/use-toast.ts+++ /dev/null@@ -1,193 +0,0 @@-"use client"--// Inspired by react-hot-toast library-import * as React from "react"--import type {- ToastActionElement,- ToastProps,-} from "@/components/ui/toast"-import { APP_CONSTANTS } from "@/lib/constants"-const TOAST_REMOVE_DELAY = 1000000--type ToasterToast = ToastProps & {- id: string- title?: React.ReactNode- description?: React.ReactNode- action?: ToastActionElement-}--const actionTypes = {- ADD_TOAST: "ADD_TOAST",- UPDATE_TOAST: "UPDATE_TOAST",- DISMISS_TOAST: "DISMISS_TOAST",- REMOVE_TOAST: "REMOVE_TOAST",-} as const--let count = 0--function genId() {- count = (count + 1) % Number.MAX_SAFE_INTEGER- return count.toString()-}--type ActionType = typeof actionTypes--type Action =- | {- type: ActionType["ADD_TOAST"]- toast: ToasterToast- }- | {- type: ActionType["UPDATE_TOAST"]- toast: Partial<ToasterToast>- }- | {- type: ActionType["DISMISS_TOAST"]- toastId?: ToasterToast["id"]- }- | {- type: ActionType["REMOVE_TOAST"]- toastId?: ToasterToast["id"]- }--interface State {- toasts: ToasterToast[]-}--const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()--const addToRemoveQueue = (toastId: string) => {- if (toastTimeouts.has(toastId)) {- return- }-- const timeout = setTimeout(() => {- toastTimeouts.delete(toastId)- dispatch({- type: "REMOVE_TOAST",- toastId: toastId,- })- }, TOAST_REMOVE_DELAY)-- toastTimeouts.set(toastId, timeout)-}--export const reducer = (state: State, action: Action): State => {- switch (action.type) {- case "ADD_TOAST":- return {- ...state,- toasts: [action.toast, ...state.toasts].slice(0, APP_CONSTANTS.TOAST_LIMIT),- }-- case "UPDATE_TOAST":- return {- ...state,- toasts: state.toasts.map((t) =>- t.id === action.toast.id ? { ...t, ...action.toast } : t- ),- }-- case "DISMISS_TOAST": {- const { toastId } = action-- // ! Side effects ! - This could be extracted into a dismissToast() action,- // but I'll keep it here for simplicity- if (toastId) {- addToRemoveQueue(toastId)- } else {- state.toasts.forEach((toast) => {- addToRemoveQueue(toast.id)- })- }-- return {- ...state,- toasts: state.toasts.map((t) =>- t.id === toastId || toastId === undefined- ? {- ...t,- open: false,- }- : t- ),- }- }- case "REMOVE_TOAST":- if (action.toastId === undefined) {- return {- ...state,- toasts: [],- }- }- return {- ...state,- toasts: state.toasts.filter((t) => t.id !== action.toastId),- }- }-}--const listeners: Array<(state: State) => void> = []--let memoryState: State = { toasts: [] }--function dispatch(action: Action) {- memoryState = reducer(memoryState, action)- listeners.forEach((listener) => {- listener(memoryState)- })-}--type Toast = Omit<ToasterToast, "id">--function toast({ ...props }: Toast) {- const id = genId()-- const update = (props: ToasterToast) =>- dispatch({- type: "UPDATE_TOAST",- toast: { ...props, id },- })- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })-- dispatch({- type: "ADD_TOAST",- toast: {- ...props,- id,- open: true,- onOpenChange: (open) => {- if (!open) dismiss()- },- },- })-- return {- id: id,- dismiss,- update,- }-}--function useToast() {- const [state, setState] = React.useState<State>(memoryState)-- React.useEffect(() => {- listeners.push(setState)- return () => {- const index = listeners.indexOf(setState)- if (index > -1) {- listeners.splice(index, 1)- }- }- }, [state])-- return {- ...state,- toast,- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),- }-}--export { useToast, toast }diff --git a/src/context/ActivityContext.tsx b/src/context/ActivityContext.tsxindex c9c9cfb..99f2aba 100644--- a/src/context/ActivityContext.tsx+++ b/src/context/ActivityContext.tsx@@ -16,7 +16,7 @@ import {stopActivityById,} from "@/actions/activity.actions";import { Activity, ActivityType } from "@/models/activity.model";-import { toast } from "@/components/ui/use-toast";+import { toastSuccess, toastError } from "@/lib/toast";import { APP_CONSTANTS } from "@/lib/constants";interface ActivityContextType {@@ -122,21 +122,16 @@ export function ActivityProvider({ children }: { children: ReactNode }) {if (success) {stopTimer();setCurrentActivity(undefined);- toast({- variant: "destructive",- description: `Activity not saved because duration was less than ${APP_CONSTANTS.ACTIVITY_MIN_DURATION_MINUTES} minutes`,- });+ toastError(+ `Activity not saved because duration was less than ${APP_CONSTANTS.ACTIVITY_MIN_DURATION_MINUTES} minutes`+ );return true;} else {// The running activity is a per-user singleton, so another session// may have already ended it — resync so a stale copy can't leave an// undismissable banner.await refreshCurrentActivity();- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);return false;}}@@ -152,20 +147,15 @@ export function ActivityProvider({ children }: { children: ReactNode }) {if (success) {stopTimer();setCurrentActivity(undefined);- toast({- variant: "success",- description: autoStop+ toastSuccess(+ autoStop? `Activity auto-stopped after reaching maximum duration of ${maxDurationMinutes / 60} hours`- : "Activity stopped successfully",- });+ : "Activity stopped successfully"+ );return true;} else {await refreshCurrentActivity();- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);return false;}},@@ -184,18 +174,11 @@ export function ActivityProvider({ children }: { children: ReactNode }) {if (success && newActivity) {setCurrentActivity(newActivity as Activity);- toast({- variant: "success",- description: "Activity started successfully",- });+ toastSuccess("Activity started successfully");setIsLoading(false);return true;} else {- toast({- variant: "destructive",- title: "Error!",- description: message,- });+ toastError(message);setIsLoading(false);return false;}diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 57df6cc..cc2de5e 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -27,7 +27,6 @@ export const APP_CONSTANTS = {RECENT_NUM_JOBS_ACTIVITIES: 10,AI_SLOW_RESPONSE_THRESHOLD_MS: 15_000, // 15 secondsINTERSECTION_OBSERVER_THRESHOLD: 0.1,- TOAST_LIMIT: 1,SIDEBAR_STORAGE_KEY: "sidebar-expanded",DASHBOARD_WEEKLY_CHART_STORAGE_KEY: "dashboard-weekly-chart-tab",DASHBOARD_RECENT_CARD_STORAGE_KEY: "dashboard-recent-card-tab",diff --git a/src/lib/toast.ts b/src/lib/toast.tsindex b3d365c..5091855 100644--- a/src/lib/toast.ts+++ b/src/lib/toast.ts@@ -1,16 +1,15 @@-import { toast } from "@/components/ui/use-toast";+import { toast } from "sonner";import type { ActionResult } from "@/models/action.model";-export function toastSuccess(description: string, title?: string) {- toast({ variant: "success", title, description });+export function toastSuccess(message: string, title?: string) {+ if (title) toast.success(title, { description: message });+ else toast.success(message);}-export function toastError(description?: string, title = "Error") {- toast({- variant: "destructive",- title,- description: description ?? "Something went wrong. Please try again.",- });+export function toastError(message?: string, title?: string) {+ const text = message ?? "Something went wrong. Please try again.";+ if (title) toast.error(title, { description: text });+ else toast.error(text);}// Collapses the repeated success/error branch into one call.diff --git a/src/utils/resumeSections.utils.ts b/src/utils/resumeSections.utils.tsindex 0c552a6..70d42a2 100644--- a/src/utils/resumeSections.utils.ts+++ b/src/utils/resumeSections.utils.ts@@ -1,4 +1,4 @@-import { toast } from "@/components/ui/use-toast";+import { toastError } from "@/lib/toast";import {buildInsufficientSectionsMessage,hasMinResumeSections,@@ -10,9 +10,5 @@ export const warnInsufficientResumeSections = (action: string,hint?: string,): void => {- toast({- variant: "destructive",- title: "Not enough content",- description: buildInsufficientSectionsMessage(action, hint),- });+ toastError(buildInsufficientSectionsMessage(action, hint), "Not enough content");};