Skip to content

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

Small fix

Joshen Limef1ed7e6d629
diff --git a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx
index 17fb5d9df74..af811406f30 100644
--- a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx
+++ b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx
@@ -17,7 +17,9 @@ const ProjectUsage: FC<Props> = ({ projectRef }) => {
const { ui } = useStore()
const { usage, error, isLoading } = useProjectUsage(projectRef)
- const isEnterprise = ui.selectedProject?.subscription_tier === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
+ const showUsageExceedMessage =
+ ui.selectedProject?.subscription_tier !== undefined &&
+ ui.selectedProject?.subscription_tier !== PRICING_TIER_PRODUCT_IDS.ENTERPRISE
useEffect(() => {
if (error) {
@@ -45,7 +47,7 @@ const ProjectUsage: FC<Props> = ({ projectRef }) => {
<div>
{usageBasedItems.map((product) => {
const isExceededUsage =
- !isEnterprise &&
+ showUsageExceedMessage &&
product.features
.map((feature) => {
const featureUsage = usage[feature.key]
@@ -97,7 +99,7 @@ const ProjectUsage: FC<Props> = ({ projectRef }) => {
const featureUsage = usage[feature.key]
const usageRatio = featureUsage.usage / featureUsage.limit
const isApproaching = usageRatio >= USAGE_APPROACHING_THRESHOLD
- const isExceeded = !isEnterprise && usageRatio >= 1
+ const isExceeded = showUsageExceedMessage && usageRatio >= 1
return (
<tr
@@ -107,31 +109,35 @@ const ProjectUsage: FC<Props> = ({ projectRef }) => {
<td className="whitespace-nowrap px-6 py-3 text-sm text-scale-1200">
{feature.title}
</td>
- {!isEnterprise && (
- <td className="w-1/5 whitespace-nowrap p-3 text-sm lg:table-cell hidden text-scale-1200">
- {(usageRatio * 100).toFixed(2)} %
- </td>
+ {ui.selectedProject?.subscription_tier !== undefined && (
+ <>
+ {showUsageExceedMessage && (
+ <td className="w-1/5 whitespace-nowrap p-3 text-sm lg:table-cell hidden text-scale-1200">
+ {(usageRatio * 100).toFixed(2)} %
+ </td>
+ )}
+ <td className="px-6 py-3 text-sm text-scale-1200">
+ {showUsageExceedMessage ? (
+ <SparkBar
+ type="horizontal"
+ barClass={`${
+ isExceeded
+ ? 'bg-red-900'
+ : isApproaching
+ ? 'bg-yellow-900'
+ : 'bg-brand-900'
+ }`}
+ value={featureUsage.usage}
+ max={featureUsage.limit}
+ labelBottom={formatBytes(featureUsage.usage)}
+ labelTop={formatBytes(featureUsage.limit)}
+ />
+ ) : (
+ <span>{formatBytes(featureUsage.usage)}</span>
+ )}
+ </td>
+ </>
)}
- <td className="px-6 py-3 text-sm text-scale-1200">
- {!isEnterprise ? (
- <SparkBar
- type="horizontal"
- barClass={`${
- isExceeded
- ? 'bg-red-900'
- : isApproaching
- ? 'bg-yellow-900'
- : 'bg-brand-900'
- }`}
- value={featureUsage.usage}
- max={featureUsage.limit}
- labelBottom={formatBytes(featureUsage.usage)}
- labelTop={formatBytes(featureUsage.limit)}
- />
- ) : (
- <span>{formatBytes(featureUsage.usage)}</span>
- )}
- </td>
</tr>
)
})}
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
index d871012a1be..6524d5b35d6 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
@@ -23,6 +23,7 @@ const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder =
const { usage } = useProjectUsage(ref as string)
const resourcesExceededLimits = getResourcesExceededLimits(usage)
const isOverUsageLimits =
+ selectedProject?.subscription_tier !== undefined &&
selectedProject?.subscription_tier !== PRICING_TIER_PRODUCT_IDS.ENTERPRISE &&
resourcesExceededLimits.length > 0