parent
8fd271fb6f
commit
88f2479b7e
|
@ -4,7 +4,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|||
import { Stack } from 'soapbox/components/ui';
|
||||
import { useStatContext } from 'soapbox/contexts/stat-context';
|
||||
import ComposeButton from 'soapbox/features/ui/components/compose-button';
|
||||
import { useAppSelector, useGroupsPath, useFeatures, useOwnAccount, useSettings } from 'soapbox/hooks';
|
||||
import { useAppSelector, useGroupsPath, useFeatures, useOwnAccount, useSettings, useInstance } from 'soapbox/hooks';
|
||||
|
||||
import DropdownMenu, { Menu } from './dropdown-menu';
|
||||
import SidebarNavigationLink from './sidebar-navigation-link';
|
||||
|
@ -15,14 +15,6 @@ const messages = defineMessages({
|
|||
lists: { id: 'column.lists', defaultMessage: 'Lists' },
|
||||
events: { id: 'column.events', defaultMessage: 'Events' },
|
||||
developers: { id: 'navigation.developers', defaultMessage: 'Developers' },
|
||||
profile_directory: { id: 'navigation_bar.profile_directory', defaultMessage: 'Profile Directory' },
|
||||
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocks' },
|
||||
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Mutes' },
|
||||
filters: { id: 'navigation_bar.filters', defaultMessage: 'Filters' },
|
||||
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Domain blocks' },
|
||||
import_data: { id: 'navigation_bar.import_data', defaultMessage: 'Import' },
|
||||
config: { id: 'navigation_bar.soapbox_config', defaultMessage: 'Config' },
|
||||
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
||||
});
|
||||
|
||||
/** Desktop sidebar with links to different views in the app. */
|
||||
|
@ -46,13 +38,6 @@ const SidebarNavigation = () => {
|
|||
const menu: Menu = [];
|
||||
|
||||
if (account) {
|
||||
|
||||
menu.push({
|
||||
to: '/directory',
|
||||
text: intl.formatMessage(messages.profile_directory),
|
||||
icon: require('@tabler/icons/users.svg'),
|
||||
});
|
||||
|
||||
if (account.locked || followRequestsCount > 0) {
|
||||
menu.push({
|
||||
to: '/follow_requests',
|
||||
|
@ -86,50 +71,6 @@ const SidebarNavigation = () => {
|
|||
});
|
||||
}
|
||||
|
||||
menu.push({
|
||||
to: '/blocks',
|
||||
text: intl.formatMessage(messages.blocks),
|
||||
icon: require('@tabler/icons/ban.svg'),
|
||||
});
|
||||
|
||||
menu.push({
|
||||
to: '/mutes',
|
||||
text: intl.formatMessage(messages.mutes),
|
||||
icon: require('@tabler/icons/circle-x.svg'),
|
||||
});
|
||||
|
||||
if (features.filters) {
|
||||
menu.push({
|
||||
to: '/filters',
|
||||
text: intl.formatMessage(messages.filters),
|
||||
icon: require('@tabler/icons/filter.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (features.federating) {
|
||||
menu.push({
|
||||
to: '/domain_blocks',
|
||||
text: intl.formatMessage(messages.domain_blocks),
|
||||
icon: require('@tabler/icons/circle-off.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (account.admin) {
|
||||
menu.push({
|
||||
to: '/soapbox/config',
|
||||
text: intl.formatMessage(messages.config),
|
||||
icon: require('@tabler/icons/components.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (features.import) {
|
||||
menu.push({
|
||||
to: '/settings/import',
|
||||
text: intl.formatMessage(messages.import_data),
|
||||
icon: require('@tabler/icons/cloud-upload.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.get('isDeveloper')) {
|
||||
menu.push({
|
||||
to: '/developers',
|
||||
|
@ -137,11 +78,6 @@ const SidebarNavigation = () => {
|
|||
text: intl.formatMessage(messages.developers),
|
||||
});
|
||||
}
|
||||
menu.push({
|
||||
to: '/logout',
|
||||
text: intl.formatMessage(messages.logout),
|
||||
icon: require('@tabler/icons/logout.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
return menu;
|
||||
|
@ -163,14 +99,15 @@ menu.push({
|
|||
);
|
||||
}
|
||||
|
||||
if (account) {
|
||||
menu.push({
|
||||
to: '/timeline/local',
|
||||
text: 'Local',
|
||||
icon: require('@tabler/icons/affiliate.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (features.directTimeline || features.conversations) {
|
||||
return (
|
||||
<SidebarNavigationLink
|
||||
to='/messages'
|
||||
icon={require('@tabler/icons/mail.svg')}
|
||||
text={<FormattedMessage id='navigation.direct_messages' defaultMessage='Messages' />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
@ -184,25 +121,6 @@ menu.push({
|
|||
text={<FormattedMessage id='tabs_bar.home' defaultMessage='Home' />}
|
||||
/>
|
||||
|
||||
{features.publicTimeline && (
|
||||
<>
|
||||
{features.federating && (
|
||||
<SidebarNavigationLink
|
||||
to='/timeline/local'
|
||||
icon={require('@tabler/icons/affiliate.svg')}
|
||||
text={<FormattedMessage id='tabs_bar.local' defaultMessage='For you' />}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{features.federating && (
|
||||
<SidebarNavigationLink
|
||||
to='/timeline/fediverse'
|
||||
icon={require('@tabler/icons/topology-star-ring-3.svg')}
|
||||
text={<FormattedMessage id='tabs_bar.fediverse' defaultMessage='Fediverse' />}
|
||||
/>
|
||||
)}
|
||||
<SidebarNavigationLink
|
||||
to='/search'
|
||||
icon={require('@tabler/icons/search.svg')}
|
||||
|
@ -218,19 +136,7 @@ menu.push({
|
|||
text={<FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' />}
|
||||
/>
|
||||
|
||||
<SidebarNavigationLink
|
||||
to='/chats'
|
||||
icon={require('@tabler/icons/messages.svg')}
|
||||
count={unreadChatsCount}
|
||||
countMax={9}
|
||||
text={<FormattedMessage id='navigation.chats' defaultMessage='Chats' />}
|
||||
/>
|
||||
|
||||
<SidebarNavigationLink
|
||||
to='/messages'
|
||||
icon={require('@tabler/icons/mail.svg')}
|
||||
text={<FormattedMessage id='navigation.direct_messages' defaultMessage='Messages' />}
|
||||
/>
|
||||
{renderMessagesLink()}
|
||||
|
||||
{features.groups && (
|
||||
<SidebarNavigationLink
|
||||
|
@ -263,6 +169,26 @@ menu.push({
|
|||
</>
|
||||
)}
|
||||
|
||||
{(features.publicTimeline) && (
|
||||
<>
|
||||
{(account || !restrictUnauth.timelines.local) && (
|
||||
<SidebarNavigationLink
|
||||
to='/timeline/local'
|
||||
icon={features.federating ? require('@tabler/icons/affiliate.svg') : require('@tabler/icons/world.svg')}
|
||||
text={features.federating ? <FormattedMessage id='tabs_bar.local' defaultMessage='Local' /> : <FormattedMessage id='tabs_bar.all' defaultMessage='All' />}
|
||||
/>
|
||||
)}
|
||||
|
||||
{(features.federating && (account || !restrictUnauth.timelines.federated)) && (
|
||||
<SidebarNavigationLink
|
||||
to='/timeline/fediverse'
|
||||
icon={require('@tabler/icons/topology-star-ring-3.svg')}
|
||||
text={<FormattedMessage id='tabs_bar.fediverse' defaultMessage='Fediverse' />}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{menu.length > 0 && (
|
||||
<DropdownMenu items={menu} placement='top'>
|
||||
<SidebarNavigationLink
|
||||
|
|
Loading…
Reference in a new issue