From 373febf707ea7c09073bc560ba97176cb740e2b5 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Fri, 3 Mar 2023 14:27:01 +0800 Subject: [PATCH] feat(console): add delete account dialog in profile page (#3276) --- .../DeleteAccountModal/index.module.scss | 17 ++++++ .../containers/DeleteAccountModal/index.tsx | 59 +++++++++++++++++++ packages/console/src/pages/Profile/index.tsx | 11 +++- .../en/translation/admin-console/profile.ts | 2 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 packages/console/src/pages/Profile/containers/DeleteAccountModal/index.module.scss create mode 100644 packages/console/src/pages/Profile/containers/DeleteAccountModal/index.tsx diff --git a/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.module.scss b/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.module.scss new file mode 100644 index 000000000..4d8263c78 --- /dev/null +++ b/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.module.scss @@ -0,0 +1,17 @@ +@use '@/scss/underscore' as _; + +.container { + font: var(--font-body-2); +} + +p { + margin: 0; +} + +p + p { + margin-top: _.unit(6); +} + +.mail { + font-weight: bold; +} diff --git a/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.tsx b/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.tsx new file mode 100644 index 000000000..370d2364e --- /dev/null +++ b/packages/console/src/pages/Profile/containers/DeleteAccountModal/index.tsx @@ -0,0 +1,59 @@ +import { Trans, useTranslation } from 'react-i18next'; +import ReactModal from 'react-modal'; + +import Button from '@/components/Button'; +import ModalLayout from '@/components/ModalLayout'; +import * as modalStyles from '@/scss/modal.module.scss'; + +import * as styles from './index.module.scss'; + +type Props = { + isOpen: boolean; + onClose: () => void; +}; + +const contactUsEmail = 'logto@silverhand.io'; +const mailToLink = `mailto:${contactUsEmail}?subject=Account%20Deletion%20Request`; + +const DeleteAccountModal = ({ isOpen, onClose }: Props) => { + const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); + + return ( + { + onClose(); + }} + > + } + onClose={() => { + onClose(); + }} + > +
+

{t('profile.delete_account.dialog_paragraph_1')}

+

+ + ), + }} + > + {t('profile.delete_account.dialog_paragraph_2', { mail: contactUsEmail })} + +

+

{t('profile.delete_account.dialog_paragraph_3')}

+
+
+
+ ); +}; + +export default DeleteAccountModal; diff --git a/packages/console/src/pages/Profile/index.tsx b/packages/console/src/pages/Profile/index.tsx index b31f92d59..561cf6b8e 100644 --- a/packages/console/src/pages/Profile/index.tsx +++ b/packages/console/src/pages/Profile/index.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; @@ -10,12 +11,14 @@ import * as resourcesStyles from '@/scss/resources.module.scss'; import BasicUserInfoSection from './components/BasicUserInfoSection'; import CardContent from './components/CardContent'; import Section from './components/Section'; +import DeleteAccountModal from './containers/DeleteAccountModal'; import * as styles from './index.module.scss'; const Profile = () => { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const navigate = useNavigate(); const [user, fetchUser] = useLogtoUserInfo(); + const [showDeleteAccountModal, setShowDeleteAccountModal] = useState(false); if (!user) { return null; @@ -68,10 +71,16 @@ const Profile = () => {