2020-04-25 22:26:47 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2022-01-10 22:17:52 +00:00
|
|
|
import { connect } from 'react-redux';
|
2021-08-22 19:34:58 +00:00
|
|
|
import { Switch, Route, Redirect } from 'react-router-dom';
|
2022-01-10 22:25:06 +00:00
|
|
|
|
2022-01-10 22:17:52 +00:00
|
|
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
2022-05-07 20:52:01 +00:00
|
|
|
import LandingGradient from 'soapbox/components/landing-gradient';
|
2022-01-10 22:01:24 +00:00
|
|
|
import BundleContainer from 'soapbox/features/ui/containers/bundle_container';
|
2021-09-19 01:01:04 +00:00
|
|
|
import {
|
|
|
|
NotificationsContainer,
|
|
|
|
ModalContainer,
|
|
|
|
} from 'soapbox/features/ui/util/async-components';
|
2021-08-30 23:41:05 +00:00
|
|
|
import { isStandalone } from 'soapbox/utils/state';
|
2022-01-10 22:25:06 +00:00
|
|
|
|
2022-01-10 22:01:24 +00:00
|
|
|
import AboutPage from '../about';
|
2022-01-10 22:17:52 +00:00
|
|
|
import LandingPage from '../landing_page';
|
2022-03-21 18:09:01 +00:00
|
|
|
import MobilePage from '../mobile';
|
2022-01-10 22:25:06 +00:00
|
|
|
|
2022-01-10 22:01:24 +00:00
|
|
|
import Footer from './components/footer';
|
2022-01-10 22:17:52 +00:00
|
|
|
import Header from './components/header';
|
2020-04-25 22:26:47 +00:00
|
|
|
|
|
|
|
const mapStateToProps = (state, props) => ({
|
2020-08-23 20:56:18 +00:00
|
|
|
soapbox: getSoapboxConfig(state),
|
2021-08-22 19:34:58 +00:00
|
|
|
standalone: isStandalone(state),
|
2020-04-25 22:26:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
class PublicLayout extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
render() {
|
2021-08-22 19:34:58 +00:00
|
|
|
const { standalone } = this.props;
|
|
|
|
|
|
|
|
if (standalone) {
|
2022-04-19 19:37:48 +00:00
|
|
|
return <Redirect to='/login/external' />;
|
2021-08-22 19:34:58 +00:00
|
|
|
}
|
2020-04-25 22:26:47 +00:00
|
|
|
|
|
|
|
return (
|
2022-03-21 18:09:01 +00:00
|
|
|
<div className='h-full'>
|
2022-05-07 20:52:01 +00:00
|
|
|
<LandingGradient />
|
2022-03-21 18:09:01 +00:00
|
|
|
|
|
|
|
<div className='flex flex-col h-screen'>
|
|
|
|
<div className='flex-shrink-0'>
|
|
|
|
<Header />
|
|
|
|
|
2022-05-10 19:52:12 +00:00
|
|
|
<div className='relative'>
|
|
|
|
<Switch>
|
|
|
|
<Route exact path='/' component={LandingPage} />
|
|
|
|
<Route exact path='/about/:slug?' component={AboutPage} />
|
|
|
|
<Route exact path='/mobile/:slug?' component={MobilePage} />
|
|
|
|
</Switch>
|
2022-03-21 18:09:01 +00:00
|
|
|
</div>
|
2020-06-02 04:24:36 +00:00
|
|
|
</div>
|
2021-09-19 01:01:04 +00:00
|
|
|
|
2022-03-21 18:09:01 +00:00
|
|
|
<Footer />
|
|
|
|
|
|
|
|
<BundleContainer fetchComponent={NotificationsContainer}>
|
|
|
|
{(Component) => <Component />}
|
|
|
|
</BundleContainer>
|
2021-09-19 01:01:04 +00:00
|
|
|
|
2022-03-21 18:09:01 +00:00
|
|
|
<BundleContainer fetchComponent={ModalContainer}>
|
|
|
|
{(Component) => <Component />}
|
|
|
|
</BundleContainer>
|
|
|
|
</div>
|
2020-04-25 22:26:47 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(PublicLayout);
|