fix(status-bar): restore weekly usage label (#2149)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
parent
664849a708
commit
f9191c6f2b
|
|
@ -74,7 +74,7 @@ function mapRpcWindow(
|
|||
return {
|
||||
usedPercent: Math.min(100, Math.max(0, raw.usedPercent)),
|
||||
// Why: Codex currently reports remaining minutes in `windowDurationMins`.
|
||||
// Orca's UI needs the fixed bucket duration so labels stay "5h" / "7d".
|
||||
// Orca's UI needs the fixed bucket duration so labels stay "5h" / "wk".
|
||||
windowMinutes: expectedWindowMinutes,
|
||||
resetsAt,
|
||||
resetDescription
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ describe('formatWindowLabel', () => {
|
|||
expect(formatWindowLabel(60)).toBe('1h')
|
||||
})
|
||||
|
||||
it('returns "7d" for 10080 minutes (7 days)', () => {
|
||||
expect(formatWindowLabel(10080)).toBe('7d')
|
||||
it('returns "wk" for 10080 minutes (7 days)', () => {
|
||||
expect(formatWindowLabel(10080)).toBe('wk')
|
||||
})
|
||||
|
||||
it('returns "1d" for 1440 minutes (1 day)', () => {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
* Returns a short human-readable label for a usage window duration.
|
||||
*
|
||||
* Why: the status bar uses duration labels, so the weekly bucket is shown as
|
||||
* "7d" instead of a calendar-period label like "wk".
|
||||
* Why: 10080 minutes (7 days) is hard-coded as "wk" for backward
|
||||
* compatibility with the original StatusBar implementation.
|
||||
*/
|
||||
export function formatWindowLabel(windowMinutes: number): string {
|
||||
if (windowMinutes === 10080) {
|
||||
return '7d'
|
||||
return 'wk'
|
||||
}
|
||||
if (windowMinutes === 300) {
|
||||
return '5h'
|
||||
|
|
|
|||
Loading…
Reference in New Issue