Link to source code in sidebar
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
27c836cf73
commit
0b231ad38a
4 changed files with 40 additions and 9 deletions
|
@ -13,10 +13,13 @@ import { Stack, Divider, HStack, Icon, Text } from 'soapbox/components/ui';
|
|||
import ProfileStats from 'soapbox/features/ui/components/profile-stats';
|
||||
import { useAppDispatch, useAppSelector, useFeatures, useInstance } from 'soapbox/hooks';
|
||||
import { makeGetOtherAccounts } from 'soapbox/selectors';
|
||||
import sourceCode from 'soapbox/utils/code';
|
||||
import { isStandalone } from 'soapbox/utils/state';
|
||||
|
||||
import type { List as ImmutableList } from 'immutable';
|
||||
import type { Account as AccountEntity } from 'soapbox/normalizers';
|
||||
|
||||
|
||||
const messages = defineMessages({
|
||||
profile: { id: 'account.profile', defaultMessage: 'Profile' },
|
||||
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
|
||||
|
@ -36,6 +39,7 @@ const messages = defineMessages({
|
|||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
login: { id: 'account.login', defaultMessage: 'Log in' },
|
||||
register: { id: 'account.register', defaultMessage: 'Sign up' },
|
||||
sourceCode: { id: 'navigation.source_code', defaultMessage: 'Source code' },
|
||||
});
|
||||
|
||||
interface ISidebarLink {
|
||||
|
@ -90,6 +94,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
|||
const [sidebarVisible, setSidebarVisible] = useState(sidebarOpen);
|
||||
const touchStart = useRef(0);
|
||||
const touchEnd = useRef<number | null>(null);
|
||||
const standalone = useAppSelector(isStandalone);
|
||||
|
||||
const instance = useInstance();
|
||||
const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated;
|
||||
|
@ -361,6 +366,15 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
|||
|
||||
<Divider />
|
||||
|
||||
<SidebarLink
|
||||
href={sourceCode.url}
|
||||
icon={require('@tabler/icons/outline/code.svg')}
|
||||
text={intl.formatMessage(messages.sourceCode)}
|
||||
onClick={onClose}
|
||||
/>
|
||||
|
||||
<Divider />
|
||||
|
||||
<Stack space={4}>
|
||||
<button type='button' onClick={handleSwitcherClick} className='py-1'>
|
||||
<HStack alignItems='center' justifyContent='between'>
|
||||
|
@ -428,10 +442,21 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
|||
onClick={onClose}
|
||||
/>
|
||||
|
||||
{!standalone && (
|
||||
<SidebarLink
|
||||
to='/signup'
|
||||
icon={require('@tabler/icons/outline/user-plus.svg')}
|
||||
text={intl.formatMessage(messages.register)}
|
||||
onClick={onClose}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Divider />
|
||||
|
||||
<SidebarLink
|
||||
to='/signup'
|
||||
icon={require('@tabler/icons/outline/user-plus.svg')}
|
||||
text={intl.formatMessage(messages.register)}
|
||||
href={sourceCode.url}
|
||||
icon={require('@tabler/icons/outline/code.svg')}
|
||||
text={intl.formatMessage(messages.sourceCode)}
|
||||
onClick={onClose}
|
||||
/>
|
||||
</Stack>
|
||||
|
|
|
@ -9,6 +9,7 @@ import ThumbNavigationLink from 'soapbox/components/thumb-navigation-link';
|
|||
import { useStatContext } from 'soapbox/contexts/stat-context';
|
||||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
||||
import { isStandalone } from 'soapbox/utils/state';
|
||||
|
||||
import { Icon } from './ui';
|
||||
|
||||
|
@ -21,6 +22,7 @@ const ThumbNavigation: React.FC = (): JSX.Element => {
|
|||
|
||||
const { unreadChatsCount } = useStatContext();
|
||||
|
||||
const standalone = useAppSelector(isStandalone);
|
||||
const notificationCount = useAppSelector((state) => state.notifications.unread);
|
||||
|
||||
const handleOpenSidebar = () => dispatch(openSidebar());
|
||||
|
@ -103,12 +105,14 @@ const ThumbNavigation: React.FC = (): JSX.Element => {
|
|||
|
||||
{account && !(features.chats || features.conversations) && composeButton}
|
||||
|
||||
<ThumbNavigationLink
|
||||
src={require('@tabler/icons/outline/search.svg')}
|
||||
text={<FormattedMessage id='navigation.search' defaultMessage='Search' />}
|
||||
to='/search'
|
||||
exact
|
||||
/>
|
||||
{(!standalone || account) && (
|
||||
<ThumbNavigationLink
|
||||
src={require('@tabler/icons/outline/search.svg')}
|
||||
text={<FormattedMessage id='navigation.search' defaultMessage='Search' />}
|
||||
to='/search'
|
||||
exact
|
||||
/>
|
||||
)}
|
||||
|
||||
{account && (
|
||||
<ThumbNavigationLink
|
||||
|
|
|
@ -1072,6 +1072,7 @@
|
|||
"navigation.home": "Home",
|
||||
"navigation.notifications": "Notifications",
|
||||
"navigation.search": "Search",
|
||||
"navigation.source_code": "Source code",
|
||||
"navigation_bar.account_aliases": "Account aliases",
|
||||
"navigation_bar.blocks": "Blocks",
|
||||
"navigation_bar.compose": "Compose a post",
|
||||
|
|
|
@ -1072,6 +1072,7 @@
|
|||
"navigation.home": "Główna",
|
||||
"navigation.notifications": "Powiadomienia",
|
||||
"navigation.search": "Szukaj",
|
||||
"navigation.source_code": "Kod źródłowy",
|
||||
"navigation_bar.account_aliases": "Aliasy konta",
|
||||
"navigation_bar.blocks": "Zablokowani użytkownicy",
|
||||
"navigation_bar.compose": "Utwórz nowy wpis",
|
||||
|
|
Loading…
Reference in a new issue