2018-06-13 15:44:50 +03: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' },
|
2022-04-29 01:24:31 +03:00
|
|
|
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' },
|
2018-06-13 15:44:50 +03:00
|
|
|
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-11 01:56:54 +03:00
|
|
|
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
|
2019-07-19 04:58:46 +03:00
|
|
|
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
2020-03-21 04:14:28 +02:00
|
|
|
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
|
2018-06-13 15:44:50 +03:00
|
|
|
});
|
|
|
|
|
2018-09-14 18:59:48 +03:00
|
|
|
export default @injectIntl
|
|
|
|
class ActionBar extends React.PureComponent {
|
2018-06-13 15:44:50 +03:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
2019-08-26 19:24:10 +03:00
|
|
|
onLogout: PropTypes.func.isRequired,
|
2018-06-13 15:44:50 +03:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
2019-08-26 19:24:10 +03:00
|
|
|
handleLogout = () => {
|
|
|
|
this.props.onLogout();
|
|
|
|
}
|
|
|
|
|
2018-06-13 15:44:50 +03: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' });
|
2020-03-21 04:14:28 +02:00
|
|
|
menu.push({ text: intl.formatMessage(messages.bookmarks), to: '/bookmarks' });
|
2018-06-13 15:44:50 +03:00
|
|
|
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-11 01:56:54 +03:00
|
|
|
menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' });
|
2019-07-19 04:58:46 +03:00
|
|
|
menu.push(null);
|
2019-08-26 19:24:10 +03:00
|
|
|
menu.push({ text: intl.formatMessage(messages.logout), action: this.handleLogout });
|
2018-06-13 15:44:50 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='compose__action-bar'>
|
|
|
|
<div className='compose__action-bar-dropdown'>
|
2019-05-25 22:27:00 +03:00
|
|
|
<DropdownMenuContainer items={menu} icon='chevron-down' size={16} direction='right' />
|
2018-06-13 15:44:50 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|