diff --git a/tavern/internal/www/src/components/notifications/NotificationBell.tsx b/tavern/internal/www/src/components/notifications/NotificationBell.tsx index 74c2e2678..d23d6402d 100644 --- a/tavern/internal/www/src/components/notifications/NotificationBell.tsx +++ b/tavern/internal/www/src/components/notifications/NotificationBell.tsx @@ -42,20 +42,10 @@ const NotificationBell = () => { const readNotifications = notifications.filter(n => n.read && !n.archived); const archivedNotifications = notifications.filter(n => n.archived); - const handleTabChange = (index: number, activeTabs: string[]) => { - const tabName = activeTabs[index]; - const listMap: Record = { - 'Urgent': urgentNotifications, - 'Unread': unreadNotifications, - 'Read': readNotifications, - 'Archived': archivedNotifications - }; - const list = listMap[tabName] || []; - const toMark = list.filter(n => !n.read); - - if (toMark.length > 0) { + const handleClose = () => { + if (unreadNotifications.length > 0) { markAsRead({ - variables: { notificationIDs: toMark.map(n => n.id) }, + variables: { notificationIDs: unreadNotifications.map(n => n.id) }, onCompleted: () => refetch(), }); } @@ -196,11 +186,7 @@ const NotificationBell = () => { return ( { - if (activeTabs[0] === 'Urgent' || activeTabs[0] === 'Unread') { - handleTabChange(0, activeTabs); - } - }} + onClose={handleClose} > @@ -234,7 +220,7 @@ const NotificationBell = () => { {activeTabs.length > 0 ? ( - handleTabChange(index, activeTabs)}> + {activeTabs.map(tab => ( {tab}