Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
feat(notifications): add Clear all to the bell popover
Khuram Niaz1c9655e78508
diff --git a/__tests__/NotificationBell.spec.tsx b/__tests__/NotificationBell.spec.tsxindex 61e4b76..2e2043c 100644--- a/__tests__/NotificationBell.spec.tsx+++ b/__tests__/NotificationBell.spec.tsx@@ -9,6 +9,7 @@ vi.mock("@/actions/notification.actions", () => ({markNotificationRead: vi.fn().mockResolvedValue({ success: true }),markAllNotificationsRead: vi.fn().mockResolvedValue({ success: true }),dismissNotification: vi.fn().mockResolvedValue({ success: true }),+ dismissAllNotifications: vi.fn().mockResolvedValue({ success: true }),}));vi.mock("@/context/NotificationContext", () => ({ useNotifications: vi.fn() }));vi.mock("next/link", () => ({@@ -94,6 +95,15 @@ it("Mark all read marks all and refreshes", async () => {expect(refresh).toHaveBeenCalled();});+it("Clear all dismisses every row and refreshes the badge", async () => {+ render(<NotificationBell />);+ await userEvent.click(screen.getByRole("button", { name: /notifications/i }));+ await userEvent.click(await screen.findByRole("button", { name: /clear all/i }));+ expect(actions.dismissAllNotifications).toHaveBeenCalled();+ expect(screen.getByText("You’re all caught up.")).toBeInTheDocument();+ expect(refresh).toHaveBeenCalled();+});+it("shows the empty state", async () => {(actions.getPopoverNotifications as any).mockResolvedValue({ success: true, data: [] });render(<NotificationBell />);diff --git a/__tests__/notification.actions.spec.ts b/__tests__/notification.actions.spec.tsindex a11747e..632f9ef 100644--- a/__tests__/notification.actions.spec.ts+++ b/__tests__/notification.actions.spec.ts@@ -5,6 +5,7 @@ import {markNotificationRead,markAllNotificationsRead,dismissNotification,+ dismissAllNotifications,deleteNotification,clearReadNotifications,} from "@/actions/notification.actions";@@ -102,6 +103,14 @@ describe("mutations are scoped to the user", () => {await expect(dismissNotification("someone-elses")).resolves.toEqual({ success: true });});+ it("dismiss all hides every undismissed row and marks it read", async () => {+ await dismissAllNotifications();+ const { where, data } = db.notification.updateMany.mock.calls[0][0];+ expect(where).toEqual({ userId: "user-1", dismissedAt: null });+ expect(data.dismissedAt).toBeInstanceOf(Date);+ expect(data.readAt).toBe(data.dismissedAt);+ });+it("delete", async () => {await deleteNotification("n-1");expect(db.notification.deleteMany).toHaveBeenCalledWith({diff --git a/src/actions/notification.actions.ts b/src/actions/notification.actions.tsindex eed9ce4..9498e0d 100644--- a/src/actions/notification.actions.ts+++ b/src/actions/notification.actions.ts@@ -174,6 +174,21 @@ export async function dismissNotification(id: string) {}}+// Popover "Clear all": every undismissed row, not just the loaded page.+export async function dismissAllNotifications() {+ try {+ const user = await requireUser();+ const now = new Date();+ await db.notification.updateMany({+ where: { userId: user.id, dismissedAt: null },+ data: { dismissedAt: now, readAt: now },+ });+ return { success: true };+ } catch (error) {+ return handleError(error, "Failed to clear notifications.");+ }+}+export async function deleteNotification(id: string) {try {const user = await requireUser();diff --git a/src/components/notifications/NotificationBell.tsx b/src/components/notifications/NotificationBell.tsxindex 4921f0c..be87163 100644--- a/src/components/notifications/NotificationBell.tsx+++ b/src/components/notifications/NotificationBell.tsx@@ -2,12 +2,13 @@import { useState } from "react";import Link from "next/link";-import { Bell, CheckCheck } from "lucide-react";+import { Bell, CheckCheck, X } from "lucide-react";import { Button } from "@/components/ui/button";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import { cn } from "@/lib/utils";import { useNotifications } from "@/context/NotificationContext";import {+ dismissAllNotifications,dismissNotification,getPopoverNotifications,markAllNotificationsRead,@@ -62,6 +63,12 @@ export function NotificationBell() {refresh();};+ const onClearAll = async () => {+ setItems([]);+ await dismissAllNotifications();+ refresh();+ };+// Unread only, like the bell badge: a read error needs no attention.const errorCount = items.filter((i) => isErrorNotification(i) && i.readAt === null,@@ -100,6 +107,15 @@ export function NotificationBell() {<CheckCheck className="h-3.5 w-3.5" />Mark all read</Button>+ <Button+ variant="ghost"+ size="sm"+ className="h-auto gap-1 px-1 py-1.5 text-[13px] font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"+ onClick={onClearAll}+ >+ <X className="h-3.5 w-3.5" />+ Clear all+ </Button></div><div role="tablist" className="flex gap-1 border-b px-4">{TABS.map((t) => (diff --git a/wiki/automations.md b/wiki/automations.mdindex 0ffb99f..c5fc0de 100644--- a/wiki/automations.md+++ b/wiki/automations.md@@ -108,4 +108,4 @@ The bell in the header tells you: it shows a count of unread notifications, redEvery finished run posts a summary of what it found, with a link to any new jobs; cancelled runs post nothing. A company board that could not be reached (removed, timed out or rate-limited) gets its own row, which comes back after each run until you fix it — **Edit watchlist** opens the automation's editor. If every board fails, the run is marked failed.-The **×** in the bell only hides a row; the Notifications page (**View all notifications**, or the account menu) still lists it. On the page, **×** and **Clear read** delete for good, after asking you to confirm. Notifications are kept for 30 days.+The **×** in the bell only hides a row, and **Clear all** hides every row at once; the Notifications page (**View all notifications**, or the account menu) still lists it. On the page, **×** and **Clear read** delete for good, after asking you to confirm. Notifications are kept for 30 days.