Skip to content

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

Fix PAYG usage breaking

Joshen Lim7a85ab3f3875
diff --git a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx
index 0d089d87ec5..91eb86265f3 100644
--- a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx
+++ b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx
@@ -9,17 +9,18 @@ import { chargeableProducts } from './PAYGUsage.constants'
import { DATE_FORMAT } from 'lib/constants'
interface Props {
- paygStats: PaygStats,
+ paygStats: PaygStats
dateRange: {
- period_start: {date: string, time_period: string}
- period_end: {date: string, time_period: string}
+ period_start: { date: string; time_period: string }
+ period_end: { date: string; time_period: string }
interval: string
}
}
const PAYGUsage: FC<Props> = ({ paygStats, dateRange }) => {
- const startDate = dateRange.period_start.date ?? dayjs().utc().startOf('month').format(DATE_FORMAT)
- const endDate = dateRange.period_end.date ?? dayjs().utc().endOf('month').format(DATE_FORMAT)
+ const startDate =
+ dateRange.period_start.date ?? dayjs().utc().startOf('month').format(DATE_FORMAT)
+ const endDate = dateRange.period_end.date ?? dayjs().utc().endOf('month').format(DATE_FORMAT)
return (
<div className="flex flex-col">
@@ -29,23 +30,23 @@ const PAYGUsage: FC<Props> = ({ paygStats, dateRange }) => {
return (
<div
key={product.title}
- className="rounded overflow-hidden border border-panel-border-light dark:border-panel-border-dark mb-8"
+ className="border-panel-border-light dark:border-panel-border-dark mb-8 overflow-hidden rounded border"
>
- <div className="w-full bg-panel-body-light dark:bg-panel-body-dark">
+ <div className="bg-panel-body-light dark:bg-panel-body-dark w-full">
<div className="bg-panel-header-light dark:bg-panel-header-dark">
- <div className="px-6 py-3 flex items-center justify-between rounded overflow-hidden">
+ <div className="flex items-center justify-between overflow-hidden rounded px-6 py-3">
<div className="flex items-center space-x-3">
- <div className="w-8 h-8 bg-white rounded flex items-center justify-center">
+ <div className="flex h-8 w-8 items-center justify-center rounded bg-white">
<img width={'16'} src={product.iconUrl} />
</div>
- <Typography.Title level={5} className="font-medium mb-0">
+ <Typography.Title level={5} className="mb-0 font-medium">
{product.title}
</Typography.Title>
</div>
{product.title !== 'Authentication' && (
<div className="flex items-center space-x-1">
<Typography.Text className="opacity-50">$</Typography.Text>
- <Typography.Title className="font-medium m-0" level={4}>
+ <Typography.Title className="m-0 font-medium" level={4}>
{productCost.toFixed(3)}
</Typography.Title>
</div>
@@ -57,7 +58,7 @@ const PAYGUsage: FC<Props> = ({ paygStats, dateRange }) => {
{product.features.map((feature: ProductFeature) => (
<div
key={feature.title}
- className="px-6 py-3 relative border-t border-panel-border-light dark:border-panel-border-dark"
+ className="border-panel-border-light dark:border-panel-border-dark relative border-t px-6 py-3"
>
<ChartHandler
hideChartType
diff --git a/studio/components/interfaces/Billing/Subscription/CostBreakdownRow.tsx b/studio/components/interfaces/Billing/Subscription/CostBreakdownRow.tsx
index fd679cfcb03..5f11df5eb72 100644
--- a/studio/components/interfaces/Billing/Subscription/CostBreakdownRow.tsx
+++ b/studio/components/interfaces/Billing/Subscription/CostBreakdownRow.tsx
@@ -1,5 +1,5 @@
import { FC } from 'react'
-import { Badge, Typography } from '@supabase/ui'
+import { Badge } from '@supabase/ui'
interface Props {
item: string
@@ -13,7 +13,7 @@ const CostBreakdownRow: FC<Props> = ({ item, amount, unitPrice, price, freeQuota
return (
<div className="border-panel-border-light dark:border-panel-border-dark relative flex items-center border-t px-6 py-3">
<div className="flex w-[40%] items-center gap-3">
- <span>{item}</span>
+ <span className="text-sm">{item}</span>
{freeQuota && (
<Badge color="scale">
<span className="text-scale-900 text-xs">{`${freeQuota / 1000000000}GB included`}</span>
@@ -24,10 +24,10 @@ const CostBreakdownRow: FC<Props> = ({ item, amount, unitPrice, price, freeQuota
<span className="text-sm">{amount}</span>
</div>
<div className="flex w-[20%] justify-end">
- <span>${unitPrice}</span>
+ <span className="text-sm">${unitPrice}</span>
</div>
<div className="flex w-[20%] justify-end">
- <span>${price}</span>
+ <span className="text-sm">${price}</span>
</div>
</div>
)
diff --git a/studio/pages/project/[ref]/settings/billing/index.tsx b/studio/pages/project/[ref]/settings/billing/index.tsx
index c73e2ce698e..5348166d10d 100644
--- a/studio/pages/project/[ref]/settings/billing/index.tsx
+++ b/studio/pages/project/[ref]/settings/billing/index.tsx
@@ -108,7 +108,7 @@ const Settings: FC<SettingsProps> = ({ project }) => {
</div>
)}
</div>
- {paygStats && <PAYGUsage paygStats={paygStats} dateRange={dateRange} />}
+ {paygStats && dateRange && <PAYGUsage paygStats={paygStats} dateRange={dateRange} />}
</div>
) : (
<ProjectUsage projectRef={project.ref} subscription_id={project.subscription_id} />