From bcea53306e6b5b0bc068bc4b9d47c882fef547a0 Mon Sep 17 00:00:00 2001
From: SimplyRayYZL <116981513+SimplyRayYZL@users.noreply.github.com>
Date: Wed, 13 May 2026 11:46:49 +0300
Subject: [PATCH 1/4] feat: add clear all notifications action
---
frontend/components/NotificationsBell.tsx | 37 +++++++++++++++++------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/frontend/components/NotificationsBell.tsx b/frontend/components/NotificationsBell.tsx
index 85cc489..5952cf2 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,13 @@ export function NotificationsBell({ userId }: { userId: string }) {
await markAllRead(supabase, userId);
}
+ async function onClearAll() {
+ 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 +154,26 @@ export function NotificationsBell({ userId }: { userId: string }) {
Notifications
- {unread > 0 && (
-
- )}
+
+ {unread > 0 && (
+
+ )}
+ {hasItems && (
+
+ )}
+
{loading &&
Loading…
}
From 906456bb0c26e101478ea39643c1b2921f4c7976 Mon Sep 17 00:00:00 2001
From: SimplyRayYZL <116981513+SimplyRayYZL@users.noreply.github.com>
Date: Wed, 13 May 2026 11:46:50 +0300
Subject: [PATCH 2/4] feat: add clear all notifications action
---
frontend/lib/notifications.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/frontend/lib/notifications.ts b/frontend/lib/notifications.ts
index 6176ddd..19bda2d 100644
--- a/frontend/lib/notifications.ts
+++ b/frontend/lib/notifications.ts
@@ -178,6 +178,18 @@ export async function markAllRead(
if (error) console.warn("[markAllRead]", error);
}
+/** Delete all notifications for the current user. */
+export async function clearNotifications(
+ supabase: DBClient,
+ userId: string,
+): Promise
{
+ const { error } = await supabase
+ .from("notifications" as never)
+ .delete()
+ .eq("user_id", userId);
+ if (error) console.warn("[clearNotifications]", error);
+}
+
/* ---------------------------------------------------------------- */
/* Writers — call from the action that produced the event. */
/* ---------------------------------------------------------------- */
From baecb582eb3e26151f2b13c673654c3d4831123d Mon Sep 17 00:00:00 2001
From: SimplyRayYZL <116981513+SimplyRayYZL@users.noreply.github.com>
Date: Wed, 13 May 2026 11:46:52 +0300
Subject: [PATCH 3/4] feat: add clear all notifications action
---
frontend/app/globals.css | 5 +++++
1 file changed, 5 insertions(+)
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;
From 1eac44e76aa82fdd24ba2baa061c3d204391732e Mon Sep 17 00:00:00 2001
From: Dream For Trade
Date: Wed, 20 May 2026 21:28:25 +0300
Subject: [PATCH 4/4] fix: confirm clearing notifications
---
frontend/components/NotificationsBell.tsx | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/frontend/components/NotificationsBell.tsx b/frontend/components/NotificationsBell.tsx
index 5952cf2..80e1964 100644
--- a/frontend/components/NotificationsBell.tsx
+++ b/frontend/components/NotificationsBell.tsx
@@ -117,6 +117,11 @@ export function NotificationsBell({ userId }: { userId: string }) {
}
async function onClearAll() {
+ const confirmed = window.confirm(
+ "Clear all notifications? This cannot be undone.",
+ );
+ if (!confirmed) return;
+
setItems([]);
setUnread(0);
const supabase = createClient();