SidebarNavigation: Do not show Bookmarks/Lists links if unauthenticated

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-04-20 19:25:07 +02:00
parent ab5b8f747e
commit 5cecb2ef9e
1 changed files with 50 additions and 48 deletions

View File

@ -28,60 +28,62 @@ const SidebarNavigation = () => {
const makeMenu = (): Menu => { const makeMenu = (): Menu => {
const menu: Menu = []; const menu: Menu = [];
if (account?.locked || followRequestsCount > 0) { if (account) {
menu.push({ if (account.locked || followRequestsCount > 0) {
to: '/follow_requests', menu.push({
text: <FormattedMessage id='navigation_bar.follow_requests' defaultMessage='Follow requests' />, to: '/follow_requests',
icon: require('@tabler/icons/icons/user-plus.svg'), text: <FormattedMessage id='navigation_bar.follow_requests' defaultMessage='Follow requests' />,
// TODO: let menu items have a counter icon: require('@tabler/icons/icons/user-plus.svg'),
// count: followRequestsCount, // TODO: let menu items have a counter
}); // count: followRequestsCount,
} });
}
if (features.bookmarks) { if (features.bookmarks) {
menu.push({ menu.push({
to: '/bookmarks', to: '/bookmarks',
text: <FormattedMessage id='column.bookmarks' defaultMessage='Bookmarks' />, text: <FormattedMessage id='column.bookmarks' defaultMessage='Bookmarks' />,
icon: require('@tabler/icons/icons/bookmark.svg'), icon: require('@tabler/icons/icons/bookmark.svg'),
}); });
} }
if (features.lists) { if (features.lists) {
menu.push({ menu.push({
to: '/lists', to: '/lists',
text: <FormattedMessage id='column.lists' defaultMessage='Lists' />, text: <FormattedMessage id='column.lists' defaultMessage='Lists' />,
icon: require('@tabler/icons/icons/list.svg'), icon: require('@tabler/icons/icons/list.svg'),
}); });
} }
if (account && instance.invites_enabled) { if (instance.invites_enabled) {
menu.push({ menu.push({
to: `${baseURL}/invites`, to: `${baseURL}/invites`,
icon: require('@tabler/icons/icons/mailbox.svg'), icon: require('@tabler/icons/icons/mailbox.svg'),
text: <FormattedMessage id='navigation.invites' defaultMessage='Invites' />, text: <FormattedMessage id='navigation.invites' defaultMessage='Invites' />,
}); });
} }
if (settings.get('isDeveloper')) { if (settings.get('isDeveloper')) {
menu.push({ menu.push({
to: '/developers', to: '/developers',
icon: require('@tabler/icons/icons/code.svg'), icon: require('@tabler/icons/icons/code.svg'),
text: <FormattedMessage id='navigation.developers' defaultMessage='Developers' />, text: <FormattedMessage id='navigation.developers' defaultMessage='Developers' />,
}); });
} }
if (account && account.staff) { if (account.staff) {
menu.push({ menu.push({
to: '/admin', to: '/admin',
icon: require('@tabler/icons/icons/dashboard.svg'), icon: require('@tabler/icons/icons/dashboard.svg'),
text: <FormattedMessage id='tabs_bar.dashboard' defaultMessage='Dashboard' />, text: <FormattedMessage id='tabs_bar.dashboard' defaultMessage='Dashboard' />,
// TODO: let menu items have a counter // TODO: let menu items have a counter
// count: dashboardCount, // count: dashboardCount,
}); });
} }
if (features.localTimeline || features.publicTimeline) { if (features.localTimeline || features.publicTimeline) {
menu.push(null); menu.push(null);
}
} }
if (features.localTimeline) { if (features.localTimeline) {