2024-01-26 00:41:31 +09:00
|
|
|
import { useCallback } from 'react';
|
2023-05-24 00:15:17 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
2023-05-24 00:15:17 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
import { useDispatch } from 'react-redux';
|
2023-05-24 00:15:17 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
|
|
|
|
import { openModal } from 'mastodon/actions/modal';
|
|
|
|
import DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container';
|
2018-06-13 21:44:50 +09:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
2022-04-29 07:24:31 +09:00
|
|
|
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' },
|
2018-06-13 21:44:50 +09:00
|
|
|
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
|
|
|
|
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
|
2023-07-22 02:09:13 +09:00
|
|
|
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favorites' },
|
2018-06-13 21:44:50 +09:00
|
|
|
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
|
2023-01-19 00:44:33 +09:00
|
|
|
followed_tags: { id: 'navigation_bar.followed_tags', defaultMessage: 'Followed hashtags' },
|
2018-06-13 21:44:50 +09:00
|
|
|
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
|
2023-05-24 19:38:50 +09:00
|
|
|
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' },
|
2018-06-13 21:44:50 +09:00
|
|
|
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
|
2018-07-11 07:56:54 +09:00
|
|
|
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
|
2019-07-19 10:58:46 +09:00
|
|
|
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
|
2020-03-21 11:14:28 +09:00
|
|
|
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
|
2018-06-13 21:44:50 +09:00
|
|
|
});
|
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
export const ActionBar = () => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const intl = useIntl();
|
2018-06-13 21:44:50 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
const handleLogoutClick = useCallback(() => {
|
2024-07-26 02:05:54 +09:00
|
|
|
dispatch(openModal({ modalType: 'CONFIRM_LOG_OUT' }));
|
|
|
|
}, [dispatch]);
|
2018-06-13 21:44:50 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
let menu = [];
|
2018-06-13 21:44:50 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
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.bookmarks), to: '/bookmarks' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.followed_tags), to: '/followed_tags' });
|
|
|
|
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' });
|
|
|
|
menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' });
|
|
|
|
menu.push(null);
|
|
|
|
menu.push({ text: intl.formatMessage(messages.logout), action: handleLogoutClick });
|
2023-03-24 11:17:53 +09:00
|
|
|
|
2024-01-26 00:41:31 +09:00
|
|
|
return (
|
|
|
|
<DropdownMenuContainer
|
|
|
|
items={menu}
|
|
|
|
icon='bars'
|
|
|
|
iconComponent={MoreHorizIcon}
|
|
|
|
size={24}
|
|
|
|
direction='right'
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|