File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
components/dashboard/src/components Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
207
207
} ;
208
208
209
209
const balance = currentUsage * - 1 + usageLimit ;
210
- const percentage = Math . max ( Math . round ( ( balance * 100 ) / usageLimit ) , 0 ) ;
210
+ const percentage = usageLimit === 0 ? 0 : Math . max ( Math . round ( ( balance * 100 ) / usageLimit ) , 0 ) ;
211
211
212
212
return (
213
213
< div className = "mb-16" >
@@ -237,18 +237,18 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
237
237
</ div >
238
238
< div className = "mt-4 text-sm flex text-gray-400 dark:text-gray-500" >
239
239
< span className = "flex-grow" >
240
- < span > Monthly limit: { usageLimit } Credits</ span >
241
- { showManageBilling && (
242
- < >
243
- < span > · </ span >
244
- < span className = "gp-link" onClick = { ( ) => setShowUpdateLimitModal ( true ) } >
245
- Update limit
246
- </ span >
247
- </ >
248
- ) }
240
+ { typeof currentUsage === "number" &&
241
+ typeof usageLimit === "number" &&
242
+ usageLimit > 0 && < span > { percentage } % remaining</ span > }
249
243
</ span >
250
- { typeof currentUsage === "number" && typeof usageLimit === "number" && usageLimit > 0 && (
251
- < span > { percentage } % remaining</ span >
244
+ < span > Monthly limit: { usageLimit } Credits</ span >
245
+ { showManageBilling && (
246
+ < >
247
+ < span > · </ span >
248
+ < span className = "gp-link" onClick = { ( ) => setShowUpdateLimitModal ( true ) } >
249
+ Update limit
250
+ </ span >
251
+ </ >
252
252
) }
253
253
</ div >
254
254
< div className = "mt-2 flex" >
You can’t perform that action at this time.
0 commit comments