import { useNotifications } from 'hooks/notifications/useNotifications' import { useMemo, useState } from 'react' import NotificationsDrawer from './NotificationsDrawer' import { BellIcon } from '@heroicons/react/20/solid' import { useIsAuthorized } from 'hooks/notifications/useIsAuthorized' import { useCookies } from 'hooks/notifications/useCookies' import { useNotificationSocket } from 'hooks/notifications/useNotificationSocket' import { formatNumericValue } from 'utils/numbers' const NotificationsButton = () => { useCookies() useNotificationSocket() const { data, isFetching } = useNotifications() const isAuth = useIsAuthorized() const [showDraw, setShowDraw] = useState(false) const notificationCount = useMemo(() => { if (!isAuth && !isFetching) { return 1 } else if (!data || !data.length) { return 0 } else return data.filter((x) => !x.seen).length }, [data, isAuth, isFetching]) const toggleModal = () => { setShowDraw(!showDraw) } return ( <> ) } export default NotificationsButton