import Drawer from '@mui/material/Drawer'; import Box from '@mui/material/Box'; import { useUserNotificationsQuery, useReadNotificationsMutation, } from '../../generated/graphql'; import CardNotification from './CardNotification'; import DrawerHeader from './DrawerHeader'; import Icon from '@mui/material/Icon'; import Typography from '@mui/material/Typography'; import useMediaQuery from '@mui/material/useMediaQuery'; import {useTranslation} from 'react-i18next'; interface Props { isOpen: boolean; onClose: () => void; } const DrawerContent: React.FC = ({isOpen, onClose}) => { const {data} = useUserNotificationsQuery(); const [readNotifications] = useReadNotificationsMutation(); const {t} = useTranslation(); const notifications = data?.me?.profile?.notifications?.data || []; const hasNotifications = notifications.length > 0; const markAllRead = () => { readNotifications({refetchQueries: ['UserNotifications']}); }; const isAllRead = notifications.every( notification => notification.attributes.read ); const isMobile = useMediaQuery('(max-width:400px)'); return ( {hasNotifications ? ( notifications.map((notification, index) => ( )) ) : ( inbox {t`notifications.content`} )} ); }; export default DrawerContent;