import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { prepareRequest } from 'soapbox/actions/consumer-auth';
import Markup from 'soapbox/components/markup';
import { Button, Card, CardBody, Stack, Text } from 'soapbox/components/ui';
import VerificationBadge from 'soapbox/components/verification-badge';
import RegistrationForm from 'soapbox/features/auth-login/components/registration-form';
import { useAppDispatch, useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
import { capitalize } from 'soapbox/utils/strings';
const LandingPage = () => {
const dispatch = useAppDispatch();
const features = useFeatures();
const soapboxConfig = useSoapboxConfig();
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
const instance = useAppSelector((state) => state.instance);
const pepeOpen = useAppSelector(state => state.verification.instance.get('registrations') === true);
/** Registrations are closed */
const renderClosed = () => {
return (
);
};
/** Mastodon API registrations are open */
const renderOpen = () => {
return ;
};
/** Display login button for external provider. */
const renderProvider = () => {
const { authProvider } = soapboxConfig;
return (
);
};
/** Pepe API registrations are open */
const renderPepe = () => {
return (
);
};
// Render registration flow depending on features
const renderBody = () => {
if (soapboxConfig.authProvider) {
return renderProvider();
} else if (pepeEnabled && pepeOpen) {
return renderPepe();
} else if (features.accountCreation && instance.registrations) {
return renderOpen();
} else {
return renderClosed();
}
};
return (
);
};
export default LandingPage;