bigbuffet-rw/app/soapbox/features/landing_page/index.js

65 lines
1.9 KiB
JavaScript
Raw Normal View History

import React from 'react';
2020-04-14 11:44:40 -07:00
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
2020-04-10 13:24:12 -07:00
import { Link } from 'react-router-dom';
import RegistrationForm from '../auth_login/components/registration_form';
import SiteBanner from '../public_layout/components/site_banner';
const mapStateToProps = (state, props) => ({
2020-04-10 13:24:12 -07:00
instance: state.get('instance'),
});
class LandingPage extends ImmutablePureComponent {
2020-04-14 11:44:40 -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>
);
}
render() {
2020-04-14 13:45:38 -07:00
const { instance } = this.props;
const isOpen = instance.get('registrations', false) === true;
2020-04-10 14:37:19 -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='/'>
<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'>
{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-14 11:44:40 -07:00
}
export default connect(mapStateToProps)(LandingPage);