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:
marcin mikołajczak 2024-09-12 19:14:20 +02:00
parent e0f55173f5
commit d5737bd6de
2 changed files with 7 additions and 7 deletions

View file

@ -11,10 +11,9 @@ import { useAccount } from 'pl-fe/api/hooks';
import Account from 'pl-fe/components/account';
import { Stack, Divider, HStack, Icon, Text } from 'pl-fe/components/ui';
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 sourceCode from 'pl-fe/utils/code';
import { isStandalone } from 'pl-fe/utils/state';
import type { List as ImmutableList } from 'immutable';
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 touchStart = useRef(0);
const touchEnd = useRef<number | null>(null);
const standalone = useAppSelector(isStandalone);
const { isOpen } = useRegistrationStatus();
const instance = useInstance();
const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated;
@ -451,7 +450,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
onClick={onClose}
/>
{!standalone && (
{isOpen && (
<SidebarLink
to='/signup'
icon={require('@tabler/icons/outline/user-plus.svg')}

View file

@ -6,7 +6,7 @@ import { useStatContext } from 'pl-fe/contexts/stat-context';
import Search from 'pl-fe/features/search/components/search';
import ComposeButton from 'pl-fe/features/ui/components/compose-button';
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 DropdownMenu, { Menu } from './dropdown-menu';
@ -34,6 +34,7 @@ const SidebarNavigation = () => {
const features = useFeatures();
const { isDeveloper } = useSettings();
const { account } = useOwnAccount();
const { isOpen } = useRegistrationStatus();
const notificationCount = useAppSelector((state) => state.notifications.unread);
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' />}
/>
<SidebarNavigationLink
{isOpen && <SidebarNavigationLink
to='/signup'
icon={require('@tabler/icons/outline/user-plus.svg')}
text={<FormattedMessage id='account.register' defaultMessage='Sign up' />}
/>
/>}
</Stack>
)}
</Stack>