From 7fc68609e68d38aadfda5c4e539ce9236dda6815 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Thu, 4 Jul 2024 15:47:19 +0100 Subject: [PATCH] Show a prompt to upgrade to get staging in the new env var modal --- .../route.tsx | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.environment-variables.new/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.environment-variables.new/route.tsx index 8d485ea11..01c2b841d 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.environment-variables.new/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.environment-variables.new/route.tsx @@ -54,13 +54,14 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => { try { const presenter = new EnvironmentVariablesPresenter(); - const { environments } = await presenter.call({ + const { environments, hasStaging } = await presenter.call({ userId, projectSlug: projectParam, }); return typedjson({ environments, + hasStaging, }); } catch (error) { throw new Response(undefined, { @@ -164,7 +165,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => { export default function Page() { const [isOpen, setIsOpen] = useState(false); - const { environments } = useTypedLoaderData(); + const { environments, hasStaging } = useTypedLoaderData(); const lastSubmission = useActionData(); const navigation = useNavigation(); const navigate = useNavigate(); @@ -229,26 +230,27 @@ export default function Page() { variant="button" /> ))} - - - - - - - - Staging - - - - - - Upgrade your plan to add a Staging environment. - - - + {!hasStaging && ( + + + + + + + Staging + + + + + + Upgrade your plan to add a Staging environment. + + + + )} {environmentIds.error} @@ -309,6 +311,7 @@ export default function Page() { Cancel } + className="mt-2" />