diff --git a/frontend/app/globals.css b/frontend/app/globals.css index 921391a..b06ab37 100644 --- a/frontend/app/globals.css +++ b/frontend/app/globals.css @@ -823,6 +823,11 @@ section { position: relative; padding: 120px 40px; } font-weight: 600; font-size: 13px; } +.notif-panel-actions { + display: flex; + align-items: center; + gap: 10px; +} .notif-mark-all { background: transparent; border: none; diff --git a/frontend/components/NotificationsBell.tsx b/frontend/components/NotificationsBell.tsx index 85cc489..80e1964 100644 --- a/frontend/components/NotificationsBell.tsx +++ b/frontend/components/NotificationsBell.tsx @@ -22,6 +22,7 @@ import { fetchNotifications, fetchUnreadCount, markAllRead, + clearNotifications, markNotificationRead, type Notification, } from "@/lib/notifications"; @@ -115,6 +116,18 @@ export function NotificationsBell({ userId }: { userId: string }) { await markAllRead(supabase, userId); } + async function onClearAll() { + const confirmed = window.confirm( + "Clear all notifications? This cannot be undone.", + ); + if (!confirmed) return; + + setItems([]); + setUnread(0); + const supabase = createClient(); + await clearNotifications(supabase, userId); + } + const hasItems = items.length > 0; const badge = unread > 99 ? "99+" : unread > 0 ? String(unread) : null; @@ -146,15 +159,26 @@ export function NotificationsBell({ userId }: { userId: string }) {