From a2a5c48a5a58a99b40024c09d7f705b1d5c378f2 Mon Sep 17 00:00:00 2001 From: Sven Efftinge Date: Tue, 6 Dec 2022 08:48:00 +0000 Subject: [PATCH] [ubp] smaller balance view impr --- .../components/UsageBasedBillingConfig.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) 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 + + )}