feat(usage): add hide-when-zero state to usage widgets and reset timers - #599
Open
tough-griff wants to merge 4 commits into
Open
tough-griff wants to merge 4 commits into
tough-griff wants to merge 4 commits into
Conversation
Session, Weekly, Weekly Sonnet, Weekly Opus and Weekly Fable usage widgets, plus the Block and Weekly reset timers, gain an opt-in `zero` hideable state. Usage widgets hide when their raw usage is 0 (independent of invert); reset timers hide when their period's usage (session/weekly) is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion Both widgets gain the opt-in `zero` hideable state: Used hides at $0 spent, Utilization hides at 0% (independent of invert). Extra Usage Remaining is left alone, since hiding it would hide either the full budget or the $0-left warning. The v3 -> v4 hide migration rule for the two widgets now lists `zero` so a hand-written hide list keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List the new `zero` state for the usage-percent widgets, the reset timers, and Extra Usage Used/Utilization (noting Remaining has none). The shared suite's "zero state off" case now asserts the exact 0.0% output instead of just non-null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… time A null API bucket pins session/weekly usage to 0% even when limits[] still reports a live window (sirmalloc#503), so hide-when-zero was hiding reset timers that had a valid countdown. The timers now hide on zero only when no reset time was reported for that period, which still covers unused windows and Enterprise accounts with no rate-limit windows (sirmalloc#343). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #598
Adds an opt-in
zerohideable state (via the existing(h)ide…checklist) to the usage widgets and reset timers.Changes
renderUsagePercentWidgetValue.nullAPI bucket pins usage to 0% even whenlimits[]still supplies a live window (Weekly session usage not updating after fable-only usage added #503), so without it the option would hide a valid countdown on migrated accounts.zero, so a hand-written hide list keeps it.docs/USAGE.mdhide-state list updated.Testing
bun testandbun run lintpassnull) and the example payloadEnterprise account, same line as in #598. Before (config in #598: Session Usage, Weekly Usage and both reset timers on
hide: no-data; the Extra Usage widgets ondisabled,no-data):After (
zeroadded to every widget; the Extra Usage widgets stay visible because spend is non-zero):Widget config for the after line
[ { "id": "fb09dd02-a41b-4172-bfdf-4dd7e329b8a7", "type": "extra-usage-used", "color": "ansi256:11", "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "hide": "disabled,no-data,zero" } }, { "id": "9fdb44e0-25bf-44ac-b943-a34f1b377d18", "type": "separator", "character": " " }, { "id": "351546ed-1c7c-4663-8c2a-cf7ca36443b7", "type": "extra-usage-utilization", "color": "ansi256:11", "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "display": "slider", "invert": "false", "hide": "disabled,no-data,zero" } }, { "id": "7b2987cb-1c37-4f4c-bce6-4adb6d482626", "type": "separator", "color": "ansi256:7", "dim": true }, { "id": "b125133a-d2da-4254-955e-ad9bfa5a3487", "type": "session-usage", "color": "ansi256:80", "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "invert": "false", "display": "time", "hide": "no-data,zero" } }, { "id": "52245476-8615-43c9-8db5-7fd37c45139c", "type": "separator", "character": " " }, { "id": "6fa9558a-8a03-442c-bfef-dfb5854cba65", "type": "reset-timer", "color": "ansi256:80", "dim": true, "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "display": "time", "compact": "true", "absolute": "false", "hide": "no-data,zero" } }, { "id": "d7a551fb-4953-44bd-8448-ecaecacf9668", "type": "separator", "color": "ansi256:7", "dim": true }, { "id": "a73d2332-9fbb-48f9-abc5-02d4561157ca", "type": "weekly-usage", "color": "ansi256:81", "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "display": "time", "invert": "false", "hide": "no-data,zero" } }, { "id": "1df9ff5e-64a3-41ad-8f97-d45367ba35ee", "type": "separator", "character": " " }, { "id": "1a69f9af-0275-40f5-8521-af07f0e8940b", "type": "weekly-reset-timer", "color": "ansi256:81", "dim": true, "numberFormat": { "style": "compact" }, "rawValue": true, "metadata": { "display": "time", "compact": "true", "hours": "false", "hide": "no-data,zero" } } ]🤖 Generated with Claude Code