diff --git a/studio/components/interfaces/Billing/EnterpriseRequest.tsx b/studio/components/interfaces/Billing/EnterpriseRequest.tsx new file mode 100644 index 00000000000..2d581cfb5fb --- /dev/null +++ b/studio/components/interfaces/Billing/EnterpriseRequest.tsx @@ -0,0 +1,66 @@ +import { FC } from 'react' +import { Transition } from '@headlessui/react' +import { Button, Form, Input, IconArrowLeft } from '@supabase/ui' + +interface Props { + visible: boolean + onSelectBack: () => void +} + +const EnterpriseRequest: FC = ({ visible, onSelectBack }) => { + const initialValues = { + name: '', + email: '', + company: '', + message: '', + } + + return ( + +
+
+
+ +
+
+

Customised plans tailored for your business needs

+

+ Let us know a few details and we’ll be in contact with you! +

+
+
{}} + validate={(values) => {}} + > + {({ isSubmitting }: { isSubmitting: boolean }) => ( +
+ + + + +
+ )} +
+
+
+
+ ) +} + +export default EnterpriseRequest diff --git a/studio/components/interfaces/Billing/PlanSelection/PlanSelection.tsx b/studio/components/interfaces/Billing/PlanSelection/PlanSelection.tsx new file mode 100644 index 00000000000..2c0dfbbe8ec --- /dev/null +++ b/studio/components/interfaces/Billing/PlanSelection/PlanSelection.tsx @@ -0,0 +1,46 @@ +import Link from 'next/link' +import { FC } from 'react' +import { Loading } from '@supabase/ui' +import { Transition } from '@headlessui/react' + +import Plans from './Plans/Plans' +import { BillingPlan } from './Plans/Plans.types' +import { StripeSubscription } from '..' + +interface Props { + visible: boolean + billingPlans: BillingPlan[] + currentPlan?: StripeSubscription + onSelectPlan: (plan: BillingPlan) => void +} + +const PlanSelection: FC = ({ visible, billingPlans, currentPlan, onSelectPlan }) => { + return ( + +
+

Change your project's subscription

+ {/* FE will make a call to fetch all plans first at the page level */} + + + +
+ + + See detailed comparisons across plans + + +
+
+
+ ) +} + +export default PlanSelection diff --git a/studio/components/interfaces/Billing/Plans/PlanCTAButton.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx similarity index 97% rename from studio/components/interfaces/Billing/Plans/PlanCTAButton.tsx rename to studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx index d51c82428f3..81a0867c912 100644 --- a/studio/components/interfaces/Billing/Plans/PlanCTAButton.tsx +++ b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx @@ -3,7 +3,7 @@ import { Button, IconLoader } from '@supabase/ui' import { STRIPE_PRODUCT_IDS } from 'lib/constants' import { BillingPlan } from './Plans.types' -import { StripeSubscription } from '../index' +import { StripeSubscription } from '../../index' interface Props { plan: BillingPlan diff --git a/studio/components/interfaces/Billing/Plans/Plans.constants.ts b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.constants.ts similarity index 100% rename from studio/components/interfaces/Billing/Plans/Plans.constants.ts rename to studio/components/interfaces/Billing/PlanSelection/Plans/Plans.constants.ts diff --git a/studio/components/interfaces/Billing/Plans/Plans.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx similarity index 95% rename from studio/components/interfaces/Billing/Plans/Plans.tsx rename to studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx index 1aa7957505e..d6e5376a58f 100644 --- a/studio/components/interfaces/Billing/Plans/Plans.tsx +++ b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx @@ -2,7 +2,7 @@ import { FC } from 'react' import { Badge } from '@supabase/ui' import { STRIPE_PRODUCT_IDS } from 'lib/constants' -import { StripeSubscription } from '../index' +import { StripeSubscription } from '../../index' import { BillingPlan } from './Plans.types' import PlanCTAButton from './PlanCTAButton' @@ -48,7 +48,7 @@ const Plans: FC = ({ plans, currentPlan, onSelectPlan }) => { {plan.id === STRIPE_PRODUCT_IDS.PRO && } {/* Label to show current subscription */} - {plan.id === currentPlan?.tier.prod_id && } + {plan.id && plan.id === currentPlan?.tier.prod_id && }
diff --git a/studio/components/interfaces/Billing/Plans/Plans.types.ts b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.types.ts similarity index 100% rename from studio/components/interfaces/Billing/Plans/Plans.types.ts rename to studio/components/interfaces/Billing/PlanSelection/Plans/Plans.types.ts diff --git a/studio/components/interfaces/Billing/index.ts b/studio/components/interfaces/Billing/index.ts index ecbde0b031e..942a0ddf5e4 100644 --- a/studio/components/interfaces/Billing/index.ts +++ b/studio/components/interfaces/Billing/index.ts @@ -1,7 +1,8 @@ import PAYGUsage from './PAYGUsage/PAYGUsage' import Subscription from './Subscription/Subscription' -import Plans from './Plans/Plans' +import PlanSelection from './PlanSelection/PlanSelection' +import EnterpriseRequest from './EnterpriseRequest' export * from './Subscription/Subscription.types' export * from './PAYGUsage/PAYGUsage.constants' -export { PAYGUsage, Subscription, Plans } +export { PAYGUsage, Subscription, PlanSelection, EnterpriseRequest } diff --git a/studio/pages/project/[ref]/settings/billing/update.tsx b/studio/pages/project/[ref]/settings/billing/update.tsx index 2a87a7f3c59..0c57d32c6ad 100644 --- a/studio/pages/project/[ref]/settings/billing/update.tsx +++ b/studio/pages/project/[ref]/settings/billing/update.tsx @@ -1,17 +1,15 @@ -import Link from 'next/link' import { NextPage } from 'next' import { useEffect, useState } from 'react' import { observer } from 'mobx-react-lite' -import { Loading } from '@supabase/ui' import { withAuth, useStore } from 'hooks' import { post } from 'lib/common/fetch' import { API_URL } from 'lib/constants' import { BillingLayout } from 'components/layouts' -import { Plans, StripeSubscription } from 'components/interfaces/Billing' +import { PlanSelection, EnterpriseRequest, StripeSubscription } from 'components/interfaces/Billing' -import { BillingPlan } from 'components/interfaces/Billing/Plans/Plans.types' -import { BILLING_PLANS } from 'components/interfaces/Billing/Plans/Plans.constants' +import { BillingPlan } from 'components/interfaces/Billing/PlanSelection/Plans/Plans.types' +import { BILLING_PLANS } from 'components/interfaces/Billing/PlanSelection/Plans/Plans.constants' const BillingUpdate: NextPage = () => { const { ui } = useStore() @@ -19,6 +17,7 @@ const BillingUpdate: NextPage = () => { const [loading, setLoading] = useState(false) const [subscription, setSubscription] = useState() + const [selectedPlan, setSelectedPlan] = useState() useEffect(() => { if (projectRef) getSubscription() @@ -50,26 +49,23 @@ const BillingUpdate: NextPage = () => { } } - const onSelectPlan = (plan: BillingPlan) => { - console.log('Selected plan', plan) - } + /** + * Existing UI bug: Transition isn't smooth between screens, next "state" is getting rendered too early + * Resolve later, don't wanna get stuck now lol + */ return ( -
-

Change your project's subscription

- {/* FE will make a call to fetch all plans first at the page level */} - - - - -
+ + setSelectedPlan(undefined)} + />
) }