mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-08-09 16:36:40 -07:00
fix(cli): refine quota reset time formatting and call sites
- Reverts formatResetTime to return only the raw duration string. - Moves 'resets in' prefix logic to call sites to prevent duplication. - Fixes double parentheses in StatsDisplay for imminent resets. - Removes brittle string replacement in favor of direct formatting.
This commit is contained in:
@@ -42,7 +42,16 @@ export const QuotaDisplay: React.FC<QuotaDisplayProps> = ({
|
||||
});
|
||||
|
||||
const resetInfo =
|
||||
!terse && resetTime ? `, ${formatResetTime(resetTime)}` : '';
|
||||
!terse && resetTime
|
||||
? (function (t) {
|
||||
const formatted = formatResetTime(t);
|
||||
const info =
|
||||
formatted === 'Resetting...' || formatted === '< 1m'
|
||||
? formatted
|
||||
: `resets in ${formatted}`;
|
||||
return `, ${info}`;
|
||||
})(resetTime)
|
||||
: '';
|
||||
|
||||
if (remaining === 0) {
|
||||
return (
|
||||
|
||||
@@ -69,7 +69,13 @@ export const QuotaStatsInfo: React.FC<QuotaStatsInfoProps> = ({
|
||||
: ''}
|
||||
</Text>
|
||||
)}
|
||||
{resetTime && `, ${formatResetTime(resetTime)}`}
|
||||
{resetTime &&
|
||||
`, ${(function (t) {
|
||||
const formatted = formatResetTime(t);
|
||||
return formatted === 'Resetting...' || formatted === '< 1m'
|
||||
? formatted
|
||||
: `resets in ${formatted}`;
|
||||
})(resetTime)}`}
|
||||
</Text>
|
||||
)}
|
||||
{showDetails && (
|
||||
|
||||
@@ -365,10 +365,13 @@ const ModelUsageTable: React.FC<{
|
||||
<Text color={theme.text.secondary}>
|
||||
{' '}
|
||||
(
|
||||
{formatResetTime(row.bucket.resetTime).replace(
|
||||
'resets in',
|
||||
'Resets in',
|
||||
)}
|
||||
{(function (t) {
|
||||
const formatted = formatResetTime(t);
|
||||
return formatted === 'Resetting...' ||
|
||||
formatted === '< 1m'
|
||||
? formatted
|
||||
: `Resets in ${formatted}`;
|
||||
})(row.bucket.resetTime)}
|
||||
)
|
||||
</Text>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user