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

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