maybe add some links to sidebar menu
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
be0136b835
commit
1ef6c55d44
1 changed files with 47 additions and 3 deletions
|
@ -6,13 +6,14 @@ import { Link, NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
||||||
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
||||||
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
|
import { closeSidebar } from 'soapbox/actions/sidebar';
|
||||||
import Account from 'soapbox/components/account';
|
import Account from 'soapbox/components/account';
|
||||||
import { Stack } from 'soapbox/components/ui';
|
import { Stack } from 'soapbox/components/ui';
|
||||||
import ProfileStats from 'soapbox/features/ui/components/profile_stats';
|
import ProfileStats from 'soapbox/features/ui/components/profile_stats';
|
||||||
import { useAppSelector, useSoapboxConfig, useFeatures } from 'soapbox/hooks';
|
import { useAppSelector, useSoapboxConfig, useFeatures } from 'soapbox/hooks';
|
||||||
|
import { makeGetAccount, makeGetOtherAccounts } from 'soapbox/selectors';
|
||||||
import { closeSidebar } from '../actions/sidebar';
|
import { getBaseURL } from 'soapbox/utils/accounts';
|
||||||
import { makeGetAccount, makeGetOtherAccounts } from '../selectors';
|
|
||||||
|
|
||||||
import { HStack, Icon, IconButton, Text } from './ui';
|
import { HStack, Icon, IconButton, Text } from './ui';
|
||||||
|
|
||||||
|
@ -32,6 +33,10 @@ const messages = defineMessages({
|
||||||
importData: { id: 'navigation_bar.import_data', defaultMessage: 'Import data' },
|
importData: { id: 'navigation_bar.import_data', defaultMessage: 'Import data' },
|
||||||
accountMigration: { id: 'navigation_bar.account_migration', defaultMessage: 'Move account' },
|
accountMigration: { id: 'navigation_bar.account_migration', defaultMessage: 'Move account' },
|
||||||
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
||||||
|
bookmarks: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' },
|
||||||
|
lists: { id: 'column.lists', defaultMessage: 'Lists' },
|
||||||
|
invites: { id: 'navigation_bar.invites', defaultMessage: 'Invites' },
|
||||||
|
developers: { id: 'navigation.developers', defaultMessage: 'Developers' },
|
||||||
});
|
});
|
||||||
|
|
||||||
interface ISidebarLink {
|
interface ISidebarLink {
|
||||||
|
@ -67,6 +72,9 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
const account = useAppSelector((state) => me ? getAccount(state, me) : null);
|
const account = useAppSelector((state) => me ? getAccount(state, me) : null);
|
||||||
const otherAccounts: ImmutableList<AccountEntity> = useAppSelector((state) => getOtherAccounts(state));
|
const otherAccounts: ImmutableList<AccountEntity> = useAppSelector((state) => getOtherAccounts(state));
|
||||||
const sidebarOpen = useAppSelector((state) => state.sidebar.sidebarOpen);
|
const sidebarOpen = useAppSelector((state) => state.sidebar.sidebarOpen);
|
||||||
|
const settings = useAppSelector((state) => getSettings(state));
|
||||||
|
|
||||||
|
const baseURL = account ? getBaseURL(account) : '';
|
||||||
|
|
||||||
const closeButtonRef = React.useRef(null);
|
const closeButtonRef = React.useRef(null);
|
||||||
|
|
||||||
|
@ -192,6 +200,42 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{features.bookmarks && (
|
||||||
|
<SidebarLink
|
||||||
|
to='/bookmarks'
|
||||||
|
icon={require('@tabler/icons/icons/bookmark.svg')}
|
||||||
|
text={intl.formatMessage(messages.bookmarks)}
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{features.lists && (
|
||||||
|
<SidebarLink
|
||||||
|
to='/lists'
|
||||||
|
icon={require('@tabler/icons/icons/list.svg')}
|
||||||
|
text={intl.formatMessage(messages.lists)}
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{instance.invites_enabled && (
|
||||||
|
<SidebarLink
|
||||||
|
to={`${baseURL}/invites`}
|
||||||
|
icon={require('@tabler/icons/icons/mailbox.svg')}
|
||||||
|
text={intl.formatMessage(messages.invites)}
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{settings.get('isDeveloper') && (
|
||||||
|
<SidebarLink
|
||||||
|
to='/developers'
|
||||||
|
icon={require('@tabler/icons/icons/code.svg')}
|
||||||
|
text={intl.formatMessage(messages.developers)}
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{features.publicTimeline && <>
|
{features.publicTimeline && <>
|
||||||
<hr className='dark:border-slate-700' />
|
<hr className='dark:border-slate-700' />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue