2022-03-21 11:09:01 -07:00
|
|
|
import * as React from 'react';
|
2022-01-10 14:17:52 -08:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-05-30 11:23:55 -07:00
|
|
|
import { Button, Card, CardBody, Stack, Text } from 'soapbox/components/ui';
|
2022-03-21 11:09:01 -07:00
|
|
|
import VerificationBadge from 'soapbox/components/verification_badge';
|
2022-04-05 12:38:49 -07:00
|
|
|
import RegistrationForm from 'soapbox/features/auth_login/components/registration_form';
|
2022-05-10 17:04:29 -07:00
|
|
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
2020-04-08 16:38:22 -07:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
const LandingPage = () => {
|
2022-05-10 17:04:29 -07:00
|
|
|
const features = useFeatures();
|
2022-05-10 16:48:57 -07:00
|
|
|
const soapboxConfig = useSoapboxConfig();
|
|
|
|
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
|
|
|
|
2022-04-05 12:38:49 -07:00
|
|
|
const instance = useAppSelector((state) => state.instance);
|
|
|
|
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
2021-09-24 09:43:28 -07:00
|
|
|
|
2022-04-05 12:38:49 -07:00
|
|
|
/** Registrations are closed */
|
2022-03-21 11:09:01 -07:00
|
|
|
const renderClosed = () => {
|
2021-09-24 09:43:28 -07:00
|
|
|
return (
|
2022-04-05 12:38:49 -07:00
|
|
|
<Stack space={3} data-testid='registrations-closed'>
|
2022-03-21 11:09:01 -07:00
|
|
|
<Text size='xl' weight='bold' align='center'>
|
2021-09-24 09:43:28 -07:00
|
|
|
<FormattedMessage
|
|
|
|
id='registration.closed_title'
|
|
|
|
defaultMessage='Registrations Closed'
|
|
|
|
/>
|
2022-03-21 11:09:01 -07:00
|
|
|
</Text>
|
|
|
|
<Text theme='muted' align='center'>
|
2021-09-24 09:43:28 -07:00
|
|
|
<FormattedMessage
|
|
|
|
id='registration.closed_message'
|
2022-03-21 11:09:01 -07:00
|
|
|
defaultMessage='{instance} is not accepting new members.'
|
2022-05-10 17:04:29 -07:00
|
|
|
values={{ instance: instance.title }}
|
2021-09-24 09:43:28 -07:00
|
|
|
/>
|
2022-03-21 11:09:01 -07:00
|
|
|
</Text>
|
|
|
|
</Stack>
|
2021-09-24 09:43:28 -07:00
|
|
|
);
|
2022-03-21 11:09:01 -07:00
|
|
|
};
|
2021-09-24 09:43:28 -07:00
|
|
|
|
2022-04-05 12:38:49 -07:00
|
|
|
/** Mastodon API registrations are open */
|
|
|
|
const renderOpen = () => {
|
|
|
|
return <RegistrationForm />;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Pepe API registrations are open */
|
|
|
|
const renderPepe = () => {
|
|
|
|
return (
|
|
|
|
<Stack space={3} data-testid='registrations-pepe'>
|
|
|
|
<VerificationBadge className='h-16 w-16 mx-auto' />
|
|
|
|
|
|
|
|
<Stack>
|
|
|
|
<Text size='2xl' weight='bold' align='center'>Let's get started!</Text>
|
|
|
|
<Text theme='muted' align='center'>Social Media Without Discrimination</Text>
|
|
|
|
</Stack>
|
|
|
|
|
2022-04-30 09:28:18 -07:00
|
|
|
<Button to='/verify' theme='primary' block>Create an account</Button>
|
2022-04-05 12:38:49 -07:00
|
|
|
</Stack>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Render registration flow depending on features
|
|
|
|
const renderBody = () => {
|
2022-05-10 16:48:57 -07:00
|
|
|
if (pepeEnabled && pepeOpen) {
|
2022-04-05 12:38:49 -07:00
|
|
|
return renderPepe();
|
2022-05-10 17:04:29 -07:00
|
|
|
} else if (features.accountCreation && instance.registrations) {
|
2022-04-05 12:38:49 -07:00
|
|
|
return renderOpen();
|
|
|
|
} else {
|
|
|
|
return renderClosed();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
return (
|
2022-04-21 12:29:25 -07:00
|
|
|
<main className='mt-16 sm:mt-24' data-testid='homepage'>
|
2022-03-21 11:09:01 -07:00
|
|
|
<div className='mx-auto max-w-7xl'>
|
2022-05-10 12:52:12 -07:00
|
|
|
<div className='grid grid-cols-1 lg:grid-cols-12 gap-8 py-12'>
|
2022-04-19 15:27:23 -07:00
|
|
|
<div className='px-4 sm:px-6 sm:text-center md:max-w-2xl md:mx-auto lg:col-span-6 lg:text-left lg:flex'>
|
2022-05-27 17:50:51 -07:00
|
|
|
<div className='w-full'>
|
2022-03-21 11:09:01 -07:00
|
|
|
<Stack space={3}>
|
2022-05-27 17:50:51 -07:00
|
|
|
<h1 className='text-5xl font-extrabold text-transparent text-ellipsis overflow-hidden bg-clip-text bg-gradient-to-br from-accent-500 via-primary-500 to-gradient-end sm:mt-5 sm:leading-none lg:mt-6 lg:text-6xl xl:text-7xl'>
|
2022-03-21 11:45:57 -07:00
|
|
|
{instance.title}
|
2022-03-21 11:09:01 -07:00
|
|
|
</h1>
|
2022-05-10 12:52:12 -07:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
<Text size='lg'>
|
2022-03-21 11:45:57 -07:00
|
|
|
{instance.description}
|
2022-03-21 11:09:01 -07:00
|
|
|
</Text>
|
|
|
|
</Stack>
|
2020-04-10 13:24:12 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-06 18:07:40 -07:00
|
|
|
<div className='sm:mt-24 lg:mt-0 lg:col-span-6 self-center'>
|
2022-03-21 11:09:01 -07:00
|
|
|
<Card size='xl' variant='rounded' className='sm:max-w-md sm:w-full sm:mx-auto'>
|
|
|
|
<CardBody>
|
2022-04-05 12:38:49 -07:00
|
|
|
{renderBody()}
|
2022-03-21 11:09:01 -07:00
|
|
|
</CardBody>
|
|
|
|
</Card>
|
2020-04-10 13:24:12 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-21 11:09:01 -07:00
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
};
|
2020-04-08 16:38:22 -07:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
export default LandingPage;
|