From a9b1a37054825cbcc71245ac8e30ecca9fe1bb23 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:00:35 -0700 Subject: [PATCH] Username deletion UI --- _locales/en/messages.json | 2 +- ts/components/ProfileEditor.stories.tsx | 4 ---- ts/components/ProfileEditor.tsx | 20 +------------------- ts/components/ProfileEditorModal.tsx | 2 -- ts/state/smart/ProfileEditorModal.tsx | 3 --- 5 files changed, 2 insertions(+), 29 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 52315a4b4bb..9298d6dce44 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -5608,7 +5608,7 @@ }, "icu:ProfileEditor--username--delete-unavailable-notice": { "messageformat": "To delete your username, open Signal on your phone and navigate to Settings > Profile.", - "description": "Shown in dialog body if user is trying to delete username, but it is only supported on mobile" + "description": "(Deleted 2024/06/04) Shown in dialog body if user is trying to delete username, but it is only supported on mobile" }, "icu:ProfileEditor--username--context-menu": { "messageformat": "Copy or delete username", diff --git a/ts/components/ProfileEditor.stories.tsx b/ts/components/ProfileEditor.stories.tsx index b5b3fb18c3c..5edcb60833d 100644 --- a/ts/components/ProfileEditor.stories.tsx +++ b/ts/components/ProfileEditor.stories.tsx @@ -44,9 +44,6 @@ export default { usernameLinkCorrupted: { control: 'boolean', }, - isUsernameDeletionEnabled: { - control: 'boolean', - }, }, args: { aboutEmoji: '', @@ -63,7 +60,6 @@ export default { usernameLinkColor: Proto.AccountRecord.UsernameLink.Color.PURPLE, usernameEditState: UsernameEditState.Editing, usernameLinkState: UsernameLinkState.Ready, - isUsernameDeletionEnabled: true, recentEmojis: [], skinTone: 0, diff --git a/ts/components/ProfileEditor.tsx b/ts/components/ProfileEditor.tsx index ee3cc711640..809aab6a203 100644 --- a/ts/components/ProfileEditor.tsx +++ b/ts/components/ProfileEditor.tsx @@ -88,7 +88,6 @@ export type PropsDataType = { usernameLinkColor?: number; usernameLink?: string; usernameLinkCorrupted: boolean; - isUsernameDeletionEnabled: boolean; } & Pick; type PropsActionType = { @@ -176,7 +175,6 @@ export function ProfileEditor({ usernameLinkColor, usernameLink, usernameLinkCorrupted, - isUsernameDeletionEnabled, }: PropsType): JSX.Element { const focusInputRef = useRef(null); const [editState, setEditState] = useState(initialEditState); @@ -210,7 +208,6 @@ export function ProfileEditor({ firstName, }); const [isResettingUsername, setIsResettingUsername] = useState(false); - const [isUsernameNoticeVisible, setIsUsernameNoticeVisible] = useState(false); const [isResettingUsernameLink, setIsResettingUsernameLink] = useState(false); // Reset username edit state when leaving @@ -568,11 +565,7 @@ export function ProfileEditor({ icon: 'ProfileEditor__username-menu__trash-icon', label: i18n('icu:ProfileEditor--username--delete'), onClick: () => { - if (isUsernameDeletionEnabled) { - setUsernameEditState(UsernameEditState.ConfirmingDelete); - } else { - setIsUsernameNoticeVisible(true); - } + setUsernameEditState(UsernameEditState.ConfirmingDelete); }, }, ]; @@ -767,17 +760,6 @@ export function ProfileEditor({ )} - {isUsernameNoticeVisible && ( - setIsUsernameNoticeVisible(false)} - cancelText={i18n('icu:ok')} - > - {i18n('icu:ProfileEditor--username--delete-unavailable-notice')} - - )} - {confirmDiscardAction && (