Username deletion UI

This commit is contained in:
Fedor Indutny 2024-06-04 10:00:35 -07:00 committed by GitHub
parent 965e78d129
commit a9b1a37054
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2 additions and 29 deletions

View file

@ -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",

View file

@ -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,

View file

@ -88,7 +88,6 @@ export type PropsDataType = {
usernameLinkColor?: number;
usernameLink?: string;
usernameLinkCorrupted: boolean;
isUsernameDeletionEnabled: boolean;
} & Pick<EmojiButtonProps, 'recentEmojis' | 'skinTone'>;
type PropsActionType = {
@ -176,7 +175,6 @@ export function ProfileEditor({
usernameLinkColor,
usernameLink,
usernameLinkCorrupted,
isUsernameDeletionEnabled,
}: PropsType): JSX.Element {
const focusInputRef = useRef<HTMLInputElement | null>(null);
const [editState, setEditState] = useState<EditState>(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({
</ConfirmationDialog>
)}
{isUsernameNoticeVisible && (
<ConfirmationDialog
dialogName="ProfileEditor.confirmDeleteUsername"
i18n={i18n}
onClose={() => setIsUsernameNoticeVisible(false)}
cancelText={i18n('icu:ok')}
>
{i18n('icu:ProfileEditor--username--delete-unavailable-notice')}
</ConfirmationDialog>
)}
{confirmDiscardAction && (
<ConfirmDiscardDialog
i18n={i18n}

View file

@ -36,7 +36,6 @@ export function ProfileEditorModal({
hasError,
i18n,
initialEditState,
isUsernameDeletionEnabled,
markCompletedUsernameLinkOnboarding,
myProfileChanged,
onSetSkinTone,
@ -109,7 +108,6 @@ export function ProfileEditorModal({
hasCompletedUsernameLinkOnboarding={hasCompletedUsernameLinkOnboarding}
i18n={i18n}
initialEditState={initialEditState}
isUsernameDeletionEnabled={isUsernameDeletionEnabled}
markCompletedUsernameLinkOnboarding={
markCompletedUsernameLinkOnboarding
}

View file

@ -21,7 +21,6 @@ import {
getUsernameLink,
getUsernameLinkColor,
getUsernameLinkCorrupted,
isInternalUser,
} from '../selectors/items';
import { getIntl } from '../selectors/user';
import {
@ -55,7 +54,6 @@ export const SmartProfileEditorModal = memo(function SmartProfileEditorModal() {
);
const hasError = useSelector(getProfileEditorHasError);
const initialEditState = useSelector(getProfileEditorInitialEditState);
const isUsernameDeletionEnabled = useSelector(isInternalUser);
const recentEmojis = useSelector(selectRecentEmojis);
const skinTone = useSelector(getEmojiSkinTone);
const usernameCorrupted = useSelector(getUsernameCorrupted);
@ -99,7 +97,6 @@ export const SmartProfileEditorModal = memo(function SmartProfileEditorModal() {
hasError={hasError}
i18n={i18n}
initialEditState={initialEditState}
isUsernameDeletionEnabled={isUsernameDeletionEnabled}
markCompletedUsernameLinkOnboarding={markCompletedUsernameLinkOnboarding}
myProfileChanged={myProfileChanged}
onSetSkinTone={onSetSkinTone}