From df0eda5024b658fea3f5be0a76bbee4e7d64d62a Mon Sep 17 00:00:00 2001 From: Pamela Chia Date: Fri, 11 Aug 2023 14:17:44 +0800 Subject: [PATCH] Add CTA depending on subscription plan --- .../ProjectLayout/ProjectPausedState.tsx | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx index 81e4a6e7a39..789358ffa73 100644 --- a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx +++ b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx @@ -13,6 +13,7 @@ import { post } from 'lib/common/fetch' import { API_URL, PROJECT_STATUS } from 'lib/constants' import { Button, IconPauseCircle, Modal } from 'ui' import { useProjectContext } from './ProjectContext' +import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query' export interface ProjectPausedStateProps { product?: string @@ -25,6 +26,8 @@ const ProjectPausedState = ({ product }: ProjectPausedStateProps) => { const selectedOrganization = useSelectedOrganization() const { project } = useProjectContext() const orgSlug = selectedOrganization?.slug + const { data: subscription } = useProjectSubscriptionV2Query({ projectRef: ref }) + const isFreePlan = subscription?.plan.id === 'free' const { data: membersExceededLimit } = useFreeProjectLimitCheckQuery({ slug: orgSlug }) const hasMembersExceedingFreeTierLimit = (membersExceededLimit || []).length > 0 @@ -96,6 +99,11 @@ const ProjectPausedState = ({ product }: ProjectPausedStateProps) => { 'Restore this project and get back to building the next big thing!' )}

+ {isFreePlan && ( +

+ You can also prevent project pausing in the future by upgrading to Pro. +

+ )}
@@ -128,11 +136,21 @@ const ProjectPausedState = ({ product }: ProjectPausedStateProps) => { )} - - - - - + {isFreePlan ? ( + + + + + + ) : ( + + + + + + )}