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

73 lines
2.1 KiB
JavaScript
Raw Normal View History

2020-04-25 15:26:47 -07:00
import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { Switch, Route, Redirect } from 'react-router-dom';
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
2022-01-10 14:01:24 -08:00
import BundleContainer from 'soapbox/features/ui/containers/bundle_container';
2021-09-18 18:01:04 -07:00
import {
NotificationsContainer,
ModalContainer,
} from 'soapbox/features/ui/util/async-components';
import { isStandalone } from 'soapbox/utils/state';
2022-01-10 14:01:24 -08:00
import AboutPage from '../about';
2022-03-21 11:09:01 -07:00
import BetaPage from '../beta';
import LandingPage from '../landing_page';
2022-03-21 11:09:01 -07:00
import MobilePage from '../mobile';
2022-01-10 14:01:24 -08:00
import Footer from './components/footer';
import Header from './components/header';
2020-04-25 15:26:47 -07:00
const mapStateToProps = (state, props) => ({
soapbox: getSoapboxConfig(state),
standalone: isStandalone(state),
2020-04-25 15:26:47 -07:00
});
class PublicLayout extends ImmutablePureComponent {
render() {
const { standalone } = this.props;
if (standalone) {
return <Redirect to='/auth/external' />;
}
2020-04-25 15:26:47 -07:00
return (
2022-03-21 11:09:01 -07:00
<div className='h-full'>
<div className='fixed h-screen w-full bg-gradient-to-tr from-primary-50 via-white to-cyan-50' />
<div className='flex flex-col h-screen'>
<div className='flex-shrink-0'>
<Header />
<div className='public-layout__top'>
<div className='container'>
<Switch>
<Route exact path='/' component={LandingPage} />
<Route exact path='/about/:slug?' component={AboutPage} />
<Route exact path='/beta/:slug?' component={BetaPage} />
<Route exact path='/mobile/:slug?' component={MobilePage} />
</Switch>
</div>
</div>
2020-06-01 21:24:36 -07:00
</div>
2021-09-18 18:01:04 -07:00
2022-03-21 11:09:01 -07:00
<Footer />
<BundleContainer fetchComponent={NotificationsContainer}>
{(Component) => <Component />}
</BundleContainer>
2021-09-18 18:01:04 -07:00
2022-03-21 11:09:01 -07:00
<BundleContainer fetchComponent={ModalContainer}>
{(Component) => <Component />}
</BundleContainer>
</div>
2020-04-25 15:26:47 -07:00
</div>
);
}
}
export default connect(mapStateToProps)(PublicLayout);