Username deletion UI
This commit is contained in:
parent
965e78d129
commit
a9b1a37054
5 changed files with 2 additions and 29 deletions
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue