2018-06-13 13:44:50 +01:00
|
|
|
import React from 'react';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
|
|
|
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
|
|
|
|
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
|
|
|
|
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
|
|
|
|
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
|
|
|
|
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
|
|
|
|
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
|
|
|
|
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' },
|
|
|
|
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
|
2018-07-10 23:56:54 +01:00
|
|
|
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
|
2019-07-19 02:58:46 +01:00
|
|
|
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
2018-06-13 13:44:50 +01:00
|
|
|
});
|
|
|
|
|
2018-09-14 16:59:48 +01:00
|
|
|
export default @injectIntl
|
|
|
|
class ActionBar extends React.PureComponent {
|
2018-06-13 13:44:50 +01:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
2019-08-26 17:24:10 +01:00
|
|
|
onLogout: PropTypes.func.isRequired,
|
2018-06-13 13:44:50 +01:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
2019-08-26 17:24:10 +01:00
|
|
|
handleLogout = () => {
|
|
|
|
this.props.onLogout();
|
|
|
|
}
|
|
|
|
|
2018-06-13 13:44:50 +01:00
|
|
|
render () {
|
|
|
|
const { intl } = this.props;
|
|
|
|
|
|
|
|
let menu = [];
|
|
|
|
|
|
|
|
menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.preferences), href: '/settings/preferences' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.pins), to: '/pinned' });
|
|
|
|
menu.push(null);
|
|
|
|
menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.favourites), to: '/favourites' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' });
|
|
|
|
menu.push(null);
|
|
|
|
menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' });
|
2018-07-10 23:56:54 +01:00
|
|
|
menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' });
|
2019-07-19 02:58:46 +01:00
|
|
|
menu.push(null);
|
2019-08-26 17:24:10 +01:00
|
|
|
menu.push({ text: intl.formatMessage(messages.logout), action: this.handleLogout });
|
2018-06-13 13:44:50 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='compose__action-bar'>
|
|
|
|
<div className='compose__action-bar-dropdown'>
|
2019-05-25 20:27:00 +01:00
|
|
|
<DropdownMenuContainer items={menu} icon='chevron-down' size={16} direction='right' />
|
2018-06-13 13:44:50 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|