import React from 'react'; import { FormattedMessage } from 'react-intl'; import ThumbNavigationLink from 'soapbox/components/thumb_navigation-link'; import { useAppSelector, useOwnAccount } from 'soapbox/hooks'; import { getFeatures } from 'soapbox/utils/features'; const ThumbNavigation: React.FC = (): JSX.Element => { const account = useOwnAccount(); const notificationCount = useAppSelector((state) => state.notifications.unread); const chatsCount = useAppSelector((state) => state.chats.get('items').reduce((acc: number, curr: any) => acc + Math.min(curr.get('unread', 0), 1), 0)); const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); const features = getFeatures(useAppSelector((state) => state.instance)); return (
} to='/' exact /> } to='/search' exact /> {account && ( } to='/notifications' exact count={notificationCount} /> )} {account && ( features.chats ? ( } to='/chats' exact count={chatsCount} /> ) : ( } to='/messages' paths={['/messages', '/conversations']} /> ) )} {(account && account.staff) && ( } to='/admin' count={dashboardCount} /> )}
); }; export default ThumbNavigation;