Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: use currency formatter (#20755)

Kevin Grüneberg33e7c24f5c98
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
index 01706ebedb0..0c795398bf9 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
@@ -8,6 +8,7 @@ import { Metric, USAGE_APPROACHING_THRESHOLD } from './BillingBreakdown.constant
import { billingMetricUnit, formatUsage } from '../helpers'
import { PricingMetric } from 'data/analytics/org-daily-stats-query'
import { useMemo } from 'react'
+import { formatCurrency } from 'lib/helpers'
export interface BillingMetricProps {
idx: number
@@ -75,7 +76,7 @@ const BillingMetric = ({
</Link>
<span className="text-sm">{usageLabel}</span>&nbsp;
{usageMeta.cost && usageMeta.cost > 0 ? (
- <span className="text-sm">(${usageMeta.cost})</span>
+ <span className="text-sm">({formatCurrency(usageMeta.cost)})</span>
) : usageMeta.available_in_plan && !usageMeta.unlimited && relativeToSubscription ? (
<span className="text-sm">({percentageLabel})</span>
) : null}
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/ComputeMetric.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/ComputeMetric.tsx
index 101fbba19d9..2746c44e686 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/ComputeMetric.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/ComputeMetric.tsx
@@ -7,6 +7,7 @@ import { Metric } from './BillingBreakdown.constants'
import { formatUsage } from '../helpers'
import { PricingMetric } from 'data/analytics/org-daily-stats-query'
import React, { useMemo } from 'react'
+import { formatCurrency } from 'lib/helpers'
export interface ComputeMetricProps {
slug?: string
@@ -41,7 +42,7 @@ const ComputeMetric = ({ slug, metric, usage, relativeToSubscription }: ComputeM
</Link>
<span className="text-sm">{usageLabel}</span>&nbsp;
{relativeToSubscription && usageMeta?.cost && usageMeta.cost > 0 ? (
- <span className="text-sm">(${usageMeta?.cost})</span>
+ <span className="text-sm">({formatCurrency(usageMeta?.cost)})</span>
) : null}
</div>
<div>
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
index e31a4e060a8..94e4df7c536 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
@@ -34,6 +34,7 @@ import EnterpriseCard from './EnterpriseCard'
import ExitSurveyModal from './ExitSurveyModal'
import MembersExceedLimitModal from './MembersExceedLimitModal'
import PaymentMethodSelection from './PaymentMethodSelection'
+import { formatCurrency } from 'lib/helpers'
const PlanUpdateSidePanel = () => {
const { ui } = useStore()
@@ -51,7 +52,6 @@ const PlanUpdateSidePanel = () => {
PermissionAction.BILLING_WRITE,
'stripe.subscriptions'
)
-
const snap = useOrgSettingsPageStateSnapshot()
const visible = snap.panelKey === 'subscriptionPlan'
const onClose = () => {
@@ -227,7 +227,7 @@ const PlanUpdateSidePanel = () => {
<ShimmeringLoader className="w-[30px] h-[24px]" />
</div>
) : (
- <p className="text-foreground text-lg">${price}</p>
+ <p className="text-foreground text-lg">{formatCurrency(price)}</p>
)}
<p className="text-foreground-light text-sm">{plan.costUnit}</p>
</div>
@@ -410,10 +410,12 @@ const PlanUpdateSidePanel = () => {
: item.unit_price === 0
? 'FREE'
: item.unit_price
- ? `$${item.unit_price}`
+ ? `${formatCurrency(item.unit_price)}`
: ''}
</Table.td>
- <Table.td className="text-right">${item.total_price}</Table.td>
+ <Table.td className="text-right">
+ {formatCurrency(item.total_price)}
+ </Table.td>
</Table.tr>
{usageFeesExpanded.includes(item.description) &&
@@ -439,13 +441,14 @@ const PlanUpdateSidePanel = () => {
<Table.td />
<Table.td />
<Table.td className="text-right font-medium">
- $
- {Math.round(
- subscriptionPreview.breakdown.reduce(
- (prev, cur) => prev + cur.total_price,
- 0
- )
- ) ?? 0}
+ {formatCurrency(
+ Math.round(
+ subscriptionPreview.breakdown.reduce(
+ (prev, cur) => prev + cur.total_price,
+ 0
+ )
+ ) ?? 0
+ )}
</Table.td>
</Table.tr>
</>
diff --git a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
index bad4868bcd6..6a3a1d80497 100644
--- a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
+++ b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
@@ -14,6 +14,7 @@ import { useInvoicesQuery } from 'data/invoices/invoices-query'
import { useCheckPermissions, useSelectedOrganization, useStore } from 'hooks'
import { Button, IconChevronLeft, IconChevronRight, IconDownload, IconFileText } from 'ui'
import InvoiceStatusBadge from 'components/interfaces/Billing/InvoiceStatusBadge'
+import { formatCurrency } from 'lib/helpers'
const PAGE_LIMIT = 10
@@ -98,7 +99,7 @@ const InvoicesSettings = () => {
<p>{new Date(x.period_end * 1000).toLocaleString()}</p>
</Table.td>
<Table.td>
- <p>${x.subtotal / 100}</p>
+ <p>{formatCurrency(x.subtotal / 100)}</p>
</Table.td>
<Table.td>
<p>{x.number}</p>
diff --git a/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx b/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
index a495ce28d99..804ea1b0d62 100644
--- a/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
+++ b/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
@@ -382,35 +382,6 @@ const NewOrgForm = ({ onPaymentMethodReset }: NewOrgFormProps) => {
)}
</Panel.Content>
)}
-
- <Panel.Content>
- <InformationBox
- icon={<IconInfo size="large" strokeWidth={1.5} />}
- defaultVisibility={true}
- hideCollapse
- title="Billed via organization"
- description={
- <div className="space-y-3">
- <p className="text-sm leading-normal">
- This organization will use the new organization-based billing, which gives you a
- single subscription for your entire organization, instead of having individual
- subscriptions per project.{' '}
- </p>
- <div>
- <Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
- <Link
- href="https://supabase.com/docs/guides/platform/org-based-billing"
- target="_blank"
- rel="noreferrer"
- >
- Documentation
- </Link>
- </Button>
- </div>
- </div>
- }
- />
- </Panel.Content>
</Panel>
</form>
</>
diff --git a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
index cd3819cb051..3e4316a7688 100644
--- a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
@@ -33,6 +33,7 @@ import {
import * as Tooltip from '@radix-ui/react-tooltip'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { AddonVariantId } from 'data/subscriptions/types'
+import { formatCurrency } from 'lib/helpers'
const COMPUTE_CATEGORY_OPTIONS: {
id: 'micro' | 'optimized'
@@ -329,7 +330,7 @@ const ComputeInstanceSidePanel = () => {
<div className="flex justify-between items-center mt-2">
<div className="flex items-center space-x-1">
<span className="text-foreground text-sm">
- ${option.price.toLocaleString()}
+ {formatCurrency(option.price)}
</span>
<span className="text-foreground-light translate-y-[1px]">
{' '}
diff --git a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
index 8d1e8f63e01..649d419c735 100644
--- a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
@@ -23,6 +23,7 @@ import {
} from 'ui'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { AddonVariantId } from 'data/subscriptions/types'
+import { formatCurrency } from 'lib/helpers'
const CustomDomainSidePanel = () => {
const { ui } = useStore()
@@ -230,7 +231,7 @@ const CustomDomainSidePanel = () => {
Present a branded experience to your users
</p>
<div className="flex items-center space-x-1 mt-2">
- <p className="text-foreground text-sm">${option.price}</p>
+ <p className="text-foreground text-sm">{formatCurrency(option.price)}</p>
<p className="text-foreground-light translate-y-[1px]"> / month</p>
</div>
</div>
@@ -255,7 +256,7 @@ const CustomDomainSidePanel = () => {
<p className="text-sm text-foreground-light">
Upon clicking confirm, the amount of{' '}
<span className="text-foreground">
- ${selectedCustomDomain?.price.toLocaleString()}
+ {formatCurrency(selectedCustomDomain?.price)}
</span>{' '}
will be added to your monthly invoice.{' '}
{subscription?.billing_via_partner ? (
diff --git a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
index 5b9e19513da..fba97ec376a 100644
--- a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
@@ -14,6 +14,7 @@ import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import { Alert, Button, IconExternalLink, Radio, SidePanel } from 'ui'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { AddonVariantId } from 'data/subscriptions/types'
+import { formatCurrency } from 'lib/helpers'
const IPv4SidePanel = () => {
const { ui } = useStore()
@@ -219,7 +220,7 @@ const IPv4SidePanel = () => {
Allow direct database connections via IPv4 address
</p>
<div className="flex items-center space-x-1 mt-2">
- <p className="text-foreground text-sm">${option.price}</p>
+ <p className="text-foreground text-sm">{formatCurrency(option.price)}</p>
<p className="text-foreground-light translate-y-[1px]"> / month</p>
</div>
</div>
@@ -246,7 +247,7 @@ const IPv4SidePanel = () => {
</Alert>
<p className="text-sm text-foreground-light">
Upon clicking confirm, the amount of{' '}
- <span className="text-foreground">${selectedIPv4?.price.toLocaleString()}</span>{' '}
+ <span className="text-foreground">{formatCurrency(selectedIPv4?.price)}</span>{' '}
will be added to your monthly invoice.
</p>
</>
diff --git a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
index 11397b220d5..4d5edb2c350 100644
--- a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
@@ -29,6 +29,7 @@ import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-que
import { AlertTriangleIcon } from 'lucide-react'
import { AddonVariantId } from 'data/subscriptions/types'
import { subscriptionHasHipaaAddon } from 'components/interfaces/Billing/Subscription/Subscription.utils'
+import { formatCurrency } from 'lib/helpers'
const PITR_CATEGORY_OPTIONS: {
id: 'off' | 'on'
@@ -346,9 +347,7 @@ const PITRSidePanel = () => {
{option.identifier.split('_')[1]} days ago
</p>
<div className="flex items-center space-x-1 mt-2">
- <p className="text-foreground text-sm">
- ${option.price.toLocaleString()}
- </p>
+ <p className="text-foreground text-sm">{formatCurrency(option.price)}</p>
<p className="text-foreground-light translate-y-[1px]"> / month</p>
</div>
</div>
@@ -373,7 +372,7 @@ const PITRSidePanel = () => {
) : (
<p className="text-sm text-foreground-light">
Upon clicking confirm, the amount of{' '}
- <span className="text-foreground">${selectedPitr?.price.toLocaleString()}</span>{' '}
+ <span className="text-foreground">{formatCurrency(selectedPitr?.price)}</span>{' '}
will be added to your monthly invoice.{' '}
{subscription?.billing_via_partner ? (
<>
diff --git a/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx b/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
index 24e5d09b302..b809a96e156 100644
--- a/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
+++ b/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
@@ -19,6 +19,7 @@ import { useOrganizationsQuery } from 'data/organizations/organizations-query'
import { useProjectTransferMutation } from 'data/projects/project-transfer-mutation'
import { useProjectTransferPreviewQuery } from 'data/projects/project-transfer-preview-query'
import { useCheckPermissions, useFlag, useSelectedProject, useStore } from 'hooks'
+import { formatCurrency } from 'lib/helpers'
const TransferProjectButton = () => {
const { ui } = useStore()
@@ -297,7 +298,7 @@ const TransferProjectButton = () => {
{' '}
The target organization will be billed{' '}
<span className="text-brand">
- ${transferPreviewData.costs_on_target_organization}
+ {formatCurrency(transferPreviewData.costs_on_target_organization)}
</span>{' '}
immediately to prorate for the remainder of the billing period.
</span>
diff --git a/apps/studio/lib/constants/infrastructure.ts b/apps/studio/lib/constants/infrastructure.ts
index 880d781d9cc..ba8fe0f49dd 100644
--- a/apps/studio/lib/constants/infrastructure.ts
+++ b/apps/studio/lib/constants/infrastructure.ts
@@ -66,39 +66,6 @@ export const PROVIDERS = {
DEFAULT_SSH_KEY: 'supabase-app-instance',
default_region: AWS_REGIONS_DEFAULT,
regions: { ...AWS_REGIONS },
- // regions: {
- // EAST_US: 'us-east-1', // North Virginia
- // // 'North EU': 'eu-north-1', // Stockholm
- // WEST_US: 'us-west-1', // North California
- // SOUTHEAST_ASIA: 'ap-southeast-1', // Singapore
- // NORTHEAST_ASIA: 'ap-northeast-1', // Tokyo
- // NORTHEAST_ASIA_2: 'ap-northeast-2', //Seoul
- // OCEANIA: 'ap-southeast-2', // Sydney
- // WEST_EU: 'eu-west-1', // Ireland
- // WEST_EU_2: 'eu-west-2', // London
- // CENTRAL_EU: 'eu-central-1', // Frankfurt
- // CENTRAL_CANADA: 'ca-central-1', // Central Canada
- // SOUTH_ASIA: 'ap-south-1', // Mumbai
- // SOUTH_AMERICA: 'sa-east-1', // Sao Paulo
- // // SOUTH_AFRICA: 'af-south-1', // Cape Town
- // },
- sizes: {
- nano: {
- x86_64: 't3.nano',
- arm64: 't4g.nano',
- description: '512mb RAM',
- },
- micro: {
- x86_64: 't3.micro',
- arm64: 't4g.micro',
- description: '1gb RAM',
- },
- medium: {
- x86_64: 'm5a.large',
- arm64: 'm6g.medium',
- description: '4gb RAM',
- },
- },
},
} as const