import Icon from '@mui/material/Icon'; import IconButton from '@mui/material/IconButton'; import React, {useState} from 'react'; import {useUserNotificationsQuery} from '../../generated/graphql'; import Badge from '@mui/material/Badge'; import DrawerContent from './DrawerContent'; const DrawerNotification = () => { const POLL_INTERVAL = 30000; const {data} = useUserNotificationsQuery({ pollInterval: POLL_INTERVAL, }); const [isDrawerOpen, setIsDrawerOpen] = useState(false); const notifications = data?.me?.profile?.notifications?.data || []; const hasUnreadNotifications = notifications.some( notification => !notification.attributes.read ); return ( <> setIsDrawerOpen(true)} > {hasUnreadNotifications ? ( notifications_none_outlined ) : ( notifications_none_outlined )} setIsDrawerOpen(false)} /> ); }; export default DrawerNotification;