From b85280ca6538396ba9fd7337f5b7d56971cdae5c Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Thu, 23 May 2024 15:37:06 +0530 Subject: [PATCH 1/3] chore: `switch account` modal revamp. --- packages/ui/src/button/helper.tsx | 6 +- .../onboarding/create-or-join-workspaces.tsx | 6 +- web/components/onboarding/index.ts | 4 +- web/components/onboarding/invite-members.tsx | 6 +- web/components/onboarding/profile-setup.tsx | 6 +- ...opdown.tsx => switch-account-dropdown.tsx} | 8 +-- ...unt-modal.tsx => switch-account-modal.tsx} | 71 ++++++------------- 7 files changed, 38 insertions(+), 69 deletions(-) rename web/components/onboarding/{switch-or-delete-account-dropdown.tsx => switch-account-dropdown.tsx} (87%) rename web/components/onboarding/{switch-delete-account-modal.tsx => switch-account-modal.tsx} (61%) diff --git a/packages/ui/src/button/helper.tsx b/packages/ui/src/button/helper.tsx index 0378b0334da..ae9e85359f0 100644 --- a/packages/ui/src/button/helper.tsx +++ b/packages/ui/src/button/helper.tsx @@ -44,9 +44,9 @@ export const buttonStyling: IButtonStyling = { disabled: `cursor-not-allowed !bg-custom-primary-60 hover:bg-custom-primary-60`, }, "accent-primary": { - default: `bg-custom-primary-10 text-custom-primary-100`, - hover: `hover:bg-custom-primary-20 hover:text-custom-primary-200`, - pressed: `focus:bg-custom-primary-20`, + default: `bg-custom-primary-100/20 text-custom-primary-100`, + hover: `hover:bg-custom-primary-100/10 hover:text-custom-primary-200`, + pressed: `focus:bg-custom-primary-100/10`, disabled: `cursor-not-allowed !text-custom-primary-60`, }, "outline-primary": { diff --git a/web/components/onboarding/create-or-join-workspaces.tsx b/web/components/onboarding/create-or-join-workspaces.tsx index 1f0bd5c6968..b8885718655 100644 --- a/web/components/onboarding/create-or-join-workspaces.tsx +++ b/web/components/onboarding/create-or-join-workspaces.tsx @@ -6,7 +6,7 @@ import { useTheme } from "next-themes"; // types import { IWorkspaceMemberInvitation, TOnboardingSteps } from "@plane/types"; // components -import { Invitations, OnboardingHeader, SwitchOrDeleteAccountDropdown, CreateWorkspace } from "@/components/onboarding"; +import { Invitations, OnboardingHeader, SwitchAccountDropdown, CreateWorkspace } from "@/components/onboarding"; // hooks import { useUser } from "@/hooks/store"; // assets @@ -55,7 +55,7 @@ export const CreateOrJoinWorkspaces: React.FC = observer((props) => {
- +
@@ -79,7 +79,7 @@ export const CreateOrJoinWorkspaces: React.FC = observer((props) => {
- +
Promise; @@ -366,7 +366,7 @@ export const InviteMembers: React.FC = (props) => { {/* Since this will always be the last step */}
- +
@@ -433,7 +433,7 @@ export const InviteMembers: React.FC = (props) => {
- +
= observer((props) => {
- +
@@ -567,7 +567,7 @@ export const ProfileSetup: React.FC = observer((props) => {
- +
{profileSetupStep === EProfileSetupSteps.USER_PERSONALIZATION ? ( = observer((props) => { +export const SwitchAccountDropdown: FC = observer((props) => { const { fullName } = props; // states const [showDeleteAccountModal, setShowDeleteAccountModal] = useState(false); @@ -30,7 +30,7 @@ export const SwitchOrDeleteAccountDropdown: FC - setShowDeleteAccountModal(false)} /> + setShowDeleteAccountModal(false)} />
{user?.avatar && ( void; }; -export const SwitchOrDeleteAccountModal: React.FC = (props) => { +export const SwitchAccountModal: React.FC = (props) => { const { isOpen, onClose } = props; // states const [switchingAccount, setSwitchingAccount] = useState(false); - const [isDeactivating, setIsDeactivating] = useState(false); // router const router = useRouter(); // store hooks - const { signOut, deactivateAccount } = useUser(); + const { data: userData, signOut } = useUser(); const { setTheme } = useTheme(); const handleClose = () => { setSwitchingAccount(false); - setIsDeactivating(false); onClose(); }; @@ -51,32 +48,6 @@ export const SwitchOrDeleteAccountModal: React.FC = (props) => { .finally(() => setSwitchingAccount(false)); }; - const handleDeactivateAccount = async () => { - setIsDeactivating(true); - - await deactivateAccount() - .then(() => { - setToast({ - type: TOAST_TYPE.SUCCESS, - title: "Success!", - message: "Account deleted successfully.", - }); - mutate("CURRENT_USER_DETAILS", null); - signOut(); - setTheme("system"); - router.push("/"); - handleClose(); - }) - .catch((err: any) => - setToast({ - type: TOAST_TYPE.ERROR, - title: "Error!", - message: err?.error, - }) - ) - .finally(() => setIsDeactivating(false)); - }; - return ( @@ -104,32 +75,30 @@ export const SwitchOrDeleteAccountModal: React.FC = (props) => { leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > -
-
-
-
-