2023-05-23 17:15:17 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-23 10:52:27 +02:00
|
|
|
import { PureComponent } from 'react';
|
2023-05-23 17:15:17 +02:00
|
|
|
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
2018-06-13 14:44:50 +02:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2023-05-23 17:15:17 +02:00
|
|
|
|
2018-06-13 14:44:50 +02:00
|
|
|
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
2022-04-29 00:24:31 +02:00
|
|
|
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' },
|
2018-06-13 14:44:50 +02:00
|
|
|
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
|
|
|
|
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
|
2023-07-21 19:09:13 +02:00
|
|
|
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favorites' },
|
2018-06-13 14:44:50 +02:00
|
|
|
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
|
2023-01-18 16:44:33 +01:00
|
|
|
followed_tags: { id: 'navigation_bar.followed_tags', defaultMessage: 'Followed hashtags' },
|
2018-06-13 14:44:50 +02:00
|
|
|
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
|
2023-05-24 12:38:50 +02:00
|
|
|
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' },
|
2018-06-13 14:44:50 +02:00
|
|
|
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
|
2018-07-11 00:56:54 +02:00
|
|
|
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
|
2019-07-19 03:58:46 +02:00
|
|
|
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
2020-03-21 03:14:28 +01:00
|
|
|
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
|
2018-06-13 14:44:50 +02:00
|
|
|
});
|
|
|
|
|
2023-05-23 10:52:27 +02:00
|
|
|
class ActionBar extends PureComponent {
|
2018-06-13 14:44:50 +02:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
2019-08-26 18:24:10 +02:00
|
|
|
onLogout: PropTypes.func.isRequired,
|
2018-06-13 14:44:50 +02:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
2019-08-26 18:24:10 +02:00
|
|
|
handleLogout = () => {
|
|
|
|
this.props.onLogout();
|
2023-01-30 01:45:35 +01:00
|
|
|
};
|
2019-08-26 18:24:10 +02:00
|
|
|
|
2018-06-13 14:44:50 +02: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 03:14:28 +01:00
|
|
|
menu.push({ text: intl.formatMessage(messages.bookmarks), to: '/bookmarks' });
|
2018-06-13 14:44:50 +02:00
|
|
|
menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' });
|
2023-01-18 16:44:33 +01:00
|
|
|
menu.push({ text: intl.formatMessage(messages.followed_tags), to: '/followed_tags' });
|
2018-06-13 14:44:50 +02:00
|
|
|
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 00:56:54 +02:00
|
|
|
menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' });
|
2019-07-19 03:58:46 +02:00
|
|
|
menu.push(null);
|
2019-08-26 18:24:10 +02:00
|
|
|
menu.push({ text: intl.formatMessage(messages.logout), action: this.handleLogout });
|
2018-06-13 14:44:50 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='compose__action-bar'>
|
|
|
|
<div className='compose__action-bar-dropdown'>
|
2023-07-02 10:39:55 +02:00
|
|
|
<DropdownMenuContainer items={menu} icon='bars' size={18} direction='right' />
|
2018-06-13 14:44:50 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-24 03:17:53 +01:00
|
|
|
|
|
|
|
export default injectIntl(ActionBar);
|