The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[MUL-1336] fix(studio): show HA project costs as free during Alpha (#49383)
Alaister Youngcaceeb429ff8
diff --git a/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsxindex 393d407d52d..dde2b366e26 100644--- a/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx+++ b/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx@@ -2,6 +2,7 @@ import { useMemo } from 'react'import { UseFormReturn } from 'react-hook-form'import { CloudProvider } from 'shared-data'import {+ cn,FormField,Select,SelectContent,@@ -90,12 +91,25 @@ export const ComputeSizeSelector = ({ form }: ComputeSizeSelectorProps) => {</span><ptranslate="no"- className="text-xs text-foreground-light"+ className={cn(+ 'text-xs',+ highAvailability+ ? 'line-through text-foreground-lighter'+ : 'text-foreground-light'+ )}data-field="instance-details">${instanceSizeSpecs[option].priceHourly}/hour (~${instanceSizeSpecs[option].priceMonthly}/month)</p>+ {highAvailability && (+ <p+ className="text-xs text-foreground-light"+ data-field="instance-details"+ >+ Free during Alpha+ </p>+ )}</div></div></SelectItem>diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationFooter.tsx b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationFooter.tsxindex 22d0597a08a..07862967130 100644--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationFooter.tsx+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationFooter.tsx@@ -31,6 +31,7 @@ interface ProjectCreationFooterProps {form: UseFormReturn<CreateProjectForm>canCreateProject: booleaninstanceSize?: string+ highAvailability?: booleanorganizationProjects: OrgProject[]isCreatingNewProject: booleanisSuccessNewProject: boolean@@ -41,6 +42,7 @@ export const ProjectCreationFooter = ({form,canCreateProject,instanceSize,+ highAvailability = false,organizationProjects,isCreatingNewProject,isSuccessNewProject,@@ -62,18 +64,26 @@ export const ProjectCreationFooter = ({const showAdditionalCosts =!isFreePlan && !projectCreationDisabled && canCreateProject && additionalMonthlySpend > 0+ // High availability is free during Alpha, so the new project costs $0 and is excluded from+ // the totals below — the tooltip table still shows the usual compute price struck through.+ const displayedAdditionalMonthlySpend = highAvailability ? 0 : additionalMonthlySpend+ const newProjectComputeCosts = highAvailability ? 0 : monthlyInstancePrice(instanceSize)+// [kevin] This will eventually all be provided by a new API endpoint to preview and validate project creation, this is just for kaizen now- const monthlyComputeCosts =+ // Clamped since a free HA project can leave the compute credits larger than the costs+ const monthlyComputeCosts = Math.max(+ 0,// current project costsorganizationProjects.reduce((prev, acc) => {const primaryDatabase = acc.databases.find((db) => db.identifier === acc.ref)const cost = !!primaryDatabase ? monthlyInstancePrice(primaryDatabase.infra_compute_size) : 0return prev + cost}, 0) +- // selected compute size- monthlyInstancePrice(instanceSize) -- // compute credits- 10+ // selected compute size+ newProjectComputeCosts -+ // compute credits+ 10+ )const onCancel = () => {if (cancelAction === 'close') {@@ -98,7 +108,7 @@ export const ProjectCreationFooter = ({<div className="flex justify-between text-sm"><span>Additional costs</span><div className="text-brand flex gap-1 items-center font-mono font-medium">- <span>${additionalMonthlySpend}/m</span>+ <span role="status">${displayedAdditionalMonthlySpend}/m</span><InfoTooltip side="top" className="max-w-[450px] p-0"><div className="p-4 text-sm text-foreground-light space-y-1"><p>@@ -109,6 +119,9 @@ export const ProjectCreationFooter = ({</InlineLink>{' '}of that server, independent of your database usage.</p>+ {highAvailability && (+ <p>High availability projects are free during Alpha for up to 2 projects.</p>+ )}{monthlyComputeCosts > 0 && (<p>Compute costs are applied on top of your subscription plan costs.</p>)}@@ -149,7 +162,12 @@ export const ProjectCreationFooter = ({</TableCell><TableCell className="text-center">{instanceLabel(instanceSize)}</TableCell><TableCell className="text-right">- ${monthlyInstancePrice(instanceSize)}+ <span className={cn(highAvailability && 'line-through')}>+ ${monthlyInstancePrice(instanceSize)}+ </span>+ {highAvailability && (+ <p className="text-xs text-foreground-lighter">Free during Alpha</p>+ )}</TableCell></TableRow></TableBody>diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsxindex 5f3af194804..6e8da6184e6 100644--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx@@ -659,6 +659,7 @@ export const ProjectCreationForm = ({form={form}canCreateProject={canCreateProject}instanceSize={instanceSize}+ highAvailability={highAvailability}organizationProjects={organizationProjects}isCreatingNewProject={isCreatingNewProject}isSuccessNewProject={isSuccessNewProject}