The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(billing): clicking outside downgrade modal closes it (#47070)
Julian Domke1b41e0bff2d3
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/DowngradeModal.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/DowngradeModal.tsxindex 70197a0f582..60b5714cf9a 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/DowngradeModal.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/DowngradeModal.tsx@@ -2,14 +2,13 @@ import { MinusCircle, PauseCircle } from 'lucide-react'import { useMemo } from 'react'import { plans as subscriptionsPlans } from 'shared-data/plans'import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,+ Button,+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogSectionSeparator,+ DialogTitle,} from 'ui'import { Admonition } from 'ui-patterns'@@ -96,96 +95,93 @@ export const DowngradeModal = ({)return (- <AlertDialog open={visible} onOpenChange={onClose}>- <AlertDialogContent size="large">- <AlertDialogHeader>- <AlertDialogTitle>{`Confirm to downgrade to ${selectedPlan?.name} plan`}</AlertDialogTitle>- <AlertDialogDescription asChild>- <div>- <div className="flex flex-col space-y-2">- <Admonition- type="warning"- title="Downgrading to the Free Plan will lead to reductions in your organization's quota"- description="If you're already past the limits of the Free Plan, your projects could become+ <Dialog open={visible} onOpenChange={onClose}>+ <DialogContent size="large">+ <DialogHeader>+ <DialogTitle>Confirm to downgrade to {selectedPlan?.name} plan</DialogTitle>+ </DialogHeader>+ <DialogSectionSeparator />+ <div className="px-5 py-4 text-foreground-light">+ <div className="flex flex-col space-y-2">+ <Admonition+ type="warning"+ title="Downgrading to the Free Plan will lead to reductions in your organization's quota"+ description="If you're already past the limits of the Free Plan, your projects could becomeunresponsive or enter read only mode."- />-- {((previousProjectAddons.length ?? 0) > 0 || hasInstancesOnMicro) && (- <Admonition type="warning" title="Projects affected by the downgrade">- <ul className="space-y-1 max-h-[100px] overflow-y-auto">- {previousProjectAddons.map((project) => (- <ProjectDowngradeListItem key={project.ref} projectAddon={project} />- ))}-- {projects- .filter((it) => {- const computeSize = getComputeSize(it)- return computeSize === 'micro'- })- .map((project) => (- <li className="list-disc ml-6" key={project.ref}>- {project.name}: Compute will be downgraded. Project will also{' '}- <span className="font-bold">need to be restarted</span>.- </li>- ))}- </ul>- </Admonition>- )}- </div>-- {hasPostCutoffProjects && (- <Admonition- type="warning"- className="mt-2"- title="Any custom email templates will be reset"- description="Downgrading will reset your custom email templates to their defaults. You won’t be able to edit them unless you set up custom SMTP after downgrading."- />- )}-- <ul className="mt-4 space-y-5 text-sm">- <li className="flex items-center gap-3">- <PauseCircle size={18} />- <span>Projects will be paused after a week of inactivity</span>- </li>-- <li className="flex items-center gap-3 mb-2">- <MinusCircle size={18} />- <span>Add ons from all projects under this organization will be removed.</span>- </li>-- <li className="flex gap-3">- <div>- <strong>- Before you downgrade to the {selectedPlan?.name} plan, consider:- </strong>- <ul className="space-y-2 mt-2">- <li className="list-disc ml-6 text-foreground-light">- Your projects no longer require their respective add-ons.- </li>- <li className="list-disc ml-6 text-foreground-light">- Your resource consumption are well within the {selectedPlan?.name} plan's- quota.+ />++ {((previousProjectAddons.length ?? 0) > 0 || hasInstancesOnMicro) && (+ <Admonition type="warning" title="Projects affected by the downgrade">+ <ul className="space-y-1 max-h-[100px] overflow-y-auto">+ {previousProjectAddons.map((project) => (+ <ProjectDowngradeListItem key={project.ref} projectAddon={project} />+ ))}++ {projects+ .filter((it) => {+ const computeSize = getComputeSize(it)+ return computeSize === 'micro'+ })+ .map((project) => (+ <li className="list-disc ml-6" key={project.ref}>+ {project.name}: Compute will be downgraded. Project will also{' '}+ <span className="font-bold">need to be restarted</span>.</li>- <li className="list-disc ml-6 text-foreground-light">- Alternatively, you may also transfer projects across organizations.- </li>- </ul>- </div>- </li>- </ul>-- {subscription?.billing_via_partner === true &&- subscription.billing_partner === 'fly' && (- <p className="mt-4 text-sm">- Your organization will be downgraded at the end of your current billing cycle.- </p>- )}- </div>- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction+ ))}+ </ul>+ </Admonition>+ )}+ </div>++ {hasPostCutoffProjects && (+ <Admonition+ type="warning"+ className="mt-2"+ title="Any custom email templates will be reset"+ description="Downgrading will reset your custom email templates to their defaults. You won’t be able to edit them unless you set up custom SMTP after downgrading."+ />+ )}++ <ul className="mt-4 space-y-5 text-sm">+ <li className="flex items-center gap-3">+ <PauseCircle size={18} />+ <span>Projects will be paused after a week of inactivity</span>+ </li>++ <li className="flex items-center gap-3 mb-2">+ <MinusCircle size={18} />+ <span>Add ons from all projects under this organization will be removed.</span>+ </li>++ <li className="flex gap-3">+ <div>+ <strong>Before you downgrade to the {selectedPlan?.name} plan, consider:</strong>+ <ul className="space-y-2 mt-2">+ <li className="list-disc ml-6 text-foreground-light">+ Your projects no longer require their respective add-ons.+ </li>+ <li className="list-disc ml-6 text-foreground-light">+ Your resource consumption are well within the {selectedPlan?.name} plan's quota.+ </li>+ <li className="list-disc ml-6 text-foreground-light">+ Alternatively, you may also transfer projects across organizations.+ </li>+ </ul>+ </div>+ </li>+ </ul>++ {subscription?.billing_via_partner === true && subscription.billing_partner === 'fly' && (+ <p className="mt-4 text-sm">+ Your organization will be downgraded at the end of your current billing cycle.+ </p>+ )}+ </div>+ <DialogFooter>+ <Button variant={'default'} onClick={onClose}>+ Cancel+ </Button>+ <Buttondisabled={confirmDisabled ?? false}variant="warning"onClick={(e) => {@@ -194,9 +190,9 @@ export const DowngradeModal = ({}}>Confirm- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>)}