diff --git a/src/frontend/src/components/nav/NotificationDrawer.tsx b/src/frontend/src/components/nav/NotificationDrawer.tsx index bc68fc0fa3..7481319117 100644 --- a/src/frontend/src/components/nav/NotificationDrawer.tsx +++ b/src/frontend/src/components/nav/NotificationDrawer.tsx @@ -12,9 +12,9 @@ import { Text, Tooltip } from '@mantine/core'; -import { IconBellCheck, IconBellPlus } from '@tabler/icons-react'; +import { IconArrowRight, IconBellCheck } from '@tabler/icons-react'; import { useQuery } from '@tanstack/react-query'; -import { useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { api } from '../../App'; @@ -59,6 +59,19 @@ export function NotificationDrawer({ return (notificationQuery.data?.results?.length ?? 0) > 0; }, [notificationQuery.data]); + const markAllAsRead = useCallback(() => { + api + .get(apiUrl(ApiEndpoints.notifications_readall), { + params: { + read: false + } + }) + .catch((_error) => {}) + .then((_response) => { + notificationQuery.refetch(); + }); + }, []); + return ( {t`Notifications`} - { - onClose(); - navigate('/notifications/unread'); - }} - variant="transparent" - > - - + + + { + markAllAsRead(); + }} + > + + + + + { + onClose(); + navigate('/notifications/unread'); + }} + variant="transparent" + > + + + + } >