From c58f6f7a683682060fab99151acd81aebd78e60c Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Fri, 13 Dec 2024 11:14:47 +0000 Subject: [PATCH] Upgrading from Hobby to Pro displays a dialog to confirm (#1545) * Upgrading from Hobby to Pro displays a dialog to confirm * Improved the logic for upgrading to pro * Added the spinner component to storybook * Improved the dark style spinner --- .../app/components/primitives/Spinner.tsx | 4 +- ...ces.orgs.$organizationSlug.select-plan.tsx | 89 ++++++++++++++----- .../app/routes/storybook.spinner/route.tsx | 28 ++++++ apps/webapp/app/routes/storybook/route.tsx | 4 + 4 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 apps/webapp/app/routes/storybook.spinner/route.tsx diff --git a/apps/webapp/app/components/primitives/Spinner.tsx b/apps/webapp/app/components/primitives/Spinner.tsx index 1cf3c47adc..b9a6961236 100644 --- a/apps/webapp/app/components/primitives/Spinner.tsx +++ b/apps/webapp/app/components/primitives/Spinner.tsx @@ -26,8 +26,8 @@ export function Spinner({ foreground: "#3C4B62", }, dark: { - background: "#15171A", - foreground: "#272A2E", + background: "rgba(18, 19, 23, 0.35)", + foreground: "#1A1B1F", }, }; diff --git a/apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx b/apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx index 10fb8ad707..4f71288991 100644 --- a/apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx +++ b/apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx @@ -5,7 +5,7 @@ import { ShieldCheckIcon, XMarkIcon, } from "@heroicons/react/20/solid"; -import { ArrowDownCircleIcon } from "@heroicons/react/24/outline"; +import { ArrowDownCircleIcon, ArrowUpCircleIcon } from "@heroicons/react/24/outline"; import { Form, useLocation, useNavigation } from "@remix-run/react"; import { ActionFunctionArgs } from "@remix-run/server-runtime"; import { uiComponent } from "@team-plain/typescript-sdk"; @@ -633,6 +633,11 @@ export function TierPro({ const navigation = useNavigation(); const formAction = `/resources/orgs/${organizationSlug}/select-plan`; const isLoading = navigation.formAction === formAction; + const [isDialogOpen, setIsDialogOpen] = useState(false); + + useEffect(() => { + setIsDialogOpen(false); + }, [subscription]); return ( @@ -645,27 +650,67 @@ export function TierPro({ - + {subscription?.plan !== undefined && + subscription?.plan?.type === "paid" && + subscription?.plan?.code !== plan.code && + subscription.canceledAt === undefined ? ( + + + + + + Upgrade plan? +
+ + + + + Are you sure you want to upgrade to the Pro plan? You will be charged the new + plan price for the remainder of this month on a pro rata basis. + +
+ + + + +
+
+ ) : ( + + )}