SidebarNavigation: move local and fediverse tabs to top-level

Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1091
This commit is contained in:
Alex Gleason 2022-11-25 14:38:09 -06:00
parent 25e7070705
commit c7e04a6826
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 19 additions and 23 deletions

View File

@ -10,7 +10,7 @@ interface ISidebarNavigationLink {
/** URL to an SVG icon. */ /** URL to an SVG icon. */
icon: string, icon: string,
/** Link label. */ /** Link label. */
text: React.ReactElement, text: React.ReactNode,
/** Route to an internal page. */ /** Route to an internal page. */
to?: string, to?: string,
/** Callback when the link is clicked. */ /** Callback when the link is clicked. */

View File

@ -16,8 +16,6 @@ const messages = defineMessages({
bookmarks: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' }, bookmarks: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' },
lists: { id: 'column.lists', defaultMessage: 'Lists' }, lists: { id: 'column.lists', defaultMessage: 'Lists' },
developers: { id: 'navigation.developers', defaultMessage: 'Developers' }, developers: { id: 'navigation.developers', defaultMessage: 'Developers' },
all: { id: 'tabs_bar.all', defaultMessage: 'All' },
fediverse: { id: 'tabs_bar.fediverse', defaultMessage: 'Fediverse' },
}); });
/** Desktop sidebar with links to different views in the app. */ /** Desktop sidebar with links to different views in the app. */
@ -70,26 +68,6 @@ const SidebarNavigation = () => {
text: intl.formatMessage(messages.developers), text: intl.formatMessage(messages.developers),
}); });
} }
if (features.publicTimeline) {
menu.push(null);
}
}
if (features.publicTimeline) {
menu.push({
to: '/timeline/local',
icon: features.federating ? require('@tabler/icons/users.svg') : require('@tabler/icons/world.svg'),
text: features.federating ? instance.title : intl.formatMessage(messages.all),
});
}
if (features.publicTimeline && features.federating) {
menu.push({
to: '/timeline/fediverse',
icon: require('assets/icons/fediverse.svg'),
text: intl.formatMessage(messages.fediverse),
});
} }
return menu; return menu;
@ -172,6 +150,24 @@ const SidebarNavigation = () => {
</> </>
)} )}
{features.publicTimeline && (
<>
<SidebarNavigationLink
to='/timeline/local'
icon={features.federating ? require('@tabler/icons/users.svg') : require('@tabler/icons/world.svg')}
text={features.federating ? instance.title : <FormattedMessage id='tabs_bar.all' defaultMessage='All' />}
/>
{features.federating && (
<SidebarNavigationLink
to='/timeline/fediverse'
icon={require('assets/icons/fediverse.svg')}
text={<FormattedMessage id='tabs_bar.fediverse' defaultMessage='Fediverse' />}
/>
)}
</>
)}
{menu.length > 0 && ( {menu.length > 0 && (
<DropdownMenu items={menu}> <DropdownMenu items={menu}>
<SidebarNavigationLink <SidebarNavigationLink