From 876cdc987c3d887e7bcd5ebb605ca88f8e6548ef Mon Sep 17 00:00:00 2001 From: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Date: Wed, 29 Nov 2023 19:12:12 +0530 Subject: [PATCH] style: deactivate acount modal (#2940) --- .../account/deactivate-account-modal.tsx | 65 ++++++------------- 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/web/components/account/deactivate-account-modal.tsx b/web/components/account/deactivate-account-modal.tsx index 906ed9682..260526275 100644 --- a/web/components/account/deactivate-account-modal.tsx +++ b/web/components/account/deactivate-account-modal.tsx @@ -1,9 +1,7 @@ import React, { useState } from "react"; import { useRouter } from "next/router"; -import { mutate } from "swr"; -import { useTheme } from "next-themes"; import { Dialog, Transition } from "@headlessui/react"; -import { AlertTriangle } from "lucide-react"; +import { Trash2 } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // ui @@ -20,45 +18,21 @@ export const DeactivateAccountModal: React.FC = (props) => { const { isOpen, onClose } = props; // states - const [switchingAccount, setSwitchingAccount] = useState(false); const [isDeactivating, setIsDeactivating] = useState(false); const { - user: { deactivateAccount, signOut }, + user: { deactivateAccount }, } = useMobxStore(); const router = useRouter(); - const { setTheme } = useTheme(); - const { setToastAlert } = useToast(); const handleClose = () => { - setSwitchingAccount(false); setIsDeactivating(false); onClose(); }; - const handleSwitchAccount = async () => { - setSwitchingAccount(true); - - await signOut() - .then(() => { - mutate("CURRENT_USER_DETAILS", null); - setTheme("system"); - router.push("/"); - handleClose(); - }) - .catch(() => - setToastAlert({ - type: "error", - title: "Error!", - message: "Failed to sign out. Please try again.", - }) - ) - .finally(() => setSwitchingAccount(false)); - }; - const handleDeleteAccount = async () => { setIsDeactivating(true); @@ -67,7 +41,7 @@ export const DeactivateAccountModal: React.FC = (props) => { setToastAlert({ type: "success", title: "Success!", - message: "Account deleted successfully.", + message: "Account deactivated successfully.", }); handleClose(); router.push("/"); @@ -108,32 +82,31 @@ export const DeactivateAccountModal: React.FC = (props) => { leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
-
+
-
+
+ + Deactivate your account? + +

+ Once deactivated, you can{"'"}t be assigned issues and be billed for your workspace.To + reactivate your account, you will need an invite to a workspace at this email address. +

- - Deactivate account? - -
- -
-
    -
  • Deactivate this account if you have another and won{"'"}t use this account.
  • -
  • Switch to another account if you{"'"}d like to come back to this account another time.
  • -
- -