The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Update settings page to use new scaffold layout component
Joshen Limb4a3e48bb977
diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/BillingAddress/BillingAddress.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/BillingAddress/BillingAddress.tsxindex 421c4bb7f3b..d1bf4e11422 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/BillingAddress/BillingAddress.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/BillingAddress/BillingAddress.tsx@@ -3,13 +3,14 @@ import { useEffect } from 'react'import { useParams } from 'common'import {- FormActions,- FormPanel,- FormSection,- FormSectionContent,- FormSectionLabel,-} from 'components/ui/Forms'+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import AlertError from 'components/ui/AlertError'+import { FormActions, FormPanel, FormSection, FormSectionContent } from 'components/ui/Forms'import NoPermission from 'components/ui/NoPermission'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useOrganizationCustomerProfileQuery } from 'data/organizations/organization-customer-profile-query'import { useOrganizationCustomerProfileUpdateMutation } from 'data/organizations/organization-customer-profile-update-mutation'import { useCheckPermissions, useStore } from 'hooks'@@ -19,7 +20,9 @@ import { COUNTRIES } from './BillingAddress.constants'const BillingAddress = () => {const { ui } = useStore()const { slug } = useParams()- const { data, isLoading, isSuccess } = useOrganizationCustomerProfileQuery({ slug })+ const { data, error, isLoading, isSuccess, isError } = useOrganizationCustomerProfileQuery({+ slug,+ })const { mutateAsync: updateCustomerProfile } = useOrganizationCustomerProfileUpdateMutation()const formId = 'billing-address-form'@@ -58,122 +61,138 @@ const BillingAddress = () => {}return (- <FormSection- id="address"- header={- <FormSectionLabel>- <div className="sticky top-16">- <p className="text-base">Billing Address</p>- <p className="text-sm text-scale-1000">This will be reflected in every invoice</p>- </div>- </FormSectionLabel>- }- >- <FormSectionContent loading={false}>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky top-16">+ <p className="text-base">Billing Address</p>+ <p className="text-sm text-scale-1000">This will be reflected in every invoice</p>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>{!canReadBillingAddress ? (<NoPermission resourceText="view this organization's billing address" />) : (- <Form validateOnBlur id={formId} initialValues={initialValues} onSubmit={onSubmit}>- {({ isSubmitting, values, initialValues, handleReset, resetForm }: any) => {- const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)+ <>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}- // eslint-disable-next-line react-hooks/rules-of-hooks- useEffect(() => {- if (isSuccess && data !== undefined) {- const { city, country, line1, line2, postal_code, state } = data?.address ?? {}- const values = { city, country, line1, line2, postal_code, state }- resetForm({ values, initialValues: values })- }+ {isError && (+ <AlertError+ subject="Unable to retrieve organization customer profile"+ error={error as any}+ />+ )}- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [isSuccess])+ {isSuccess && (+ <Form validateOnBlur id={formId} initialValues={initialValues} onSubmit={onSubmit}>+ {({ isSubmitting, values, initialValues, handleReset, resetForm }: any) => {+ const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)- return (- <FormPanel- footer={- <div className="flex py-4 px-8">- <FormActions- form={formId}- isSubmitting={isSubmitting}- hasChanges={hasChanges}- handleReset={handleReset}- helper={- !canUpdateBillingAddress- ? "You need additional permissions to manage this organization's billing address"- : undefined- }- />- </div>- }- >- <FormSection>- <FormSectionContent fullWidth loading={isLoading} className="!gap-2">- <Input- id="line1"- name="line1"- placeholder="Address line 1"- disabled={!canUpdateBillingAddress}- />- <Input- id="line2"- name="line2"- placeholder="Address line 2"- disabled={!canUpdateBillingAddress}- />- <div className="flex items-center space-x-2">- <Listbox- className="w-full"- id="country"- name="country"- placeholder="Country"- disabled={!canUpdateBillingAddress}- >- <Listbox.Option label="---" key="empty" value="">- ---- </Listbox.Option>- {COUNTRIES.map((country) => (- <Listbox.Option- label={country.name}- key={country.code}- value={country.code}+ // eslint-disable-next-line react-hooks/rules-of-hooks+ useEffect(() => {+ if (isSuccess && data !== undefined) {+ const { city, country, line1, line2, postal_code, state } =+ data?.address ?? {}+ const values = { city, country, line1, line2, postal_code, state }+ resetForm({ values, initialValues: values })+ }++ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [isSuccess])++ return (+ <FormPanel+ footer={+ <div className="flex py-4 px-8">+ <FormActions+ form={formId}+ isSubmitting={isSubmitting}+ hasChanges={hasChanges}+ handleReset={handleReset}+ helper={+ !canUpdateBillingAddress+ ? "You need additional permissions to manage this organization's billing address"+ : undefined+ }+ />+ </div>+ }+ >+ <FormSection>+ <FormSectionContent fullWidth loading={false} className="!gap-2">+ <Input+ id="line1"+ name="line1"+ placeholder="Address line 1"+ disabled={!canUpdateBillingAddress}+ />+ <Input+ id="line2"+ name="line2"+ placeholder="Address line 2"+ disabled={!canUpdateBillingAddress}+ />+ <div className="flex items-center space-x-2">+ <Listbox+ className="w-full"+ id="country"+ name="country"+ placeholder="Country"+ disabled={!canUpdateBillingAddress}>- {country.name}- </Listbox.Option>- ))}- </Listbox>- <Input- className="w-full"- id="postal_code"- name="postal_code"- placeholder="Postal code"- disabled={!canUpdateBillingAddress}- />- </div>- <div className="flex items-center space-x-2">- <Input- className="w-full"- id="city"- name="city"- placeholder="City"- disabled={!canUpdateBillingAddress}- />- <Input- className="w-full"- id="state"- name="state"- placeholder="State"- disabled={!canUpdateBillingAddress}- />- </div>- </FormSectionContent>- </FormSection>- </FormPanel>- )- }}- </Form>+ <Listbox.Option label="---" key="empty" value="">+ ---+ </Listbox.Option>+ {COUNTRIES.map((country) => (+ <Listbox.Option+ label={country.name}+ key={country.code}+ value={country.code}+ >+ {country.name}+ </Listbox.Option>+ ))}+ </Listbox>+ <Input+ className="w-full"+ id="postal_code"+ name="postal_code"+ placeholder="Postal code"+ disabled={!canUpdateBillingAddress}+ />+ </div>+ <div className="flex items-center space-x-2">+ <Input+ className="w-full"+ id="city"+ name="city"+ placeholder="City"+ disabled={!canUpdateBillingAddress}+ />+ <Input+ className="w-full"+ id="state"+ name="state"+ placeholder="State"+ disabled={!canUpdateBillingAddress}+ />+ </div>+ </FormSectionContent>+ </FormSection>+ </FormPanel>+ )+ }}+ </Form>+ )}+ </>)}- </FormSectionContent>- </FormSection>+ </ScaffoldSectionContent>+ </ScaffoldSection>)}diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/BillingEmail.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/BillingEmail.tsxindex 64e90b8a3c5..dbac307c3af 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/BillingEmail.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/BillingEmail.tsx@@ -4,12 +4,11 @@ import { useEffect } from 'react'import { useParams } from 'common'import {- FormActions,- FormPanel,- FormSection,- FormSectionContent,- FormSectionLabel,-} from 'components/ui/Forms'+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import { FormActions, FormPanel, FormSection, FormSectionContent } from 'components/ui/Forms'import { invalidateOrganizationsQuery } from 'data/organizations/organizations-query'import { useCheckPermissions, useSelectedOrganization, useStore } from 'hooks'import { patch } from 'lib/common/fetch'@@ -61,22 +60,18 @@ const BillingEmail = () => {}return (- <FormSection- id="email-correspondence"- header={- <FormSectionLabel>- <div className="sticky space-y-6 top-16">- <div>- <p className="text-base">Email Recipient</p>- <p className="text-sm text-scale-1000">- All billing correspondence will go to this email- </p>- </div>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky space-y-6 top-16">+ <div>+ <p className="text-base">Email Recipient</p>+ <p className="text-sm text-scale-1000">+ All billing correspondence will go to this email+ </p></div>- </FormSectionLabel>- }- >- <FormSectionContent loading={false}>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent><Form id={formId} initialValues={initialValues} onSubmit={onUpdateOrganizationEmail}>{({ isSubmitting, handleReset, values, initialValues, resetForm }: any) => {const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)@@ -87,6 +82,7 @@ const BillingEmail = () => {useEffect(() => {const values = { billing_email: billing_email ?? '' }resetForm({ values, initialValues: values })+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [slug])return (@@ -122,8 +118,8 @@ const BillingEmail = () => {)}}</Form>- </FormSectionContent>- </FormSection>+ </ScaffoldSectionContent>+ </ScaffoldSection>)}diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/CostControl/CostControl.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/CostControl/CostControl.tsxindex 82bc7c6571b..8926d07bde4 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/CostControl/CostControl.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/CostControl/CostControl.tsx@@ -1,14 +1,20 @@import Link from 'next/link'import { useParams, useTheme } from 'common'-import { BASE_PATH } from 'lib/constants'-import { Alert, Button, IconExternalLink } from 'ui'-import SpendCapSidePanel from './SpendCapSidePanel'-import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'+import {+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import AlertError from 'components/ui/AlertError'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'import { useFlag } from 'hooks'+import { BASE_PATH } from 'lib/constants'import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'+import { Alert, Button, IconExternalLink } from 'ui'import ProjectUpdateDisabledTooltip from '../../BillingSettings/ProjectUpdateDisabledTooltip'+import SpendCapSidePanel from './SpendCapSidePanel'export interface CostControlProps {}@@ -18,7 +24,13 @@ const CostControl = ({}: CostControlProps) => {const snap = useOrgSettingsPageStateSnapshot()const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')- const { data: subscription, isLoading } = useOrgSubscriptionQuery({ orgSlug: slug })+ const {+ data: subscription,+ error,+ isLoading,+ isSuccess,+ isError,+ } = useOrgSubscriptionQuery({ orgSlug: slug })const currentPlan = subscription?.planconst isUsageBillingEnabled = subscription?.usage_billing_enabled ?? false@@ -28,115 +40,126 @@ const CostControl = ({}: CostControlProps) => {return (<>- <FormSection- header={- <FormSectionLabel>- <div className="sticky space-y-6 top-16">- <div>- <p className="text-base">Cost Control</p>- <p className="text-sm text-scale-1000">- Control whether to use beyond your plans included quota- </p>- </div>- <div className="space-y-2">- <p className="text-sm text-scale-1100">More information</p>- <div>- <Link href="https://supabase.com/docs/guides/platform/spend-cap">- <a target="_blank" rel="noreferrer">- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">Spend cap</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </a>- </Link>- </div>- </div>- </div>- </FormSectionLabel>- }- >- <FormSectionContent loading={isLoading}>- <div className="space-y-6">- {['team', 'enterprise'].includes(currentPlan?.id || '') ? (- <Alert- withIcon- variant="info"- title={`You will be charged for any additional usage on the ${- currentPlan?.name || ''- } plan`}- >- {currentPlan?.name || ''} plan requires you to have spend cap off at all times. Your- projects will never become unresponsive. Only when your{' '}- <Link href="#breakdown">- <a className="text-sm text-green-900 transition hover:text-green-1000">- included usage- </a>- </Link>{' '}- is exceeded will you be charged for any additional usage.- </Alert>- ) : (+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky space-y-6 top-16">+ <div>+ <p className="text-base">Cost Control</p><p className="text-sm text-scale-1000">- You can control whether your organization is charged for additional usage beyond the{' '}- <Link href="#breakdown">- <a className="text-sm text-green-900 transition hover:text-green-1000">- included quota- </a>- </Link>{' '}- of your subscription plan. If you need to go beyond the included quota, simply- switch off your spend cap to pay for additional usage.+ Control whether to use beyond your plans included quota</p>- )}-- <div className="flex space-x-6">+ </div>+ <div className="space-y-2">+ <p className="text-sm text-scale-1100">More information</p><div>- <div className="rounded-md bg-scale-100 dark:bg-scale-400 w-[160px] h-[96px] shadow">- <img- alt="Spend Cap"- width={160}- height={96}- src={- isUsageBillingEnabled- ? `${BASE_PATH}/img/spend-cap-off${isDarkMode ? '' : '--light'}.png?v=3`- : `${BASE_PATH}/img/spend-cap-on${isDarkMode ? '' : '--light'}.png?v=3`- }- />- </div>+ <Link href="https://supabase.com/docs/guides/platform/spend-cap">+ <a target="_blank" rel="noreferrer">+ <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">+ <p className="text-sm">Spend cap</p>+ <IconExternalLink size={16} strokeWidth={1.5} />+ </div>+ </a>+ </Link></div>- <div>- <p className="mb-1">- Spend cap is {isUsageBillingEnabled ? 'disabled' : 'enabled'}- </p>+ </div>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}++ {isError && <AlertError subject="Failed to retrieve subscription" error={error} />}++ {isSuccess && (+ <div className="space-y-6">+ {['team', 'enterprise'].includes(currentPlan?.id || '') ? (+ <Alert+ withIcon+ variant="info"+ title={`You will be charged for any additional usage on the ${+ currentPlan?.name || ''+ } plan`}+ >+ {currentPlan?.name || ''} plan requires you to have spend cap off at all times.+ Your projects will never become unresponsive. Only when your{' '}+ <Link href="#breakdown">+ <a className="text-sm text-green-900 transition hover:text-green-1000">+ included usage+ </a>+ </Link>{' '}+ is exceeded will you be charged for any additional usage.+ </Alert>+ ) : (<p className="text-sm text-scale-1000">- {isUsageBillingEnabled ? (- <span>You will be charged for any usage above the included quota.</span>- ) : (- <span>- You won't be charged any extra for usage. However, your projects could become- unresponsive or enter read only mode if you exceed the included quota.- </span>- )}+ You can control whether your organization is charged for additional usage beyond+ the{' '}+ <Link href="#breakdown">+ <a className="text-sm text-green-900 transition hover:text-green-1000">+ included quota+ </a>+ </Link>{' '}+ of your subscription plan. If you need to go beyond the included quota, simply+ switch off your spend cap to pay for additional usage.</p>- {isUsageBillingEnabled && (- <p className="text-sm text-scale-1000 mt-1">- Your projects will never become unresponsive. Only when your usage reaches the- quota limit will you be charged for any excess usage.+ )}++ <div className="flex space-x-6">+ <div>+ <div className="rounded-md bg-scale-100 dark:bg-scale-400 w-[160px] h-[96px] shadow">+ <img+ alt="Spend Cap"+ width={160}+ height={96}+ src={+ isUsageBillingEnabled+ ? `${BASE_PATH}/img/spend-cap-off${isDarkMode ? '' : '--light'}.png?v=3`+ : `${BASE_PATH}/img/spend-cap-on${isDarkMode ? '' : '--light'}.png?v=3`+ }+ />+ </div>+ </div>+ <div>+ <p className="mb-1">+ Spend cap is {isUsageBillingEnabled ? 'disabled' : 'enabled'}</p>- )}- <ProjectUpdateDisabledTooltip projectUpdateDisabled={projectUpdateDisabled}>- <Button- type="default"- className="mt-4"- disabled={!canChangeTier}- onClick={() => snap.setPanelKey('costControl')}- >- Change spend cap- </Button>- </ProjectUpdateDisabledTooltip>+ <p className="text-sm text-scale-1000">+ {isUsageBillingEnabled ? (+ <span>You will be charged for any usage above the included quota.</span>+ ) : (+ <span>+ You won't be charged any extra for usage. However, your projects could+ become unresponsive or enter read only mode if you exceed the included+ quota.+ </span>+ )}+ </p>+ {isUsageBillingEnabled && (+ <p className="text-sm text-scale-1000 mt-1">+ Your projects will never become unresponsive. Only when your usage reaches the+ quota limit will you be charged for any excess usage.+ </p>+ )}+ <ProjectUpdateDisabledTooltip projectUpdateDisabled={projectUpdateDisabled}>+ <Button+ type="default"+ className="mt-4"+ disabled={!canChangeTier}+ onClick={() => snap.setPanelKey('costControl')}+ >+ Change spend cap+ </Button>+ </ProjectUpdateDisabledTooltip>+ </div></div></div>- </div>- </FormSectionContent>- </FormSection>+ )}+ </ScaffoldSectionContent>+ </ScaffoldSection><SpendCapSidePanel /></>)diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/CreditBalance.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/CreditBalance.tsxindex cdcd469e729..4b0b69c3bbb 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/CreditBalance.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/CreditBalance.tsx@@ -1,11 +1,19 @@import { useParams } from 'common'-import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'+import {+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import AlertError from 'components/ui/AlertError'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useOrganizationCustomerProfileQuery } from 'data/organizations/organization-customer-profile-query'import { Badge } from 'ui'const CreditBalance = () => {const { slug } = useParams()- const { data } = useOrganizationCustomerProfileQuery({ slug })+ const { data, error, isLoading, isError, isSuccess } = useOrganizationCustomerProfileQuery({+ slug,+ })const customerBalance = (data?.balance ?? 0) / 100const isCredit = customerBalance < 0@@ -16,32 +24,42 @@ const CreditBalance = () => {: customerBalance.toFixed(2)return (- <FormSection- id="credit-balance"- header={- <FormSectionLabel>- <div className="sticky top-16">- <div className="flex items-center space-x-2">- <p className="text-base">Credit balance</p>- {isCredit && <Badge>You have credits available</Badge>}- {isDebt && <Badge color="red">Outstanding payments</Badge>}- </div>- <p className="text-sm text-scale-1000">- Charges will be deducted from your balance first- </p>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky top-16">+ <div className="flex items-center space-x-2">+ <p className="text-base">Credit balance</p>+ {isCredit && <Badge>You have credits available</Badge>}+ {isDebt && <Badge color="red">Outstanding payments</Badge>}</div>- </FormSectionLabel>- }- >- <FormSectionContent loading={false}>- <div className="flex items-end space-x-1">- {isDebt && <h4 className="opacity-50">-</h4>}- <h4 className="opacity-50">$</h4>- <h2 className="text-4xl relative top-[2px]">{balance}</h2>- {isCredit && <h4 className="opacity-50">/credits</h4>}+ <p className="text-sm text-scale-1000">+ Charges will be deducted from your balance first+ </p></div>- </FormSectionContent>- </FormSection>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}++ {isError && (+ <AlertError subject="Unable to retrieve organization customer profile" error={error} />+ )}++ {isSuccess && (+ <div className="flex items-end space-x-1">+ {isDebt && <h4 className="opacity-50">-</h4>}+ <h4 className="opacity-50">$</h4>+ <h2 className="text-4xl relative top-[2px]">{balance}</h2>+ {isCredit && <h4 className="opacity-50">/credits</h4>}+ </div>+ )}+ </ScaffoldSectionContent>+ </ScaffoldSection>)}diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsxindex 18ef727fa21..04b69f49827 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx@@ -4,8 +4,15 @@ import { useState } from 'react'import { useParams } from 'common'import { AddNewPaymentMethodModal } from 'components/interfaces/Billing'-import { FormPanel, FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'+import {+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import AlertError from 'components/ui/AlertError'+import { FormPanel, FormSection, FormSectionContent } from 'components/ui/Forms'import NoPermission from 'components/ui/NoPermission'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { organizationKeys } from 'data/organizations/keys'import { useOrganizationPaymentMethodsQuery } from 'data/organizations/organization-payment-methods-query'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'@@ -15,7 +22,6 @@ import { getURL } from 'lib/helpers'import { Badge, Button, Dropdown, IconCreditCard, IconMoreHorizontal, IconPlus } from 'ui'import ChangePaymentMethodModal from './ChangePaymentMethodModal'import DeletePaymentMethodModal from './DeletePaymentMethodModal'-import AlertError from 'components/ui/AlertError'const PaymentMethods = () => {const { ui } = useStore()@@ -47,31 +53,36 @@ const PaymentMethods = () => {return (<>- <FormSection- id="payment-methods"- header={- <FormSectionLabel>- <div className="sticky space-y-6 top-16">- <div>- <p className="text-base">Payment methods</p>- <p className="text-sm text-scale-1000 mb-2">- This copy might need to change, when adding a new payment method, either remove- the old one or go to your projects' subscription to explicitly update the payment- method.- </p>- </div>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky space-y-6 top-16">+ <div>+ <p className="text-base">Payment methods</p>+ <p className="text-sm text-scale-1000 mb-2">+ This copy might need to change, when adding a new payment method, either remove the+ old one or go to your projects' subscription to explicitly update the payment+ method.+ </p></div>- </FormSectionLabel>- }- >- <FormSectionContent loading={isLoading}>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>{!canReadPaymentMethods ? (<NoPermission resourceText="view this organization's payment methods" />) : (<>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}+{isError && (<AlertError subject="Unable to retrieve payment methods" error={error as any} />)}+{isSuccess && (<FormPanelfooter={@@ -125,8 +136,8 @@ const PaymentMethods = () => {Expires: {paymentMethod.card.exp_month}/{paymentMethod.card.exp_year}</p>- {isActive && <Badge color="green">Active</Badge>}</div>+ {isActive && <Badge color="green">Active</Badge>}{canUpdatePaymentMethods && !isActive ? (<Dropdownsize="tiny"@@ -165,8 +176,8 @@ const PaymentMethods = () => {)}</>)}- </FormSectionContent>- </FormSection>+ </ScaffoldSectionContent>+ </ScaffoldSection><AddNewPaymentMethodModalvisible={showAddPaymentMethodModal}diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/Subscription.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/Subscription.tsxindex dc5eed476fd..7f46a9482c3 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/Subscription.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/Subscription.tsx@@ -2,16 +2,21 @@ import dayjs from 'dayjs'import Link from 'next/link'import { useParams } from 'common'+import {+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'-import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'import SparkBar from 'components/ui/SparkBar'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'import { useFlag } from 'hooks'+import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'import { Alert, Button, IconExternalLink } from 'ui'import ProjectUpdateDisabledTooltip from '../../BillingSettings/ProjectUpdateDisabledTooltip'-import SubscriptionPaymentMethod from './SubscriptionPaymentMethod'-import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'import PlanUpdateSidePanel from './PlanUpdateSidePanel'+import SubscriptionPaymentMethod from './SubscriptionPaymentMethod'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'const Subscription = () => {const { slug } = useParams()@@ -38,30 +43,34 @@ const Subscription = () => {return (<>- <FormSection- id="plan"- header={- <FormSectionLabel>- <div className="sticky space-y-6 top-16">- <p className="text-base">Subscription Plan</p>- <div className="space-y-2">- <p className="text-sm text-scale-1100">More information</p>- <div>- <Link href="https://supabase.com/pricing">- <a target="_blank" rel="noreferrer">- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">Pricing</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </a>- </Link>- </div>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky space-y-6 top-16">+ <p className="text-base">Subscription Plan</p>+ <div className="space-y-2">+ <p className="text-sm text-scale-1100">More information</p>+ <div>+ <Link href="https://supabase.com/pricing">+ <a target="_blank" rel="noreferrer">+ <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">+ <p className="text-sm">Pricing</p>+ <IconExternalLink size={16} strokeWidth={1.5} />+ </div>+ </a>+ </Link></div></div>- </FormSectionLabel>- }- >- <FormSectionContent loading={isLoading}>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}+{isError && <AlertError subject="Failed to retrieve subscription" error={error} />}{isSuccess && (@@ -169,8 +178,8 @@ const Subscription = () => {)}</div>)}- </FormSectionContent>- </FormSection>+ </ScaffoldSectionContent>+ </ScaffoldSection><PlanUpdateSidePanel /></>)diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/TaxID/TaxID.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/TaxID/TaxID.tsxindex 28b3957a9fc..c0c81f6d1c1 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/TaxID/TaxID.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/TaxID/TaxID.tsx@@ -1,31 +1,38 @@-import { useEffect, useState } from 'react'import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useEffect, useState } from 'react'+import { useParams } from 'common'import {- FormActions,- FormPanel,- FormSection,- FormSectionContent,- FormSectionLabel,-} from 'components/ui/Forms'+ ScaffoldSection,+ ScaffoldSectionContent,+ ScaffoldSectionDetail,+} from 'components/layouts/Scaffold'+import AlertError from 'components/ui/AlertError'+import { FormActions, FormPanel, FormSection, FormSectionContent } from 'components/ui/Forms'import NoPermission from 'components/ui/NoPermission'-import { useCheckPermissions, useStore } from 'hooks'-import { Button, Form, IconPlus, IconX, Input, Listbox } from 'ui'-import { TAX_IDS } from './TaxID.constants'+import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { TaxId, useOrganizationTaxIDsQuery } from 'data/organizations/organization-tax-ids-query'-import { useParams } from 'common'-import { uuidv4 } from 'lib/helpers'-import { isEqual } from 'lodash'import {TaxIdValue,useOrganizationTaxIDsUpdateMutation,} from 'data/organizations/organization-tax-ids-update-mutation'+import { useCheckPermissions, useStore } from 'hooks'+import { uuidv4 } from 'lib/helpers'+import { isEqual } from 'lodash'+import { Button, Form, IconPlus, IconX, Input, Listbox } from 'ui'+import { TAX_IDS } from './TaxID.constants'import { sanitizeTaxID } from './TaxID.utilts'const TaxID = () => {const { ui } = useStore()const { slug } = useParams()- const { data: taxIds, isLoading, isSuccess, isError } = useOrganizationTaxIDsQuery({ slug })+ const {+ data: taxIds,+ error,+ isLoading,+ isSuccess,+ isError,+ } = useOrganizationTaxIDsQuery({ slug })const { mutateAsync: updateTaxIDs } = useOrganizationTaxIDsUpdateMutation()const [errors, setErrors] = useState<string[]>([])@@ -116,117 +123,131 @@ const TaxID = () => {}return (- <FormSection- id="tax-id"- header={- <FormSectionLabel>- <div className="sticky space-y-6 top-16">- <div>- <p className="text-base">Tax ID</p>- <p className="text-sm text-scale-1000">- If you would like to include specific tax ID(s) to your invoices.- </p>- <p className="text-sm text-scale-1000">- Make sure the tax ID looks exactly like the placeholder text.- </p>- </div>+ <ScaffoldSection>+ <ScaffoldSectionDetail>+ <div className="sticky space-y-6 top-16">+ <div>+ <p className="text-base">Tax ID</p>+ <p className="text-sm text-scale-1000">+ If you would like to include specific tax ID(s) to your invoices.+ </p>+ <p className="text-sm text-scale-1000">+ Make sure the tax ID looks exactly like the placeholder text.+ </p></div>- </FormSectionLabel>- }- >- <FormSectionContent loading={false}>+ </div>+ </ScaffoldSectionDetail>+ <ScaffoldSectionContent>{!canReadTaxIds ? (<NoPermission resourceText="view this organization's tax IDs" />) : (- <Form validateOnBlur id={formId} initialValues={{}} onSubmit={onSaveTaxIds}>- {({ isSubmitting }: { isSubmitting: boolean }) => (- <FormPanel- footer={- <div className="flex py-4 px-8">- <FormActions- form={formId}- isSubmitting={isSubmitting}- hasChanges={hasChanges}- handleReset={() => onResetTaxIds()}- helper={- !canUpdateTaxIds- ? "You need additional permissions to manage this organization's tax IDs"- : undefined- }- />- </div>- }- >- <FormSection>- <FormSectionContent fullWidth loading={isLoading}>- {taxIdValues.length >= 1 ? (- <div className="w-full space-y-2">- {taxIdValues.map((taxId, idx: number) => {- const selectedTaxId = TAX_IDS.find((option) => option.code === taxId.type)- return (- <div key={`tax-id-${idx}`} className="flex items-center space-x-2">- <Listbox- value={selectedTaxId?.name}- onChange={(e: any) => onUpdateTaxId(taxId.id, 'name', e)}- disabled={!canUpdateTaxIds}- className="w-[200px]"- >- {TAX_IDS.sort((a, b) => a.country.localeCompare(b.country)).map(- (option) => (- <Listbox.Option- key={option.name}- value={option.name}- label={option.name}- >- {option.country} - {option.name}- </Listbox.Option>- )- )}- </Listbox>- <Input- value={taxId.value}- placeholder={selectedTaxId?.placeholder ?? ''}- onChange={(e: any) =>- onUpdateTaxId(taxId.id, 'value', e.target.value)- }- disabled={!canUpdateTaxIds}- />- {canUpdateTaxIds && (- <Button- type="text"- className="px-1"- icon={<IconX />}- onClick={() => onRemoveTaxId(taxId.id)}- />- )}- </div>- )- })}- </div>- ) : (- <div>- <p className="flex items-center space-x-2 text-sm text-scale-900">- No tax IDs- </p>- </div>- )}- {canUpdateTaxIds && (- <div- className="flex cursor-pointer items-center space-x-2 opacity-50 transition hover:opacity-100"- onClick={() => onAddNewTaxId()}- >- <IconPlus size={14} />- <p className="text-sm">Add another ID</p>+ <>+ {isLoading && (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ )}++ {isError && (+ <AlertError error={error} subject="Unable to retrieve organization tax IDs" />+ )}++ {isSuccess && (+ <Form validateOnBlur id={formId} initialValues={{}} onSubmit={onSaveTaxIds}>+ {({ isSubmitting }: { isSubmitting: boolean }) => (+ <FormPanel+ footer={+ <div className="flex py-4 px-8">+ <FormActions+ form={formId}+ isSubmitting={isSubmitting}+ hasChanges={hasChanges}+ handleReset={() => onResetTaxIds()}+ helper={+ !canUpdateTaxIds+ ? "You need additional permissions to manage this organization's tax IDs"+ : undefined+ }+ /></div>- )}- </FormSectionContent>- </FormSection>- </FormPanel>+ }+ >+ <FormSection>+ <FormSectionContent fullWidth loading={false}>+ {taxIdValues.length >= 1 ? (+ <div className="w-full space-y-2">+ {taxIdValues.map((taxId, idx: number) => {+ const selectedTaxId = TAX_IDS.find(+ (option) => option.code === taxId.type+ )+ return (+ <div key={`tax-id-${idx}`} className="flex items-center space-x-2">+ <Listbox+ value={selectedTaxId?.name}+ onChange={(e: any) => onUpdateTaxId(taxId.id, 'name', e)}+ disabled={!canUpdateTaxIds}+ className="w-[200px]"+ >+ {TAX_IDS.sort((a, b) => a.country.localeCompare(b.country)).map(+ (option) => (+ <Listbox.Option+ key={option.name}+ value={option.name}+ label={option.name}+ >+ {option.country} - {option.name}+ </Listbox.Option>+ )+ )}+ </Listbox>+ <Input+ value={taxId.value}+ placeholder={selectedTaxId?.placeholder ?? ''}+ onChange={(e: any) =>+ onUpdateTaxId(taxId.id, 'value', e.target.value)+ }+ disabled={!canUpdateTaxIds}+ />+ {canUpdateTaxIds && (+ <Button+ type="text"+ className="px-1"+ icon={<IconX />}+ onClick={() => onRemoveTaxId(taxId.id)}+ />+ )}+ </div>+ )+ })}+ </div>+ ) : (+ <div>+ <p className="flex items-center space-x-2 text-sm text-scale-900">+ No tax IDs+ </p>+ </div>+ )}+ {canUpdateTaxIds && (+ <div+ className="flex cursor-pointer items-center space-x-2 opacity-50 transition hover:opacity-100"+ onClick={() => onAddNewTaxId()}+ >+ <IconPlus size={14} />+ <p className="text-sm">Add another ID</p>+ </div>+ )}+ </FormSectionContent>+ </FormSection>+ </FormPanel>+ )}+ </Form>)}- </Form>+ </>)}- </FormSectionContent>- </FormSection>+ </ScaffoldSectionContent>+ </ScaffoldSection>)}diff --git a/studio/data/organizations/organization-customer-profile-query.ts b/studio/data/organizations/organization-customer-profile-query.tsindex de495773339..3859a64c620 100644--- a/studio/data/organizations/organization-customer-profile-query.ts+++ b/studio/data/organizations/organization-customer-profile-query.ts@@ -3,6 +3,7 @@ import { get } from 'lib/common/fetch'import { API_URL } from 'lib/constants'import { useCallback } from 'react'import { organizationKeys } from './keys'+import { ResponseError } from 'types'export type OrganizationCustomerProfileVariables = {slug?: string@@ -40,7 +41,7 @@ export async function getOrganizationCustomerProfile(export type OrganizationCustomerProfileData = Awaited<ReturnType<typeof getOrganizationCustomerProfile>>-export type OrganizationCustomerProfileError = unknown+export type OrganizationCustomerProfileError = ResponseErrorexport const useOrganizationCustomerProfileQuery = <TData = OrganizationCustomerProfileData>({ slug }: OrganizationCustomerProfileVariables,diff --git a/studio/data/organizations/organization-tax-ids-query.ts b/studio/data/organizations/organization-tax-ids-query.tsindex 059840795fd..2a6c7589415 100644--- a/studio/data/organizations/organization-tax-ids-query.ts+++ b/studio/data/organizations/organization-tax-ids-query.ts@@ -3,6 +3,7 @@ import { get } from 'lib/common/fetch'import { API_URL } from 'lib/constants'import { useCallback } from 'react'import { organizationKeys } from './keys'+import { ResponseError } from 'types'export type OrganizationTaxIDsVariables = {slug?: string@@ -37,7 +38,7 @@ export async function getOrganizationTaxIDs(}export type OrganizationTaxIDsData = Awaited<ReturnType<typeof getOrganizationTaxIDs>>-export type OrganizationTaxIDsError = unknown+export type OrganizationTaxIDsError = ResponseErrorexport const useOrganizationTaxIDsQuery = <TData = OrganizationTaxIDsData>({ slug }: OrganizationTaxIDsVariables,