Add Groups to Thumb Navigation

This commit is contained in:
Chewbacca 2023-06-14 08:05:25 -04:00
parent bfaea4c356
commit e3f92eadac

View file

@ -3,15 +3,17 @@ import { FormattedMessage } from 'react-intl';
import ThumbNavigationLink from 'soapbox/components/thumb-navigation-link'; import ThumbNavigationLink from 'soapbox/components/thumb-navigation-link';
import { useStatContext } from 'soapbox/contexts/stat-context'; import { useStatContext } from 'soapbox/contexts/stat-context';
import { useAppSelector, useFeatures, useOwnAccount } from 'soapbox/hooks'; import { useAppSelector, useFeatures, useGroupsPath, useOwnAccount } from 'soapbox/hooks';
const ThumbNavigation: React.FC = (): JSX.Element => { const ThumbNavigation: React.FC = (): JSX.Element => {
const account = useOwnAccount(); const account = useOwnAccount();
const features = useFeatures();
const groupsPath = useGroupsPath();
const { unreadChatsCount } = useStatContext(); const { unreadChatsCount } = useStatContext();
const notificationCount = useAppSelector((state) => state.notifications.unread); const notificationCount = useAppSelector((state) => state.notifications.unread);
const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count());
const features = useFeatures();
/** Conditionally render the supported messages link */ /** Conditionally render the supported messages link */
const renderMessagesLink = (): React.ReactNode => { const renderMessagesLink = (): React.ReactNode => {
@ -51,6 +53,15 @@ const ThumbNavigation: React.FC = (): JSX.Element => {
exact exact
/> />
{features.groups && (
<ThumbNavigationLink
src={require('@tabler/icons/circles.svg')}
text={<FormattedMessage id='tabs_bar.groups' defaultMessage='Groups' />}
to={groupsPath}
exact
/>
)}
<ThumbNavigationLink <ThumbNavigationLink
src={require('@tabler/icons/search.svg')} src={require('@tabler/icons/search.svg')}
text={<FormattedMessage id='navigation.search' defaultMessage='Search' />} text={<FormattedMessage id='navigation.search' defaultMessage='Search' />}