// @flow import * as PAGES from 'constants/pages'; import * as ICONS from 'constants/icons'; import React from 'react'; import Icon from 'component/common/icon'; import Notification from 'component/notification'; import Button from 'component/button'; import { useHistory } from 'react-router'; // import { Menu, MenuList, MenuButton, MenuPopover, MenuItems, MenuItem } from '@reach/menu-button'; type Props = { unreadCount: number, fetching: boolean, notifications: ?Array, doReadNotifications: () => void, user: ?User, }; export default function NotificationHeaderButton(props: Props) { const { unreadCount, // notifications, fetching, doReadNotifications, user, } = props; const notificationsEnabled = user && user.experimental_ui; const { push } = useHistory(); function handleMenuClick() { if (unreadCount > 0) { doReadNotifications(); } push(`/$/${PAGES.NOTIFICATIONS}`); } if (!notificationsEnabled) { return null; } return ( ); // Below is disabled until scroll style issues are resolved // return ( // // // // {unreadCount > 0 && {unreadCount}} // // {notifications && notifications.length > 0 ? ( // // {notifications.slice(0, 7).map((notification, index) => ( // // ))} // push(`/$/${PAGES.NOTIFICATIONS}`)}> // // {__('View All')} // // // ) : ( // //
No notifications yet.
// {/* Below is needed because MenuPopover isn't meant to be used this way */} // // {}} /> // //
// )} //
// ); }