gab-social/app/javascript/gabsocial/components/popover/nav_settings_popover.js

69 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-05-15 03:31:24 +01:00
import { defineMessages, injectIntl } from 'react-intl'
import { closePopover } from '../../actions/popover'
import { meUsername } from '../../initial_state'
2020-05-15 03:31:24 +01:00
import PopoverLayout from './popover_layout'
import List from '../list'
const messages = defineMessages({
profile: { id: 'account.profile', defaultMessage: 'Profile' },
2020-05-15 03:31:24 +01:00
display: { id: 'display_options', defaultMessage: 'Display Options' },
help: { id: 'getting_started.help', defaultMessage: 'Help' },
settings: { id: 'settings', defaultMessage: 'Settings' },
logout: { 'id': 'confirmations.logout.confirm', 'defaultMessage': 'Log out' },
})
const mapDispatchToProps = (dispatch) => ({
onClosePopover() {
2020-05-15 03:31:24 +01:00
dispatch(closePopover())
},
})
export default
@injectIntl
@connect(null, mapDispatchToProps)
class NavSettingsPopover extends PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onClosePopover: PropTypes.func.isRequired,
2020-05-15 03:31:24 +01:00
isXS: PropTypes.bool,
}
handleOnClosePopover = () => {
this.props.onClosePopover()
2020-05-15 03:31:24 +01:00
}
render() {
const { intl, isXS } = this.props
if (isXS) return null
return (
<PopoverLayout width={240}>
<List
size='small'
2020-05-15 03:31:24 +01:00
scrollKey='profile_options'
items={[
{
title: intl.formatMessage(messages.profile),
to: `/${meUsername}`,
onClick: this.handleOnClosePopover,
},
2020-05-15 03:31:24 +01:00
{
title: intl.formatMessage(messages.help),
href: 'https://help.gab.com',
},
{
title: intl.formatMessage(messages.settings),
href: '/settings/preferences',
},
{
title: intl.formatMessage(messages.logout),
href: '/auth/sign_out',
},
]}
/>
</PopoverLayout>
)
}
}