From c28b7802da0b4a6094ab1a4d90f3ec0774598f09 Mon Sep 17 00:00:00 2001 From: Matt Roberts Date: Tue, 8 Oct 2024 08:58:03 +0100 Subject: [PATCH] More styling, plus "mark all as read" --- public/components/NotificationIndicator.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/public/components/NotificationIndicator.tsx b/public/components/NotificationIndicator.tsx index af4574637..92a6638c6 100644 --- a/public/components/NotificationIndicator.tsx +++ b/public/components/NotificationIndicator.tsx @@ -77,6 +77,14 @@ export const NotificationIndicator = () => { } }, [showingNotifications]) + const markAllAsRead = async (e: React.MouseEvent) => { + e.preventDefault() + const response = await actions.markAllAsRead() + if (response.ok) { + location.reload() + } + } + return ( { <> {unread !== undefined && unread?.length > 0 ? ( <> -

+

Unread notifications + {unread.length > 1 && ( + + Mark All as Read + + )}

- + {unread.map((n) => ( ))} @@ -109,10 +122,10 @@ export const NotificationIndicator = () => { )} {recent !== undefined && recent?.length > 0 && ( <> -

+

Previous notifications

- + {recent.map((n) => ( ))}