sforkowany z mirror/soapbox
RegistrationForm: refactor isOpen logic
rodzic
937cc18012
commit
6f7e0c75b4
|
@ -140,32 +140,11 @@ class RegistrationForm extends ImmutablePureComponent {
|
|||
render() {
|
||||
const { instance, intl, supportsEmailList } = this.props;
|
||||
const { params } = this.state;
|
||||
const isOpen = instance.get('registrations');
|
||||
const isLoading = this.state.captchaLoading || this.state.submissionLoading;
|
||||
|
||||
if (isOpen === false) {
|
||||
return (
|
||||
<div className='registrations-closed'>
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id='registration.closed_title'
|
||||
defaultMessage='Registrations Closed'
|
||||
/>
|
||||
</h2>
|
||||
<div className='registrations-closed__message'>
|
||||
<FormattedMessage
|
||||
id='registration.closed_message'
|
||||
defaultMessage='{instance} is not accepting new members'
|
||||
values={{ instance: <strong>{instance.get('title')}</strong> }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SimpleForm onSubmit={this.onSubmit}>
|
||||
<fieldset disabled={isLoading || !isOpen}>
|
||||
<fieldset disabled={isLoading}>
|
||||
<div className='simple_form__overlay-area'>
|
||||
<div className='fields-group'>
|
||||
<TextInput
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { Link } from 'react-router-dom';
|
||||
import RegistrationForm from '../auth_login/components/registration_form';
|
||||
|
@ -11,8 +12,31 @@ const mapStateToProps = (state, props) => ({
|
|||
|
||||
class LandingPage extends ImmutablePureComponent {
|
||||
|
||||
renderClosed = () => {
|
||||
const { instance } = this.props;
|
||||
|
||||
return (
|
||||
<div className='registrations-closed'>
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id='registration.closed_title'
|
||||
defaultMessage='Registrations Closed'
|
||||
/>
|
||||
</h2>
|
||||
<div className='registrations-closed__message'>
|
||||
<FormattedMessage
|
||||
id='registration.closed_message'
|
||||
defaultMessage='{instance} is not accepting new members'
|
||||
values={{ instance: <strong>{instance.get('title')}</strong> }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { instance } = this.props;
|
||||
const isOpen = instance.get('registrations', false) === true;
|
||||
|
||||
return (
|
||||
<div className='landing'>
|
||||
|
@ -28,7 +52,7 @@ class LandingPage extends ImmutablePureComponent {
|
|||
</div>
|
||||
</div>
|
||||
<div className='landing-columns--right'>
|
||||
<RegistrationForm />
|
||||
{isOpen ? <RegistrationForm /> : this.renderClosed()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Ładowanie…
Reference in New Issue