2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-04-11 23:29:19 +01:00
|
|
|
import Sticky from 'react-stickynode'
|
2020-05-14 21:45:39 +01:00
|
|
|
import {
|
|
|
|
CX,
|
|
|
|
BREAKPOINT_EXTRA_SMALL,
|
|
|
|
} from '../constants'
|
2020-05-09 03:17:19 +01:00
|
|
|
import { me } from '../initial_state'
|
2020-09-02 00:13:11 +01:00
|
|
|
import LoggedOutSidebar from '../components/sidebar/logged_out_sidebar'
|
|
|
|
import DefaultSidebar from '../components/sidebar/default_sidebar'
|
2020-07-16 05:05:08 +01:00
|
|
|
import SidebarPanelGroup from '../components/sidebar_panel_group'
|
2020-09-02 00:13:11 +01:00
|
|
|
import DefaultNavigationBar from '../components/navigation_bar/default_navigation_bar'
|
|
|
|
import LoggedOutNavigationBar from '../components/navigation_bar/logged_out_navigation_bar'
|
2020-05-06 05:33:54 +01:00
|
|
|
import FooterBar from '../components/footer_bar'
|
2020-04-11 23:29:19 +01:00
|
|
|
import FloatingActionButton from '../components/floating_action_button'
|
|
|
|
import Responsive from '../features/ui/util/responsive_component'
|
2020-05-06 05:33:54 +01:00
|
|
|
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
|
2020-05-06 07:24:16 +01:00
|
|
|
import Pills from '../components/pills'
|
2020-08-06 06:00:41 +01:00
|
|
|
import GlobalFooter from '../components/global_footer'
|
2020-08-13 00:16:49 +01:00
|
|
|
import WrappedBundle from '../features/ui/util/wrapped_bundle'
|
|
|
|
import {
|
|
|
|
SidebarXS,
|
|
|
|
} from '../features/ui/util/async_components'
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-08-17 21:07:16 +01:00
|
|
|
class Layout extends React.PureComponent {
|
2020-04-11 23:29:19 +01:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2020-05-03 06:22:49 +01:00
|
|
|
actions,
|
2020-04-11 23:29:19 +01:00
|
|
|
children,
|
|
|
|
layout,
|
|
|
|
noComposeButton,
|
2020-05-03 06:22:49 +01:00
|
|
|
noRightSidebar,
|
|
|
|
noSidebar,
|
2020-07-16 05:05:08 +01:00
|
|
|
page,
|
2020-05-03 06:22:49 +01:00
|
|
|
showBackBtn,
|
2020-08-06 06:00:41 +01:00
|
|
|
showLinkFooterInSidebar,
|
|
|
|
showGlobalFooter,
|
2020-05-03 06:22:49 +01:00
|
|
|
tabs,
|
|
|
|
title,
|
2020-04-11 23:29:19 +01:00
|
|
|
} = this.props
|
|
|
|
|
2020-05-14 21:45:39 +01:00
|
|
|
const mainBlockClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
w1015PX: 1,
|
2020-05-14 21:45:39 +01:00
|
|
|
flexRow: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
jcEnd: 1,
|
2020-08-06 06:00:41 +01:00
|
|
|
py15: page !== 'group',
|
|
|
|
pb15: page === 'group',
|
2020-05-14 21:45:39 +01:00
|
|
|
})
|
|
|
|
|
2020-04-11 23:29:19 +01:00
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w100PC, _s.minH100VH, _s.bgTertiary].join(' ')}>
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-14 07:03:22 +01:00
|
|
|
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
|
2020-08-13 00:16:49 +01:00
|
|
|
<WrappedBundle component={SidebarXS} />
|
2020-05-14 07:03:22 +01:00
|
|
|
</Responsive>
|
|
|
|
|
2020-05-09 03:17:19 +01:00
|
|
|
{
|
|
|
|
me &&
|
2020-09-02 00:13:11 +01:00
|
|
|
<DefaultNavigationBar
|
2020-05-09 03:17:19 +01:00
|
|
|
actions={actions}
|
|
|
|
tabs={tabs}
|
|
|
|
title={title}
|
|
|
|
showBackBtn={showBackBtn}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
!me &&
|
|
|
|
<LoggedOutNavigationBar />
|
|
|
|
}
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.w100PC].join(' ')}>
|
2020-04-11 23:29:19 +01:00
|
|
|
{
|
2020-04-29 23:32:49 +01:00
|
|
|
!noSidebar &&
|
|
|
|
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
|
2020-07-25 02:22:00 +01:00
|
|
|
{
|
|
|
|
!!me &&
|
2020-09-02 00:13:11 +01:00
|
|
|
<DefaultSidebar
|
2020-07-25 02:22:00 +01:00
|
|
|
actions={actions}
|
|
|
|
showBackBtn={showBackBtn}
|
|
|
|
tabs={tabs}
|
|
|
|
title={title}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
!me &&
|
2020-08-06 06:00:41 +01:00
|
|
|
<LoggedOutSidebar title={title} showLinkFooter={showLinkFooterInSidebar} />
|
2020-07-25 02:22:00 +01:00
|
|
|
}
|
2020-04-29 23:32:49 +01:00
|
|
|
</Responsive>
|
2020-04-11 23:29:19 +01:00
|
|
|
}
|
2020-05-09 03:17:19 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
<ResponsiveClassesComponent
|
2020-08-18 21:49:11 +01:00
|
|
|
classNames={[_s.d, _s.flexShrink1, _s.flexGrow1].join(' ')}
|
|
|
|
classNamesSmall={[_s.d, _s.flexShrink1, _s.flexGrow1].join(' ')}
|
|
|
|
classNamesXS={[_s.d, _s.w100PC].join(' ')}
|
2020-05-06 05:33:54 +01:00
|
|
|
>
|
|
|
|
<main role='main'>
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-07 05:03:34 +01:00
|
|
|
<ResponsiveClassesComponent
|
2020-05-14 21:45:39 +01:00
|
|
|
classNames={mainBlockClasses}
|
2020-08-18 21:49:11 +01:00
|
|
|
classNamesXS={[_s.d, _s.w1015PX, _s.jcEnd, _s.pb15].join(' ')}
|
2020-05-07 05:03:34 +01:00
|
|
|
>
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
{
|
|
|
|
noRightSidebar && children
|
|
|
|
}
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
{
|
|
|
|
!noRightSidebar &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w645PX, _s.z1].join(' ')}>
|
2020-05-06 07:24:16 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
!!tabs &&
|
|
|
|
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.py15].join(' ')}>
|
2020-05-06 07:24:16 +01:00
|
|
|
<Pills pills={tabs} />
|
|
|
|
</div>
|
|
|
|
</Responsive>
|
|
|
|
}
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={_s.d}>
|
2020-05-06 05:33:54 +01:00
|
|
|
{children}
|
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
2020-05-06 05:33:54 +01:00
|
|
|
}
|
2020-04-29 23:32:49 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
{
|
|
|
|
!noRightSidebar &&
|
|
|
|
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w340PX, _s.ml15].join(' ')}>
|
2020-05-06 05:33:54 +01:00
|
|
|
<Sticky top={73} enabled>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w340PX].join(' ')}>
|
2020-07-16 05:05:08 +01:00
|
|
|
<SidebarPanelGroup layout={layout} page={page} />
|
2020-05-06 05:33:54 +01:00
|
|
|
</div>
|
|
|
|
</Sticky>
|
|
|
|
</div>
|
|
|
|
</Responsive>
|
|
|
|
}
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
{
|
|
|
|
!noComposeButton &&
|
|
|
|
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
|
|
|
|
<FloatingActionButton />
|
|
|
|
</Responsive>
|
|
|
|
}
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-07 05:03:34 +01:00
|
|
|
</ResponsiveClassesComponent>
|
2020-04-11 23:29:19 +01:00
|
|
|
|
2020-05-06 05:33:54 +01:00
|
|
|
</main>
|
|
|
|
</ResponsiveClassesComponent>
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
2020-05-06 05:33:54 +01:00
|
|
|
|
|
|
|
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
|
|
|
|
<FooterBar title={title} />
|
|
|
|
</Responsive>
|
2020-08-06 06:00:41 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
!me && showGlobalFooter && <GlobalFooter />
|
|
|
|
}
|
2020-04-11 23:29:19 +01:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-08-14 18:45:59 +01:00
|
|
|
|
|
|
|
Layout.propTypes = {
|
|
|
|
actions: PropTypes.array,
|
|
|
|
children: PropTypes.node,
|
|
|
|
layout: PropTypes.array,
|
|
|
|
noComposeButton: PropTypes.bool,
|
|
|
|
noRightSidebar: PropTypes.bool,
|
|
|
|
noSidebar: PropTypes.bool,
|
|
|
|
page: PropTypes.string,
|
|
|
|
showBackBtn: PropTypes.bool,
|
|
|
|
showLinkFooterInSidebar: PropTypes.bool,
|
|
|
|
showGlobalFooter: PropTypes.bool,
|
|
|
|
tabs: PropTypes.array,
|
|
|
|
title: PropTypes.string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Layout
|