153 lines
5.1 KiB
JavaScript
Raw Normal View History

2020-02-28 10:20:47 -05:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
2020-05-08 22:17:19 -04:00
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
2020-02-24 16:56:07 -05:00
import Sticky from 'react-stickynode'
2020-05-08 22:17:19 -04:00
import { me } from '../initial_state'
import { CX } from '../constants'
2020-04-29 18:32:49 -04:00
import NavigationBar from '../components/navigation_bar'
2020-05-08 22:17:19 -04:00
import FooterBar from '../components/footer_bar'
2020-05-03 01:22:49 -04:00
import ProfileHeader from '../components/profile_header'
2020-05-14 02:03:22 -04:00
import FloatingActionButton from '../components/floating_action_button'
2020-05-08 22:17:19 -04:00
import ProfileNavigationBar from '../components/profile_navigation_bar'
import LoggedOutNavigationBar from '../components/logged_out_navigation_bar'
import Responsive from '../features/ui/util/responsive_component'
import Divider from '../components/divider'
import WrappedBundle from '../features/ui/util/wrapped_bundle'
import {
LinkFooter,
ProfileStatsPanel,
ProfileInfoPanel,
MediaGalleryPanel,
SignUpPanel,
} from '../features/ui/util/async_components'
2020-03-14 13:31:29 -04:00
2020-02-28 10:20:47 -05:00
export default class ProfileLayout extends ImmutablePureComponent {
2020-04-30 00:34:50 -04:00
2020-02-24 16:56:07 -05:00
static propTypes = {
2020-02-28 10:20:47 -05:00
account: ImmutablePropTypes.map,
2020-05-03 01:22:49 -04:00
children: PropTypes.node.isRequired,
titleHTML: PropTypes.string,
2020-05-09 23:26:58 -04:00
unavailable: PropTypes.bool,
noSidebar: PropTypes.bool,
2020-02-24 16:56:07 -05:00
}
render() {
2020-04-11 18:29:19 -04:00
const {
account,
children,
titleHTML,
2020-05-09 23:26:58 -04:00
unavailable,
noSidebar,
2020-04-11 18:29:19 -04:00
} = this.props
2020-02-28 10:20:47 -05:00
const mainContentClasses = CX({
default: 1,
width645PX: !noSidebar,
width1015PX: noSidebar,
z1: 1,
})
2020-02-24 16:56:07 -05:00
return (
2020-04-29 18:32:49 -04:00
<div className={[_s.default, _s.width100PC, _s.heightMin100VH, _s.bgTertiary].join(' ')}>
2020-05-08 22:17:19 -04:00
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
{
!!me &&
<ProfileNavigationBar titleHTML={titleHTML} />
2020-05-08 22:17:19 -04:00
}
{
!me &&
<LoggedOutNavigationBar isProfile />
2020-05-08 22:17:19 -04:00
}
<main role='main' className={[_s.default, _s.width100PC].join(' ')}>
<div className={[_s.default, _s.width100PC, _s.flexRow, _s.pb15].join(' ')}>
<div className={[_s.default, _s.width100PC, _s.flexRow, _s.justifyContentSpaceBetween].join(' ')}>
<div className={[_s.default, _s.z1, _s.width100PC, _s.alignItemsCenter].join(' ')}>
<ProfileHeader account={account} isXS>
<WrappedBundle component={ProfileInfoPanel} componentParams={{ account }} />
2020-05-08 22:17:19 -04:00
<Divider isSmall />
<WrappedBundle component={ProfileStatsPanel} componentParams={{ account }} />
2020-05-08 22:17:19 -04:00
</ProfileHeader>
<div className={[_s.default, _s.width100PC, , _s.flexRow, _s.justifyContentEnd, _s.py15].join(' ')}>
<div className={[_s.default, _s.width100PC, _s.z1].join(' ')}>
<div className={_s.default}>
{children}
</div>
</div>
</div>
2020-04-29 18:32:49 -04:00
2020-05-08 22:17:19 -04:00
</div>
</div>
2020-04-29 18:32:49 -04:00
2020-03-14 13:31:29 -04:00
2020-05-08 22:17:19 -04:00
</div>
2020-04-29 18:32:49 -04:00
2020-05-14 02:03:22 -04:00
<FloatingActionButton />
2020-05-08 22:17:19 -04:00
</main>
2020-05-14 02:03:22 -04:00
<FooterBar />
2020-05-08 22:17:19 -04:00
</Responsive>
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
{
me &&
<NavigationBar />
}
{
!me &&
<LoggedOutNavigationBar isProfile />
2020-05-08 22:17:19 -04:00
}
<main role='main' className={[_s.default, _s.width100PC].join(' ')}>
<div className={[_s.default, _s.width100PC, _s.flexRow, _s.pb15].join(' ')}>
<div className={[_s.default, _s.width100PC, _s.flexRow, _s.justifyContentSpaceBetween].join(' ')}>
<div className={[_s.default, _s.z1, _s.width100PC, _s.alignItemsCenter].join(' ')}>
<ProfileHeader account={account} />
<div className={[_s.default, _s.width1015PX, , _s.flexRow, _s.justifyContentEnd, _s.py15].join(' ')}>
{
!noSidebar &&
<div className={[_s.default, _s.width340PX, _s.mr15].join(' ')}>
<Sticky top={63} enabled>
<div className={[_s.default, _s.width340PX].join(' ')}>
<WrappedBundle component={ProfileStatsPanel} componentParams={{ account }} />
<WrappedBundle component={ProfileInfoPanel} componentParams={{ account }} />
{ !unavailable && <WrappedBundle component={MediaGalleryPanel} componentParams={{ account }} /> }
{ !me && <WrappedBundle component={SignUpPanel} /> }
<WrappedBundle component={LinkFooter} />
</div>
</Sticky>
</div>
}
<div className={mainContentClasses}>
2020-05-08 22:17:19 -04:00
<div className={_s.default}>
{children}
2020-04-29 18:32:49 -04:00
</div>
</div>
2020-04-11 18:29:19 -04:00
</div>
2020-04-29 18:32:49 -04:00
2020-05-08 22:17:19 -04:00
</div>
2020-04-11 18:29:19 -04:00
</div>
2020-02-24 16:56:07 -05:00
2020-04-29 18:32:49 -04:00
2020-05-08 22:17:19 -04:00
</div>
2020-02-24 16:56:07 -05:00
<FloatingActionButton isDesktop />
2020-05-08 22:17:19 -04:00
</main>
</Responsive>
2020-04-29 18:32:49 -04:00
</div>
2020-02-24 16:56:07 -05:00
)
}
2020-05-08 22:17:19 -04:00
}