import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useRouteMatch } from 'react-router-dom';
import { groupComposeModal } from 'soapbox/actions/compose';
import { openModal } from 'soapbox/actions/modals';
import { openSidebar } from 'soapbox/actions/sidebar';
import ThumbNavigationLink from 'soapbox/components/thumb-navigation-link';
import { useStatContext } from 'soapbox/contexts/stat-context';
import { Entities } from 'soapbox/entity-store/entities';
import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount } from 'soapbox/hooks';
import { Icon } from './ui';
const ThumbNavigation: React.FC = (): JSX.Element => {
const dispatch = useAppDispatch();
const { account } = useOwnAccount();
const features = useFeatures();
const match = useRouteMatch<{ groupId: string }>('/groups/:groupId');
const { unreadChatsCount } = useStatContext();
const notificationCount = useAppSelector((state) => state.notifications.unread);
const handleOpenSidebar = () => dispatch(openSidebar());
const handleOpenComposeModal = () => {
if (match?.params.groupId) {
dispatch((_, getState) => {
const group = getState().entities[Entities.GROUPS]?.store[match.params.groupId];
if (group) dispatch(groupComposeModal(group));
});
} else {
dispatch(openModal('COMPOSE'));
}
};
/** Conditionally render the supported messages link */
const renderMessagesLink = (): React.ReactNode => {
if (features.chats) {
return (