import Icon from "components/util/Icon"; import LinkButton from "components/util/LinkButton"; import { NotificationsContext } from "context/NotificationsContext"; import React, { useContext, useMemo } from "react"; import { Badge } from "react-bootstrap"; export function UserNotificationButton() { const { notifications } = useContext(NotificationsContext); const unread = useMemo(() => { if (!notifications) { return 0; } return notifications.filter((e) => e.read === false).length; }, [notifications]); return ( {unread > 0 ? ( <> {unread <= 9 ? unread : "9+"} ) : ( <> )} ); }