From 34085bfbcef2eacae1b8886dbd9ee2f50c93caf8 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Tue, 10 Dec 2024 16:39:15 +0000 Subject: [PATCH 1/4] Upgrading from Hobby to Pro displays a dialog to confirm --- ...ces.orgs.$organizationSlug.select-plan.tsx | 88 ++++++++++++++----- 1 file changed, 66 insertions(+), 22 deletions(-) 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..53c80582ac 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,66 @@ export function TierPro({ - + {subscription?.plan !== undefined && + subscription?.plan?.title === "Hobby" && + 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. + +
+ + + + +
+
+ ) : ( + + )}