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:
Spencer
2026-02-20 05:11:11 +00:00
parent 2ecdc4b533
commit 211a6fb50a
4 changed files with 29 additions and 14 deletions
@@ -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>
)}