import React from 'react'; import { FormattedMessage } from 'react-intl'; import ThumbNavigationLink from 'soapbox/components/thumb_navigation-link'; import { useAppSelector, useLogo, 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.items.reduce((acc, curr) => acc + Math.min(curr.unread || 0, 1), 0)); const features = getFeatures(useAppSelector((state) => state.instance)); const instance = useAppSelector((state) => state.instance); const logo = useLogo(); /** Conditionally render the supported messages link */ const renderMessagesLink = (): React.ReactNode => { if (features.chats) { return ( } to='/chats' exact count={chatsCount} /> ); } if (features.directTimeline || features.conversations) { return ( } to='/messages' paths={['/messages', '/conversations']} /> ); } return null; }; return (
} to='/' exact /> { features.federating ? ( ) : ( } to='/timeline/local' exact /> ) } { features.federating && ( } to='/timeline/fediverse' exact /> ) } {account && renderMessagesLink()} {account && ( } to='/notifications' exact count={notificationCount} /> )}
); }; export default ThumbNavigation;