2020-05-15 03:31:24 +01:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
|
|
|
import { closePopover } from '../../actions/popover'
|
2020-05-15 21:29:46 +01:00
|
|
|
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({
|
2020-05-15 21:29:46 +01:00
|
|
|
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) => ({
|
2020-05-18 22:49:51 +01:00
|
|
|
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,
|
2020-05-18 22:49:51 +01:00
|
|
|
onClosePopover: PropTypes.func.isRequired,
|
2020-05-15 03:31:24 +01:00
|
|
|
isXS: PropTypes.bool,
|
|
|
|
}
|
|
|
|
|
2020-05-18 22:49:51 +01:00
|
|
|
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
|
2020-07-25 00:54:44 +01:00
|
|
|
size='small'
|
2020-05-15 03:31:24 +01:00
|
|
|
scrollKey='profile_options'
|
|
|
|
items={[
|
2020-05-15 21:29:46 +01:00
|
|
|
{
|
|
|
|
title: intl.formatMessage(messages.profile),
|
2020-05-18 22:49:51 +01:00
|
|
|
to: `/${meUsername}`,
|
|
|
|
onClick: this.handleOnClosePopover,
|
2020-05-15 21:29:46 +01:00
|
|
|
},
|
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>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|