From e5c6999b949cc66b42e8210d866cdebe737ccd44 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 11 Oct 2024 13:51:47 +0530 Subject: [PATCH] Exit section --- .../src/components/DeleteAccountModal.tsx | 156 +++++++++--------- .../photos/src/components/Sidebar/index.tsx | 30 ++-- 2 files changed, 87 insertions(+), 99 deletions(-) diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsx index 795d96bfb3..51e05086a1 100644 --- a/web/apps/photos/src/components/DeleteAccountModal.tsx +++ b/web/apps/photos/src/components/DeleteAccountModal.tsx @@ -116,87 +116,85 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => { }; return ( - <> - + + initialValues={{ + reason: "", + feedback: "", + }} + validationSchema={Yup.object().shape({ + reason: Yup.string().required(t("required")), + })} + validateOnChange={false} + validateOnBlur={false} + onSubmit={initiateDelete} > - - initialValues={{ - reason: "", - feedback: "", - }} - validationSchema={Yup.object().shape({ - reason: Yup.string().required(t("required")), - })} - validateOnChange={false} - validateOnBlur={false} - onSubmit={initiateDelete} - > - {({ - values, - errors, - handleChange, - handleSubmit, - }): JSX.Element => ( -
- - - - - - - {t("delete_account_confirm")} - - - {t("cancel")} - - + {({ + values, + errors, + handleChange, + handleSubmit, + }): JSX.Element => ( + + + + + + + + {t("delete_account_confirm")} + + + {t("cancel")} + - - )} - -
- + + + )} + + ); }; diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx index 118af9780c..db393b0056 100644 --- a/web/apps/photos/src/components/Sidebar/index.tsx +++ b/web/apps/photos/src/components/Sidebar/index.tsx @@ -612,43 +612,33 @@ const HelpSection: React.FC = () => { }; const ExitSection: React.FC = () => { - const { setDialogMessage, logout } = useContext(AppContext); + const { showMiniDialog, logout } = useContext(AppContext); - const [deleteAccountModalView, setDeleteAccountModalView] = useState(false); + const { show: showDeleteAccount, props: deleteAccountVisibilityProps } = + useModalVisibility(); - const closeDeleteAccountModal = () => setDeleteAccountModalView(false); - const openDeleteAccountModal = () => setDeleteAccountModalView(true); - - const confirmLogout = () => { - setDialogMessage({ + const handleLogout = () => + showMiniDialog({ title: t("logout_message"), - proceed: { - text: t("logout"), - action: logout, - variant: "critical", - }, - close: { text: t("cancel") }, + continue: { text: t("logout"), color: "critical", action: logout }, + buttonDirection: "row" }); - }; return ( <> - + ); };