import React, { Fragment } from "react"; import Image from "next/image"; // hooks import useTheme from "hooks/use-theme"; import { Popover, Transition, Menu } from "@headlessui/react"; // hooks import useUserNotification from "hooks/use-user-notifications"; // components import { Spinner, Icon } from "components/ui"; import { SnoozeNotificationModal, NotificationCard } from "components/notifications"; // type import type { NotificationType } from "types"; const notificationTabs: Array<{ label: string; value: NotificationType; }> = [ { label: "My Issues", value: "assigned", }, { label: "Created by me", value: "created", }, { label: "Subscribed", value: "watching", }, ]; export const NotificationPopover = () => { const { notifications, archived, readNotification, selectedNotificationForSnooze, selectedTab, setArchived, setReadNotification, setSelectedNotificationForSnooze, setSelectedTab, setSnoozed, snoozed, notificationsMutate, markNotificationArchivedStatus, markNotificationReadStatus, markSnoozeNotification, } = useUserNotification(); // theme context const { collapsed: sidebarCollapse } = useTheme(); return ( <> setSelectedNotificationForSnooze(null)} onSubmit={markSnoozeNotification} notification={ notifications?.find( (notification) => notification.id === selectedNotificationForSnooze ) || null } onSuccess={() => { notificationsMutate(); setSelectedNotificationForSnooze(null); }} /> {({ open: isActive, close: closePopover }) => ( <> {sidebarCollapse ? null : Notifications}

Notifications

{snoozed || archived || readNotification ? (
) : (
)}
{notifications ? ( notifications.filter( (notification) => notification.data.issue_activity.field !== "None" ).length > 0 ? ( notifications.map((notification) => ( )) ) : (
Empty

You{"'"}re updated with all the notifications

You have read all the notifications.

) ) : (
)}
)}
); };