RegistrationPage: display "registrations closed" message in place of signup form when registrations are closed

This commit is contained in:
Alex Gleason 2023-09-23 15:48:44 -05:00
parent 52f9339050
commit dcab2deda1
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 20 additions and 1 deletions

View file

@ -2,10 +2,29 @@ import React from 'react';
import { FormattedMessage } from 'react-intl';
import { BigCard } from 'soapbox/components/big-card';
import { Text } from 'soapbox/components/ui';
import { useInstance, useRegistrationStatus } from 'soapbox/hooks';
import RegistrationForm from './registration-form';
const RegistrationPage: React.FC = () => {
const instance = useInstance();
const { isOpen } = useRegistrationStatus();
if (!isOpen) {
return (
<BigCard title={<FormattedMessage id='registration.closed_title' defaultMessage='Registrations Closed' />}>
<Text theme='muted' align='center'>
<FormattedMessage
id='registration.closed_message'
defaultMessage='{instance} is not accepting new members.'
values={{ instance: instance.title }}
/>
</Text>
</BigCard>
);
}
return (
<BigCard title={<FormattedMessage id='column.registration' defaultMessage='Sign Up' />}>
<RegistrationForm />

View file

@ -6,7 +6,7 @@ export const useRegistrationStatus = () => {
const features = useFeatures();
return {
/** Registrations are open, either through Pepe or traditional account creation. */
/** Registrations are open. */
isOpen: features.accountCreation && instance.registrations,
};
};