diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx index 30ae0d4cc3c..b876fb1fc66 100644 --- a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx +++ b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx @@ -243,6 +243,12 @@ export const USAGE_CATEGORIES: CategoryMeta[] = [ description: "Count of messages going through Realtime.\nUsage example: If you do a database change and 5 clients listen to that change via Realtime, that's 5 messages. If you broadcast a message and 4 clients listen to that, that's 5 messages (1 message sent, 4 received).\nBilling is based on the total amount of messages throughout your billing period.", chartDescription: 'The data refreshes every 24 hours.', + links: [ + { + name: 'Realtime Rate Limits', + url: 'https://supabase.com/docs/guides/realtime/rate-limits', + }, + ], }, { anchor: 'realtimePeakConnection', @@ -254,6 +260,12 @@ export const USAGE_CATEGORIES: CategoryMeta[] = [ description: 'Total number of successful connections. Connections attempts are not counted towards usage.\nBilling is based on the maximum amount of concurrent peak connections throughout your billing period.', chartDescription: 'The data refreshes every 24 hours.', + links: [ + { + name: 'Realtime Rate Limits', + url: 'https://supabase.com/docs/guides/realtime/rate-limits', + }, + ], }, ], }, diff --git a/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx b/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx index d30c3d8d6ad..7ccc83cf579 100644 --- a/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx +++ b/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx @@ -68,166 +68,199 @@ const UsageSection = ({ return (
-
-
-
-

{attribute.name} usage

- {currentBillingCycleSelected && - usageBasedBilling === false && - usageRatio >= USAGE_APPROACHING_THRESHOLD && ( - - - {!usageBasedBilling && usageRatio >= 1 ? ( -
- -

Exceeded limit

-
- ) : ( - !usageBasedBilling && - usageRatio >= USAGE_APPROACHING_THRESHOLD && ( -
- -

Approaching limit

-
- ) - )} -
- - - -
-

- Exceeding your plans included usage will lead to restrictions to - your project. -

-

- Upgrade to a usage-based plan or disable the spend cap to avoid - restrictions. -

-
-
-
-
- )} -
+ {usageMeta?.available_in_plan ? ( + <> +
+
+
+

{attribute.name} usage

+ {currentBillingCycleSelected && + usageBasedBilling === false && + usageRatio >= USAGE_APPROACHING_THRESHOLD && ( + + + {!usageBasedBilling && usageRatio >= 1 ? ( +
+ +

+ Exceeded limit +

+
+ ) : ( + !usageBasedBilling && + usageRatio >= USAGE_APPROACHING_THRESHOLD && ( +
+ +

Approaching limit

+
+ ) + )} +
+ + + +
+

+ Exceeding your plans included usage will lead to restrictions + to your project. +

+

+ Upgrade to a usage-based plan or disable the spend cap to + avoid restrictions. +

+
+
+
+
+ )} +
- {currentBillingCycleSelected && - !usageBasedBilling && - usageRatio >= USAGE_APPROACHING_THRESHOLD && ( - - - - - - )} -
- {currentBillingCycleSelected && usageMeta?.limit > 0 && ( - = 1 - ? usageBasedBilling - ? 'bg-amber-900' - : 'bg-red-900' - : usageBasedBilling === false && usageRatio >= USAGE_APPROACHING_THRESHOLD - ? 'bg-amber-900' - : 'bg-scale-1100' - )} - bgClass="bg-gray-300 dark:bg-gray-600" - value={usageMeta?.usage ?? 0} - max={usageMeta?.limit || 1} - /> - )} -
-
-

- Included in {subscription?.plan?.name.toLowerCase()} plan -

-

- {attribute.unit === 'bytes' - ? formatBytes(usageMeta?.limit ?? 0) - : (usageMeta?.limit ?? 0).toLocaleString()} -

-
-
-

- {attribute.chartPrefix || 'Used '}in period -

-

- {attribute.unit === 'bytes' - ? formatBytes(usageMeta?.usage ?? 0) - : (usageMeta?.usage ?? 0).toLocaleString()} -

-
- {currentBillingCycleSelected && usageMeta?.limit > 0 && ( -
-

Overage in period

-

- {usageExcess < 0 - ? attribute.unit === 'bytes' - ? formatBytes(0) - : 0 - : attribute.unit === 'bytes' - ? formatBytes(usageExcess) - : usageExcess.toLocaleString()} -

+ {currentBillingCycleSelected && + !usageBasedBilling && + usageRatio >= USAGE_APPROACHING_THRESHOLD && ( + + + + + + )}
+ {currentBillingCycleSelected && usageMeta?.limit > 0 && ( + = 1 + ? usageBasedBilling + ? 'bg-amber-900' + : 'bg-red-900' + : usageBasedBilling === false && + usageRatio >= USAGE_APPROACHING_THRESHOLD + ? 'bg-amber-900' + : 'bg-scale-1100' + )} + bgClass="bg-gray-300 dark:bg-gray-600" + value={usageMeta?.usage ?? 0} + max={usageMeta?.limit || 1} + /> + )} +
+
+

+ Included in {subscription?.plan?.name.toLowerCase()} plan +

+ {usageMeta?.limit === -1 ? ( +

None

+ ) : usageMeta?.limit === 0 ? ( +

Unlimited

+ ) : ( +

+ {attribute.unit === 'bytes' + ? formatBytes(usageMeta?.limit ?? 0) + : (usageMeta?.limit ?? 0).toLocaleString()} +

+ )} +
+ {currentBillingCycleSelected && ( +
+

+ {attribute.chartPrefix || 'Used '}in period +

+

+ {attribute.unit === 'bytes' + ? formatBytes(usageMeta?.usage ?? 0) + : (usageMeta?.usage ?? 0).toLocaleString()} +

+
+ )} + {currentBillingCycleSelected && usageMeta?.limit > 0 && ( +
+

Overage in period

+

+ {(usageMeta?.limit ?? 0) === -1 || usageExcess < 0 + ? 0 + : attribute.unit === 'bytes' + ? formatBytes(usageExcess) + : usageExcess.toLocaleString()} +

+
+ )} +
+
+ + {attribute.additionalInfo?.(subscription, usage)} + +
+

+ {attribute.chartPrefix || ''} + {attribute.name} per day +

+ {attribute.chartDescription.split('\n').map((paragraph, idx) => ( +

+ {paragraph} +

+ ))} +
+ {chartMeta[attribute.key].isLoading ? ( +
+ + + +
+ ) : chartData.length > 0 && notAllValuesZero ? ( + ChartYFormatterCompactNumber(value, attribute.unit)} + /> + ) : ( + + +
+ +

No data in period

+

May take up to 24 hours to show

+
+
+
)} -
-
- - {attribute.additionalInfo?.(subscription, usage)} - -
-

- {attribute.chartPrefix || ''} - {attribute.name} per day -

- {attribute.chartDescription.split('\n').map((paragraph, idx) => ( -

- {paragraph} -

- ))} -
- {chartMeta[attribute.key].isLoading ? ( -
- - - -
- ) : chartData.length > 0 && notAllValuesZero ? ( - ChartYFormatterCompactNumber(value, attribute.unit)} - /> + ) : ( -
- -

No data in period

-

May take up to 24 hours to show

+
+
+

Not included in plan

+
+

+ You need to be on a higher plan in order to use this feature. +

+
+
+ + + + +