From 22100e8b6a940a071e5183fd223c25473042fb39 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Thu, 19 Sep 2024 11:25:53 +0100 Subject: [PATCH] Removed the usage prediction for now --- .../app/components/billing/v3/UsageBar.tsx | 39 ++----------------- .../route.tsx | 32 +++++---------- 2 files changed, 12 insertions(+), 59 deletions(-) diff --git a/apps/webapp/app/components/billing/v3/UsageBar.tsx b/apps/webapp/app/components/billing/v3/UsageBar.tsx index c12d6d030be..7d4e5db2380 100644 --- a/apps/webapp/app/components/billing/v3/UsageBar.tsx +++ b/apps/webapp/app/components/billing/v3/UsageBar.tsx @@ -8,32 +8,16 @@ type UsageBarProps = { current: number; billingLimit?: number; tierLimit?: number; - projectedUsage?: number; isPaying: boolean; }; const startFactor = 4; -export function UsageBar({ - current, - billingLimit, - tierLimit, - projectedUsage, - isPaying, -}: UsageBarProps) { - const getLargestNumber = Math.max( - current, - tierLimit ?? -Infinity, - projectedUsage ?? -Infinity, - billingLimit ?? -Infinity, - 5 - ); +export function UsageBar({ current, billingLimit, tierLimit, isPaying }: UsageBarProps) { + const getLargestNumber = Math.max(current, tierLimit ?? -Infinity, billingLimit ?? -Infinity, 5); //creates a maximum range for the progress bar, add 10% to the largest number so the bar doesn't reach the end const maxRange = Math.round(getLargestNumber * 1.1); const tierRunLimitPercentage = tierLimit ? Math.round((tierLimit / maxRange) * 100) : 0; - const projectedRunsPercentage = projectedUsage - ? Math.round((projectedUsage / maxRange) * 100) - : 0; const billingLimitPercentage = billingLimit !== undefined ? Math.round((billingLimit / maxRange) * 100) : 0; const usagePercentage = Math.round((current / maxRange) * 100); @@ -42,7 +26,7 @@ export function UsageBar({ const usageCappedToLimitPercentage = Math.min(usagePercentage, tierRunLimitPercentage); return ( -
+
{billingLimit !== undefined && ( )} - {projectedUsage !== undefined && projectedUsage !== 0 && ( - - - - )} - {(usage) => ( - <> -
-
- - {isCurrentMonth ? "Month-to-date" : "Usage"} - -

- {formatCurrency(usage.overall.current, false)} -

-
- {isCurrentMonth ? ( - <> - -
- Projected -

- {formatCurrency(usage.overall.projected, false)} -

-
- - ) : null} +
+
+ + {isCurrentMonth ? "Month-to-date" : "Usage"} + +

+ {formatCurrency(usage.overall.current, false)} +

- +
)}