import React from 'react'; import { FiBell, FiX } from 'react-icons/fi'; import { shift, useFloating } from '@floating-ui/react-dom'; import { Popover } from '@headlessui/react'; import { useAppSelector } from '@hooks/useAppSelector'; import { Button, IconButton } from '@meshtastic/components'; export const Notifications = (): JSX.Element => { const [unreadCount, setUnreadCount] = React.useState(0); const notifications = useAppSelector((state) => state.app.notifications); const { x, y, reference, floating, strategy } = useFloating({ placement: 'bottom', middleware: [shift()], }); React.useEffect(() => { setUnreadCount( notifications.filter((notification) => !notification.read).length, ); }, [notifications]); return ( } /> {unreadCount > 0 && (
{unreadCount}
)}
{notifications.map((notification, index) => (
{notification.icon}
{notification.title}
{notification.action ? (
) : (
)} } />
))}
); };