diff --git a/apps/webapp/app/components/billing/UsageBar.tsx b/apps/webapp/app/components/billing/UsageBar.tsx index 08a8f2c55..c4a0be4b9 100644 --- a/apps/webapp/app/components/billing/UsageBar.tsx +++ b/apps/webapp/app/components/billing/UsageBar.tsx @@ -3,9 +3,10 @@ import { Paragraph } from "../primitives/Paragraph"; type UsageBarProps = { numberOfCurrentRuns: number; - billingLimit: number; + billingLimit?: number | undefined; tierRunLimit: number; projectedRuns: number; + subscribedToPaidTier?: boolean; }; export function UsageBar({ @@ -13,9 +14,15 @@ export function UsageBar({ billingLimit, tierRunLimit, projectedRuns, + subscribedToPaidTier = false, }: UsageBarProps) { //create a maximum range for the progress bar - const getLargestNumber = Math.max(numberOfCurrentRuns, tierRunLimit, billingLimit, projectedRuns); + const getLargestNumber = Math.max( + numberOfCurrentRuns, + tierRunLimit, + projectedRuns, + billingLimit ?? -Infinity + ); const maxRange = Math.round(getLargestNumber * 1.15); //convert the freeRunLimit into a percentage @@ -25,7 +32,8 @@ export function UsageBar({ const projectedRunsPercentage = Math.round((projectedRuns / maxRange) * 100); //convert the BillingLimit into a percentage - const billingLimitPercentage = Math.round((billingLimit / maxRange) * 100); + const billingLimitPercentage = + billingLimit !== undefined ? Math.round((billingLimit / maxRange) * 100) : 0; const usagePercentage = Math.round((numberOfCurrentRuns / maxRange) * 100); @@ -33,23 +41,25 @@ export function UsageBar({ return (