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-07-25 02:22:00 +01:00
|
|
|
import { injectIntl, defineMessages } from 'react-intl'
|
|
|
|
import { me } from '../initial_state'
|
|
|
|
import SidebarSectionTitle from './sidebar_section_title'
|
|
|
|
import SidebarSectionItem from './sidebar_section_item'
|
|
|
|
import Heading from './heading'
|
2020-08-06 06:14:29 +01:00
|
|
|
import LinkFooter from './link_footer'
|
2020-07-25 02:22:00 +01:00
|
|
|
|
2020-08-17 21:07:16 +01:00
|
|
|
class Sidebar extends React.PureComponent {
|
2020-07-25 02:22:00 +01:00
|
|
|
|
|
|
|
render() {
|
2020-08-06 06:14:29 +01:00
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
title,
|
|
|
|
showLinkFooter,
|
|
|
|
} = this.props
|
2020-07-25 02:22:00 +01:00
|
|
|
|
|
|
|
if (!!me) return null
|
|
|
|
|
|
|
|
const menuItems = [
|
|
|
|
{
|
|
|
|
title: 'Home',
|
|
|
|
icon: 'home',
|
2020-08-06 06:14:29 +01:00
|
|
|
to: '/',
|
2020-07-25 02:22:00 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Search',
|
|
|
|
icon: 'search-alt',
|
|
|
|
to: '/search',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Groups',
|
|
|
|
icon: 'group',
|
|
|
|
to: '/groups',
|
|
|
|
},
|
|
|
|
{
|
2020-08-06 06:14:29 +01:00
|
|
|
title: 'News',
|
|
|
|
icon: 'news',
|
|
|
|
to: '/news',
|
2020-07-25 02:22:00 +01:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
const exploreItems = [
|
|
|
|
{
|
|
|
|
title: 'Apps',
|
|
|
|
icon: 'apps',
|
|
|
|
href: 'https://apps.gab.com',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Shop',
|
|
|
|
icon: 'shop',
|
|
|
|
href: 'https://shop.dissenter.com',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Trends',
|
|
|
|
icon: 'trends',
|
|
|
|
href: 'https://trends.gab.com',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Dissenter',
|
|
|
|
icon: 'dissenter',
|
|
|
|
href: 'https://dissenter.com',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<header role='banner' className={[_s.d, _s.flexGrow1, _s.z3, _s.aiEnd].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.w240PX].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.posFixed, _s.calcH53PX, _s.bottom0].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.h100PC, _s.aiStart, _s.w240PX, _s.pr15, _s.py10, _s.noScrollbar, _s.overflowYScroll].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.w100PC].join(' ')}>
|
2020-07-25 02:22:00 +01:00
|
|
|
{
|
|
|
|
!!title &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.px5, _s.pt10].join(' ')}>
|
2020-07-25 02:22:00 +01:00
|
|
|
<Heading size='h1'>
|
|
|
|
{title}
|
|
|
|
</Heading>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
2020-08-18 21:49:11 +01:00
|
|
|
<nav aria-label='Primary' role='navigation' className={[_s.d, _s.w100PC, _s.mb15].join(' ')}>
|
2020-07-25 02:22:00 +01:00
|
|
|
<SidebarSectionTitle>{intl.formatMessage(messages.menu)}</SidebarSectionTitle>
|
|
|
|
{
|
|
|
|
menuItems.map((menuItem, i) => {
|
|
|
|
if (menuItem.hidden) return null
|
|
|
|
|
|
|
|
return (
|
|
|
|
<SidebarSectionItem {...menuItem} key={`sidebar-item-menu-${i}`} />
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
<SidebarSectionTitle>{intl.formatMessage(messages.explore)}</SidebarSectionTitle>
|
|
|
|
{
|
|
|
|
exploreItems.map((exploreItem, i) => (
|
|
|
|
<SidebarSectionItem {...exploreItem} key={`sidebar-item-explore-${i}`} />
|
|
|
|
))
|
|
|
|
}
|
|
|
|
</nav>
|
|
|
|
|
2020-08-06 06:14:29 +01:00
|
|
|
{
|
|
|
|
showLinkFooter && <LinkFooter noPadding />
|
|
|
|
}
|
2020-07-25 02:22:00 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
explore: { id: 'explore', defaultMessage: 'Explore' },
|
|
|
|
menu: { id: 'menu', defaultMessage: 'Menu' },
|
|
|
|
})
|
|
|
|
|
|
|
|
Sidebar.propTypes = {
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
showLinkFooter: PropTypes.bool,
|
|
|
|
title: PropTypes.string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(Sidebar)
|