2020-04-08 16:38:22 -07:00
|
|
|
import React from 'react';
|
2020-04-14 11:44:40 -07:00
|
|
|
import { connect } from 'react-redux';
|
2021-09-24 09:43:28 -07:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2020-04-08 16:38:22 -07:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2020-04-10 13:24:12 -07:00
|
|
|
import { Link } from 'react-router-dom';
|
2021-09-24 09:24:33 -07:00
|
|
|
import RegistrationForm from '../auth_login/components/registration_form';
|
2020-04-29 19:06:28 -07:00
|
|
|
import SiteBanner from '../public_layout/components/site_banner';
|
2020-04-08 16:38:22 -07:00
|
|
|
|
|
|
|
const mapStateToProps = (state, props) => ({
|
2020-04-10 13:24:12 -07:00
|
|
|
instance: state.get('instance'),
|
2020-04-08 16:38:22 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
class LandingPage extends ImmutablePureComponent {
|
2020-04-14 11:44:40 -07:00
|
|
|
|
2021-09-24 09:43:28 -07:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-08 16:38:22 -07:00
|
|
|
render() {
|
2020-04-14 13:45:38 -07:00
|
|
|
const { instance } = this.props;
|
2021-09-24 09:43:28 -07:00
|
|
|
const isOpen = instance.get('registrations', false) === true;
|
2020-04-10 14:37:19 -07:00
|
|
|
|
2020-04-08 16:38:22 -07:00
|
|
|
return (
|
2020-04-25 15:26:47 -07:00
|
|
|
<div className='landing'>
|
|
|
|
<div className='landing-columns'>
|
|
|
|
<div className='landing-columns--left'>
|
|
|
|
<div className='landing__brand'>
|
2020-04-10 13:24:12 -07:00
|
|
|
<Link className='brand' to='/'>
|
2020-04-29 19:06:28 -07:00
|
|
|
<SiteBanner />
|
2020-04-10 13:24:12 -07:00
|
|
|
</Link>
|
2020-04-25 15:26:47 -07:00
|
|
|
<div className='brand__tagline'>
|
|
|
|
<span>{instance.get('description')}</span>
|
2020-04-10 13:24:12 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-25 15:26:47 -07:00
|
|
|
<div className='landing-columns--right'>
|
2021-09-24 09:43:28 -07:00
|
|
|
{isOpen ? <RegistrationForm /> : this.renderClosed()}
|
2020-04-10 13:24:12 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-14 11:44:40 -07:00
|
|
|
);
|
2020-04-08 16:38:22 -07:00
|
|
|
}
|
2020-04-14 11:44:40 -07:00
|
|
|
|
2020-04-08 16:38:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(LandingPage);
|