From 23ff398994b67b73be1cf7e7ff79dab4603d8a81 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Tue, 3 Jun 2025 10:17:45 +0000 Subject: [PATCH] feat(mobile): add delete account function (#12688) ## Summary by CodeRabbit - **New Features** - Introduced a "Delete my account" option in mobile settings with role-based warnings and confirmation modals. - **Enhancements** - Added flexible row and reverse row layout options for modal footers and action buttons on mobile. - **Localization** - Added English translation for the "Delete my account" setting. - **Style** - Updated styles for modal footers and action buttons on mobile. - Added styling for account deletion dialog descriptions. --- .../src/ui/modal/confirm-modal.css.ts | 16 ++ .../component/src/ui/modal/confirm-modal.tsx | 18 +- .../setting/others/delete-account.css.ts | 7 + .../dialogs/setting/others/delete-account.tsx | 180 ++++++++++++++++++ .../mobile/dialogs/setting/others/index.tsx | 2 + packages/frontend/i18n/src/i18n.gen.ts | 4 + packages/frontend/i18n/src/resources/en.json | 1 + 7 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/core/src/mobile/dialogs/setting/others/delete-account.css.ts create mode 100644 packages/frontend/core/src/mobile/dialogs/setting/others/delete-account.tsx diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.css.ts b/packages/frontend/component/src/ui/modal/confirm-modal.css.ts index df56bd3f27..bb09f11314 100644 --- a/packages/frontend/component/src/ui/modal/confirm-modal.css.ts +++ b/packages/frontend/component/src/ui/modal/confirm-modal.css.ts @@ -67,9 +67,16 @@ export const mobileStyles = { flexDirection: 'column', gap: 16, selectors: { + '&.row': { + flexDirection: 'row', + justifyContent: 'space-between', + }, '&.reverse': { flexDirection: 'column-reverse', }, + '&.rowReverse': { + flexDirection: 'row-reverse', + }, }, }), action: style([ @@ -80,6 +87,15 @@ export const mobileStyles = { borderRadius: 8, fontSize: 17, fontWeight: 400, + selectors: { + '&.row': { + width: 'auto', + minWidth: 0, + maxWidth: 140, + flex: 1, + height: 32, + }, + }, }, ]), }; diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.tsx b/packages/frontend/component/src/ui/modal/confirm-modal.tsx index e50d8649cf..c1319a20de 100644 --- a/packages/frontend/component/src/ui/modal/confirm-modal.tsx +++ b/packages/frontend/component/src/ui/modal/confirm-modal.tsx @@ -21,6 +21,11 @@ export interface ConfirmModalProps extends ModalProps { cancelText?: React.ReactNode; cancelButtonOptions?: Omit; reverseFooter?: boolean; + /** + * Whether to use row layout for mobile footer + * @default false + */ + rowFooter?: boolean; /** * Auto focus on confirm button when modal opened * @default true @@ -45,6 +50,7 @@ export const ConfirmModal = ({ descriptionClassName, childrenContentClassName, contentOptions, + rowFooter = false, ...props }: ConfirmModalProps) => { const onConfirmClick = useCallback(() => { @@ -84,13 +90,17 @@ export const ConfirmModal = ({
{onCancel !== false ? (