diff --git a/components/dashboard/src/components/UsageBasedBillingConfig.tsx b/components/dashboard/src/components/UsageBasedBillingConfig.tsx index 308923277addd4..c4c00e31bdf2e9 100644 --- a/components/dashboard/src/components/UsageBasedBillingConfig.tsx +++ b/components/dashboard/src/components/UsageBasedBillingConfig.tsx @@ -207,7 +207,7 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) { }; const balance = currentUsage * -1 + usageLimit; - const percentage = Math.max(Math.round((balance * 100) / usageLimit), 0); + const percentage = usageLimit === 0 ? 0 : Math.max(Math.round((balance * 100) / usageLimit), 0); return (
@@ -237,18 +237,18 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
- Monthly limit: {usageLimit} Credits - {showManageBilling && ( - <> -  ·  - setShowUpdateLimitModal(true)}> - Update limit - - - )} + {typeof currentUsage === "number" && + typeof usageLimit === "number" && + usageLimit > 0 && {percentage}% remaining} - {typeof currentUsage === "number" && typeof usageLimit === "number" && usageLimit > 0 && ( - {percentage}% remaining + Monthly limit: {usageLimit} Credits + {showManageBilling && ( + <> +  ·  + setShowUpdateLimitModal(true)}> + Update limit + + )}