Skip to content

Commit 86d326b

Browse files
committed
fix: only show usage limit message when reset time is in future
Prevents displaying usage limit message after the reset time has passed by checking if current time is before the reset time.
1 parent 58c401c commit 86d326b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/_live-rendering.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,12 @@ export function renderLiveDisplay(terminal: TerminalManager, block: SessionBlock
160160
const sessionDetails = ` ${col1}${pad1}${pad2}${col3}`;
161161
const sessionDetailsPadded = sessionDetails + ' '.repeat(Math.max(0, boxWidth - 3 - stringWidth(sessionDetails)));
162162
// Claude usage limit message
163-
const resetTime = block.usageLimitResetTime?.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', hour12: true }) ?? null;
164-
const usageLimitResetTime = resetTime !== null ? pc.red(`❌ USAGE LIMIT. RESET AT ${resetTime}`) : '';
165-
const usageLimitResetTimePadded = resetTime !== null ? usageLimitResetTime + ' '.repeat(Math.max(0, boxWidth - 3 - stringWidth(usageLimitResetTime))) : null;
163+
let usageLimitResetTimePadded: string | null = null;
164+
if (block.usageLimitResetTime !== undefined && now < block.usageLimitResetTime) {
165+
const resetTime = block.usageLimitResetTime?.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', hour12: true }) ?? null;
166+
const usageLimitResetTime = resetTime !== null ? pc.red(`❌ USAGE LIMIT. RESET AT ${resetTime}`) : '';
167+
usageLimitResetTimePadded = resetTime !== null ? usageLimitResetTime + ' '.repeat(Math.max(0, boxWidth - 3 - stringWidth(usageLimitResetTime))) : null;
168+
}
166169
terminal.write(`${marginStr}│ ${sessionDetailsPadded}│\n`);
167170
if (usageLimitResetTimePadded !== null) {
168171
terminal.write(`${marginStr}│ ${usageLimitResetTimePadded}│\n`);

0 commit comments

Comments
 (0)