public_layout/header: pepe feature detection

This commit is contained in:
Alex Gleason 2022-04-19 18:42:28 -05:00
parent b72f398bad
commit f4d2b70077
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import { Link, Redirect } from 'react-router-dom';
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
import { fetchInstance } from 'soapbox/actions/instance';
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
import { openModal } from '../../../actions/modals';
import { Button, Form, HStack, IconButton, Input, Tooltip } from '../../../components/ui';
@ -28,8 +28,10 @@ const Header = () => {
const intl = useIntl();
const { logo } = useSoapboxConfig();
const features = useFeatures();
const instance = useAppSelector((state) => state.instance);
const isOpen = instance.get('registrations', false) === true;
const isOpen = instance.get('registrations', false) === true;
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
const [isLoading, setLoading] = React.useState(false);
const [username, setUsername] = React.useState('');
@ -92,9 +94,9 @@ const Header = () => {
{intl.formatMessage(messages.login)}
</Button>
{isOpen && (
{(isOpen || features.pepe && pepeOpen) && (
<Button
to='/auth/verify'
to={features.pepe ? '/auth/verify' : '/signup'} // FIXME: actually route this somewhere
theme='primary'
>
{intl.formatMessage(messages.register)}