pleroma/app/gabsocial/features/landing_page/index.js

93 lines
3.2 KiB
JavaScript
Raw Normal View History

import React from 'react';
2020-04-14 11:44:40 -07:00
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
2020-04-10 13:24:12 -07:00
import { Link } from 'react-router-dom';
import LoginForm from 'gabsocial/features/auth_login/components/login_form';
2020-04-22 17:55:23 -07:00
import RegistrationForm from './components/registration_form';
2020-04-11 11:00:36 -07:00
import NotificationsContainer from 'gabsocial/features/ui/containers/notifications_container';
const mapStateToProps = (state, props) => ({
2020-04-10 13:24:12 -07:00
instance: state.get('instance'),
soapbox: state.get('soapbox'),
});
class LandingPage extends ImmutablePureComponent {
2020-04-14 11:44:40 -07:00
2020-04-10 15:17:02 -07:00
getSiteLogo = () => {
const { instance, soapbox } = this.props;
const logos = {
imgLogo: (<img alt={instance.get('title')} src={soapbox.get('logo')} />),
textLogo: (<h1>{instance.get('title')}</h1>),
2020-04-14 11:44:40 -07:00
};
return soapbox.get('logo') ? logos.imgLogo : logos.textLogo;
2020-04-10 14:20:05 -07:00
}
render() {
2020-04-14 13:45:38 -07:00
const { instance } = this.props;
2020-04-10 15:17:02 -07:00
if (instance.isEmpty()) return null;
const siteLogo = this.getSiteLogo();
2020-04-10 14:37:19 -07:00
return (
2020-04-10 13:24:12 -07:00
<div className='public-layout'>
<nav className='header'>
<div className='header-container'>
<div className='nav-left'>
<Link className='brand' to='/'>
2020-04-10 14:37:19 -07:00
{siteLogo}
2020-04-10 13:24:12 -07:00
</Link>
<Link className='nav-link optional' to='/'>Home</Link>
<Link className='nav-link' to='/about'>About</Link>
</div>
2020-04-14 11:44:40 -07:00
<div className='nav-center' />
2020-04-10 13:24:12 -07:00
<div className='nav-right'>
<div className='hidden-sm'>
2020-04-10 17:03:06 -07:00
<LoginForm />
2020-04-10 13:24:12 -07:00
</div>
<div className='visible-sm'>
<Link className='webapp-btn nav-link nav-button' to='/auth/sign_in'>Log in</Link>
</div>
</div>
</div>
</nav>
<div className='container'>
<div className='landing'>
<div className='landing-columns'>
<div className='landing-columns--left'>
<div className='landing__brand'>
2020-04-10 14:20:05 -07:00
<Link className='brand' to='/'>
2020-04-10 14:37:19 -07:00
{siteLogo}
2020-04-10 13:24:12 -07:00
</Link>
<div className='brand__tagline'>
2020-04-10 14:20:05 -07:00
<span>{instance.get('description')}</span>
2020-04-10 13:24:12 -07:00
</div>
</div>
</div>
<div className='landing-columns--right'>
2020-04-22 17:55:23 -07:00
<RegistrationForm />
2020-04-10 13:24:12 -07:00
</div>
</div>
</div>
</div>
<div className='footer'>
<div className='footer-container'>
<div className='copyright'>
<span>{new Date().getFullYear()}. Copying is an act of love. Please copy and share.</span>
</div>
<ul>
<li><Link to='/about'>About</Link></li>
<li><Link to='/about/tos'>Terms of Service</Link></li>
<li><Link to='/about/privacy'>Privacy Policy</Link></li>
<li><Link to='/about/dmca'>DMCA</Link></li>
<li><Link to='/about#opensource'>Source Code</Link></li>
</ul>
</div>
</div>
2020-04-11 11:00:36 -07:00
<NotificationsContainer />
2020-04-10 13:24:12 -07:00
</div>
2020-04-14 11:44:40 -07:00
);
}
2020-04-14 11:44:40 -07:00
}
export default connect(mapStateToProps)(LandingPage);