pl-fe: only display sign up link when registration is available
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e0f55173f5
commit
d5737bd6de
2 changed files with 7 additions and 7 deletions
|
@ -11,10 +11,9 @@ import { useAccount } from 'pl-fe/api/hooks';
|
||||||
import Account from 'pl-fe/components/account';
|
import Account from 'pl-fe/components/account';
|
||||||
import { Stack, Divider, HStack, Icon, Text } from 'pl-fe/components/ui';
|
import { Stack, Divider, HStack, Icon, Text } from 'pl-fe/components/ui';
|
||||||
import ProfileStats from 'pl-fe/features/ui/components/profile-stats';
|
import ProfileStats from 'pl-fe/features/ui/components/profile-stats';
|
||||||
import { useAppDispatch, useAppSelector, useFeatures, useInstance } from 'pl-fe/hooks';
|
import { useAppDispatch, useAppSelector, useFeatures, useInstance, useRegistrationStatus } from 'pl-fe/hooks';
|
||||||
import { makeGetOtherAccounts } from 'pl-fe/selectors';
|
import { makeGetOtherAccounts } from 'pl-fe/selectors';
|
||||||
import sourceCode from 'pl-fe/utils/code';
|
import sourceCode from 'pl-fe/utils/code';
|
||||||
import { isStandalone } from 'pl-fe/utils/state';
|
|
||||||
|
|
||||||
import type { List as ImmutableList } from 'immutable';
|
import type { List as ImmutableList } from 'immutable';
|
||||||
import type { Account as AccountEntity } from 'pl-fe/normalizers';
|
import type { Account as AccountEntity } from 'pl-fe/normalizers';
|
||||||
|
@ -94,7 +93,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
const [sidebarVisible, setSidebarVisible] = useState(sidebarOpen);
|
const [sidebarVisible, setSidebarVisible] = useState(sidebarOpen);
|
||||||
const touchStart = useRef(0);
|
const touchStart = useRef(0);
|
||||||
const touchEnd = useRef<number | null>(null);
|
const touchEnd = useRef<number | null>(null);
|
||||||
const standalone = useAppSelector(isStandalone);
|
const { isOpen } = useRegistrationStatus();
|
||||||
|
|
||||||
const instance = useInstance();
|
const instance = useInstance();
|
||||||
const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated;
|
const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated;
|
||||||
|
@ -451,7 +450,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!standalone && (
|
{isOpen && (
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to='/signup'
|
to='/signup'
|
||||||
icon={require('@tabler/icons/outline/user-plus.svg')}
|
icon={require('@tabler/icons/outline/user-plus.svg')}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useStatContext } from 'pl-fe/contexts/stat-context';
|
||||||
import Search from 'pl-fe/features/search/components/search';
|
import Search from 'pl-fe/features/search/components/search';
|
||||||
import ComposeButton from 'pl-fe/features/ui/components/compose-button';
|
import ComposeButton from 'pl-fe/features/ui/components/compose-button';
|
||||||
import ProfileDropdown from 'pl-fe/features/ui/components/profile-dropdown';
|
import ProfileDropdown from 'pl-fe/features/ui/components/profile-dropdown';
|
||||||
import { useAppSelector, useFeatures, useOwnAccount, useSettings, useInstance } from 'pl-fe/hooks';
|
import { useAppSelector, useFeatures, useOwnAccount, useSettings, useInstance, useRegistrationStatus } from 'pl-fe/hooks';
|
||||||
|
|
||||||
import Account from './account';
|
import Account from './account';
|
||||||
import DropdownMenu, { Menu } from './dropdown-menu';
|
import DropdownMenu, { Menu } from './dropdown-menu';
|
||||||
|
@ -34,6 +34,7 @@ const SidebarNavigation = () => {
|
||||||
const features = useFeatures();
|
const features = useFeatures();
|
||||||
const { isDeveloper } = useSettings();
|
const { isDeveloper } = useSettings();
|
||||||
const { account } = useOwnAccount();
|
const { account } = useOwnAccount();
|
||||||
|
const { isOpen } = useRegistrationStatus();
|
||||||
|
|
||||||
const notificationCount = useAppSelector((state) => state.notifications.unread);
|
const notificationCount = useAppSelector((state) => state.notifications.unread);
|
||||||
const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count());
|
const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count());
|
||||||
|
@ -280,11 +281,11 @@ const SidebarNavigation = () => {
|
||||||
text={<FormattedMessage id='account.login' defaultMessage='Log in' />}
|
text={<FormattedMessage id='account.login' defaultMessage='Log in' />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SidebarNavigationLink
|
{isOpen && <SidebarNavigationLink
|
||||||
to='/signup'
|
to='/signup'
|
||||||
icon={require('@tabler/icons/outline/user-plus.svg')}
|
icon={require('@tabler/icons/outline/user-plus.svg')}
|
||||||
text={<FormattedMessage id='account.register' defaultMessage='Sign up' />}
|
text={<FormattedMessage id='account.register' defaultMessage='Sign up' />}
|
||||||
/>
|
/>}
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
Loading…
Reference in a new issue