import React, { Fragment } from "react"; // hooks import useTheme from "hooks/use-theme"; import { Popover, Transition } from "@headlessui/react"; // hooks import useUserNotification from "hooks/use-user-notifications"; // components import { Loader, EmptyState, Tooltip } from "components/ui"; import { SnoozeNotificationModal, NotificationCard, NotificationHeader, } from "components/notifications"; // icons import { NotificationsOutlined } from "@mui/icons-material"; // images import emptyNotification from "public/empty-state/notification.svg"; // helpers import { getNumberCount } from "helpers/string.helper"; export const NotificationPopover = () => { const { notifications, archived, readNotification, selectedNotificationForSnooze, selectedTab, setArchived, setReadNotification, setSelectedNotificationForSnooze, setSelectedTab, setSnoozed, snoozed, notificationMutate, markNotificationArchivedStatus, markNotificationReadStatus, markSnoozeNotification, notificationCount, totalNotificationCount, setSize, isLoadingMore, hasMore, isRefreshing, } = useUserNotification(); // theme context const { collapsed: sidebarCollapse } = useTheme(); return ( <> setSelectedNotificationForSnooze(null)} onSubmit={markSnoozeNotification} notification={ notifications?.find( (notification) => notification.id === selectedNotificationForSnooze ) || null } onSuccess={() => { setSelectedNotificationForSnooze(null); }} /> {({ open: isActive, close: closePopover }) => ( <> {sidebarCollapse ? null : Notifications} {totalNotificationCount && totalNotificationCount > 0 ? ( {getNumberCount(totalNotificationCount)} ) : null} {notifications ? ( notifications.length > 0 ? (
{notifications.map((notification) => ( ))}
{isLoadingMore && (
Loading...

Loading notifications

)} {hasMore && !isLoadingMore && ( )}
) : (
) ) : ( )}
)}
); };