77import type React from 'react' ;
88import { Text } from 'ink' ;
99import {
10- getStatusColor ,
11- QUOTA_THRESHOLD_HIGH ,
12- QUOTA_THRESHOLD_MEDIUM ,
10+ getUsedStatusColor ,
11+ QUOTA_USED_WARNING_THRESHOLD ,
12+ QUOTA_USED_CRITICAL_THRESHOLD ,
1313} from '../utils/displayUtils.js' ;
1414import { formatResetTime } from '../utils/formatters.js' ;
1515
@@ -30,15 +30,15 @@ export const QuotaDisplay: React.FC<QuotaDisplayProps> = ({
3030 return null ;
3131 }
3232
33- const percentage = ( remaining / limit ) * 100 ;
33+ const usedPercentage = 100 - ( remaining / limit ) * 100 ;
3434
35- if ( percentage > QUOTA_THRESHOLD_HIGH ) {
35+ if ( usedPercentage < QUOTA_USED_WARNING_THRESHOLD ) {
3636 return null ;
3737 }
3838
39- const color = getStatusColor ( percentage , {
40- green : QUOTA_THRESHOLD_HIGH ,
41- yellow : QUOTA_THRESHOLD_MEDIUM ,
39+ const color = getUsedStatusColor ( usedPercentage , {
40+ warning : QUOTA_USED_WARNING_THRESHOLD ,
41+ critical : QUOTA_USED_CRITICAL_THRESHOLD ,
4242 } ) ;
4343
4444 const resetInfo =
@@ -57,8 +57,8 @@ export const QuotaDisplay: React.FC<QuotaDisplayProps> = ({
5757 return (
5858 < Text color = { color } >
5959 { terse
60- ? `${ percentage . toFixed ( 0 ) } %`
61- : `/stats ${ percentage . toFixed ( 0 ) } % usage remaining ${ resetInfo } ` }
60+ ? `${ usedPercentage . toFixed ( 0 ) } %`
61+ : `/stats ${ usedPercentage . toFixed ( 0 ) } % used ${ resetInfo } ` }
6262 </ Text >
6363 ) ;
6464} ;
0 commit comments