mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-12 21:55:51 -05:00
Redesign: Update account menu options (#40198)
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
} from '@/mastodon/permissions';
|
||||
import type { AppDispatch } from '@/mastodon/store';
|
||||
import { useAppDispatch, useAppSelector } from '@/mastodon/store';
|
||||
import { isRedesignEnabled } from '@/mastodon/utils/environment';
|
||||
import BlockIcon from '@/material-icons/400-24px/block.svg?react';
|
||||
import LinkIcon from '@/material-icons/400-24px/link_2.svg?react';
|
||||
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
|
||||
@@ -96,82 +97,6 @@ interface MenuItemsParams {
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
|
||||
mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' },
|
||||
direct: { id: 'account.direct', defaultMessage: 'Privately mention @{name}' },
|
||||
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
|
||||
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
|
||||
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
|
||||
report: { id: 'account.report', defaultMessage: 'Report @{name}' },
|
||||
blockDomain: {
|
||||
id: 'account.block_domain',
|
||||
defaultMessage: 'Block domain {domain}',
|
||||
},
|
||||
unblockDomain: {
|
||||
id: 'account.unblock_domain',
|
||||
defaultMessage: 'Unblock domain {domain}',
|
||||
},
|
||||
hideReblogs: {
|
||||
id: 'account.hide_reblogs',
|
||||
defaultMessage: 'Hide boosts from @{name}',
|
||||
},
|
||||
showReblogs: {
|
||||
id: 'account.show_reblogs',
|
||||
defaultMessage: 'Show boosts from @{name}',
|
||||
},
|
||||
addNote: {
|
||||
id: 'account.add_note',
|
||||
defaultMessage: 'Add a personal note',
|
||||
},
|
||||
editNote: {
|
||||
id: 'account.edit_note',
|
||||
defaultMessage: 'Edit personal note',
|
||||
},
|
||||
endorse: { id: 'account.endorse', defaultMessage: 'Feature on profile' },
|
||||
unendorse: {
|
||||
id: 'account.unendorse',
|
||||
defaultMessage: "Don't feature on profile",
|
||||
},
|
||||
add_or_remove_from_list: {
|
||||
id: 'account.add_or_remove_from_list',
|
||||
defaultMessage: 'Add or Remove from lists',
|
||||
},
|
||||
admin_account: {
|
||||
id: 'status.admin_account',
|
||||
defaultMessage: 'Open moderation interface for @{name}',
|
||||
},
|
||||
admin_domain: {
|
||||
id: 'status.admin_domain',
|
||||
defaultMessage: 'Open moderation interface for {domain}',
|
||||
},
|
||||
languages: {
|
||||
id: 'account.languages',
|
||||
defaultMessage: 'Change subscribed languages',
|
||||
},
|
||||
openOriginalPage: {
|
||||
id: 'account.open_original_page',
|
||||
defaultMessage: 'Open original page',
|
||||
},
|
||||
removeFromFollowers: {
|
||||
id: 'account.remove_from_followers',
|
||||
defaultMessage: 'Remove {name} from followers',
|
||||
},
|
||||
confirmRemoveFromFollowersTitle: {
|
||||
id: 'confirmations.remove_from_followers.title',
|
||||
defaultMessage: 'Remove follower?',
|
||||
},
|
||||
confirmRemoveFromFollowersMessage: {
|
||||
id: 'confirmations.remove_from_followers.message',
|
||||
defaultMessage:
|
||||
'{name} will stop following you. Are you sure you want to proceed?',
|
||||
},
|
||||
confirmRemoveFromFollowersButton: {
|
||||
id: 'confirmations.remove_from_followers.confirm',
|
||||
defaultMessage: 'Remove follower',
|
||||
},
|
||||
});
|
||||
|
||||
const redesignMessages = defineMessages({
|
||||
share: { id: 'account.menu.share', defaultMessage: 'Share…' },
|
||||
copy: { id: 'account.menu.copy', defaultMessage: 'Copy link' },
|
||||
copied: {
|
||||
@@ -187,6 +112,12 @@ const redesignMessages = defineMessages({
|
||||
id: 'account.menu.direct',
|
||||
defaultMessage: 'Privately mention',
|
||||
},
|
||||
redesignMessage: {
|
||||
id: 'account.menu.message',
|
||||
defaultMessage: 'Message',
|
||||
description:
|
||||
'Message refers to a direct message. For languages where this is confusing, "chat" or "direct message" can be used.',
|
||||
},
|
||||
mute: { id: 'account.menu.mute', defaultMessage: 'Mute account' },
|
||||
unmute: {
|
||||
id: 'account.menu.unmute',
|
||||
@@ -234,6 +165,44 @@ const redesignMessages = defineMessages({
|
||||
id: 'account.menu.remove_follower',
|
||||
defaultMessage: 'Remove follower',
|
||||
},
|
||||
addNote: {
|
||||
id: 'account.add_note',
|
||||
defaultMessage: 'Add a personal note',
|
||||
},
|
||||
editNote: {
|
||||
id: 'account.edit_note',
|
||||
defaultMessage: 'Edit personal note',
|
||||
},
|
||||
endorse: { id: 'account.endorse', defaultMessage: 'Feature on profile' },
|
||||
unendorse: {
|
||||
id: 'account.unendorse',
|
||||
defaultMessage: "Don't feature on profile",
|
||||
},
|
||||
admin_account: {
|
||||
id: 'status.admin_account',
|
||||
defaultMessage: 'Open moderation interface for @{name}',
|
||||
},
|
||||
admin_domain: {
|
||||
id: 'status.admin_domain',
|
||||
defaultMessage: 'Open moderation interface for {domain}',
|
||||
},
|
||||
languages: {
|
||||
id: 'account.languages',
|
||||
defaultMessage: 'Change subscribed languages',
|
||||
},
|
||||
confirmRemoveFromFollowersTitle: {
|
||||
id: 'confirmations.remove_from_followers.title',
|
||||
defaultMessage: 'Remove follower?',
|
||||
},
|
||||
confirmRemoveFromFollowersMessage: {
|
||||
id: 'confirmations.remove_from_followers.message',
|
||||
defaultMessage:
|
||||
'{name} will stop following you. Are you sure you want to proceed?',
|
||||
},
|
||||
confirmRemoveFromFollowersButton: {
|
||||
id: 'confirmations.remove_from_followers.confirm',
|
||||
defaultMessage: 'Remove follower',
|
||||
},
|
||||
});
|
||||
|
||||
function getMenuItems({
|
||||
@@ -252,7 +221,7 @@ function getMenuItems({
|
||||
if (account.url) {
|
||||
if ('share' in navigator) {
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.share),
|
||||
text: intl.formatMessage(messages.share),
|
||||
action: () => {
|
||||
void navigator.share({
|
||||
url: account.url,
|
||||
@@ -262,10 +231,10 @@ function getMenuItems({
|
||||
});
|
||||
}
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.copy),
|
||||
text: intl.formatMessage(messages.copy),
|
||||
action: () => {
|
||||
void navigator.clipboard.writeText(account.url);
|
||||
dispatch(showAlert({ message: redesignMessages.copied }));
|
||||
dispatch(showAlert({ message: messages.copied }));
|
||||
},
|
||||
icon: LinkIcon,
|
||||
});
|
||||
@@ -275,8 +244,8 @@ function getMenuItems({
|
||||
if (isRemote) {
|
||||
items.push({
|
||||
text: account.invalid_handle
|
||||
? intl.formatMessage(redesignMessages.openOriginalPageInvalid)
|
||||
: intl.formatMessage(redesignMessages.openOriginalPage, {
|
||||
? intl.formatMessage(messages.openOriginalPageInvalid)
|
||||
: intl.formatMessage(messages.openOriginalPage, {
|
||||
domain: remoteDomain,
|
||||
}),
|
||||
href: account.url,
|
||||
@@ -285,25 +254,33 @@ function getMenuItems({
|
||||
|
||||
// Mention and direct message options
|
||||
if (signedIn && !account.suspended) {
|
||||
if (account.invalid_handle) items.push(null);
|
||||
else {
|
||||
items.push(
|
||||
null,
|
||||
{
|
||||
text: intl.formatMessage(redesignMessages.mention),
|
||||
action: () => {
|
||||
dispatch(mentionCompose(account));
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
text: intl.formatMessage(redesignMessages.direct),
|
||||
items.push(null);
|
||||
if (!account.invalid_handle) {
|
||||
if (isRedesignEnabled()) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.redesignMessage),
|
||||
action: () => {
|
||||
dispatch(directCompose(account));
|
||||
},
|
||||
},
|
||||
null,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
items.push(
|
||||
{
|
||||
text: intl.formatMessage(messages.mention),
|
||||
action: () => {
|
||||
dispatch(mentionCompose(account));
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
text: intl.formatMessage(messages.direct),
|
||||
action: () => {
|
||||
dispatch(directCompose(account));
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
items.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +291,7 @@ function getMenuItems({
|
||||
// Add to list
|
||||
if (relationship?.following) {
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.addToList),
|
||||
text: intl.formatMessage(messages.addToList),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
@@ -334,7 +311,7 @@ function getMenuItems({
|
||||
(canAccountBeAddedByFollowers(account) && relationship?.following)
|
||||
) {
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.addToCollection),
|
||||
text: intl.formatMessage(messages.addToCollection),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
@@ -369,7 +346,7 @@ function getMenuItems({
|
||||
text: intl.formatMessage(
|
||||
relationship?.note ? messages.editNote : messages.addNote,
|
||||
),
|
||||
description: intl.formatMessage(redesignMessages.noteDescription),
|
||||
description: intl.formatMessage(messages.noteDescription),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
@@ -390,8 +367,8 @@ function getMenuItems({
|
||||
{
|
||||
text: intl.formatMessage(
|
||||
relationship.showing_reblogs
|
||||
? redesignMessages.hideReblogs
|
||||
: redesignMessages.showReblogs,
|
||||
? messages.hideReblogs
|
||||
: messages.showReblogs,
|
||||
),
|
||||
action: () => {
|
||||
dispatch(
|
||||
@@ -421,7 +398,7 @@ function getMenuItems({
|
||||
items.push(
|
||||
{
|
||||
text: intl.formatMessage(
|
||||
relationship?.muting ? redesignMessages.unmute : redesignMessages.mute,
|
||||
relationship?.muting ? messages.unmute : messages.mute,
|
||||
),
|
||||
action: () => {
|
||||
if (relationship?.muting) {
|
||||
@@ -436,7 +413,7 @@ function getMenuItems({
|
||||
|
||||
if (relationship?.followed_by) {
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.removeFollower),
|
||||
text: intl.formatMessage(messages.removeFollower),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
@@ -468,9 +445,7 @@ function getMenuItems({
|
||||
|
||||
items.push({
|
||||
text: intl.formatMessage(
|
||||
relationship?.blocking
|
||||
? redesignMessages.unblock
|
||||
: redesignMessages.block,
|
||||
relationship?.blocking ? messages.unblock : messages.block,
|
||||
),
|
||||
action: () => {
|
||||
if (relationship?.blocking) {
|
||||
@@ -485,7 +460,7 @@ function getMenuItems({
|
||||
|
||||
if (!account.suspended) {
|
||||
items.push({
|
||||
text: intl.formatMessage(redesignMessages.report),
|
||||
text: intl.formatMessage(messages.report),
|
||||
action: () => {
|
||||
dispatch(initReport(account));
|
||||
},
|
||||
@@ -498,8 +473,8 @@ function getMenuItems({
|
||||
items.push(null, {
|
||||
text: intl.formatMessage(
|
||||
relationship?.domain_blocking
|
||||
? redesignMessages.domainUnblock
|
||||
: redesignMessages.domainBlock,
|
||||
? messages.domainUnblock
|
||||
: messages.domainBlock,
|
||||
{
|
||||
domain: remoteDomain,
|
||||
},
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"account.blocked": "Blocked",
|
||||
"account.cancel_follow_request": "Cancel follow",
|
||||
"account.copy": "Copy link to profile",
|
||||
"account.direct": "Privately mention @{name}",
|
||||
"account.disable_notifications": "Stop notifying me when @{name} posts",
|
||||
"account.edit_note": "Edit personal note",
|
||||
"account.edit_profile": "Edit profile",
|
||||
@@ -68,7 +67,6 @@
|
||||
"account.follows_you": "Follows you",
|
||||
"account.go_to_profile": "Go to profile",
|
||||
"account.hame.invalid_handle": "Handle unavailable",
|
||||
"account.hide_reblogs": "Hide boosts from @{name}",
|
||||
"account.in_memoriam": "In Memoriam.",
|
||||
"account.join_modal.day": "Day",
|
||||
"account.join_modal.me": "You joined {server} on",
|
||||
@@ -86,7 +84,6 @@
|
||||
"account.link_verified_on": "Ownership of this link was checked on {date}",
|
||||
"account.locked_info": "This account privacy status is set to locked. The owner manually reviews who can follow them.",
|
||||
"account.media": "Media",
|
||||
"account.mention": "Mention @{name}",
|
||||
"account.menu.add_to_collection": "Add to collection…",
|
||||
"account.menu.add_to_list": "Add to list…",
|
||||
"account.menu.block": "Block account",
|
||||
@@ -96,6 +93,7 @@
|
||||
"account.menu.direct": "Privately mention",
|
||||
"account.menu.hide_reblogs": "Hide boosts in timeline",
|
||||
"account.menu.mention": "Mention",
|
||||
"account.menu.message": "Message",
|
||||
"account.menu.mute": "Mute account",
|
||||
"account.menu.note.description": "Visible only to you",
|
||||
"account.menu.open_original_page": "View on {domain}",
|
||||
@@ -135,11 +133,8 @@
|
||||
"account.open_original_page": "Open original page",
|
||||
"account.pending": "Pending",
|
||||
"account.posts": "Posts",
|
||||
"account.remove_from_followers": "Remove {name} from followers",
|
||||
"account.report": "Report @{name}",
|
||||
"account.requested_follow": "{name} has requested to follow you",
|
||||
"account.share": "Share @{name}'s profile",
|
||||
"account.show_reblogs": "Show boosts from @{name}",
|
||||
"account.statuses_counter": "{count, plural, one {{counter} post} other {{counter} posts}}",
|
||||
"account.timeline.pinned": "Pinned",
|
||||
"account.timeline.pinned.view_all": "View all pinned posts",
|
||||
|
||||
Reference in New Issue
Block a user