Skip to content

feat(usage): time-grid usage bars with current-segment highlight and over-pace warning#137

Merged
matej21 merged 1 commit into
mainfrom
feat/usage-graph-time-grid
Jun 11, 2026
Merged

feat(usage): time-grid usage bars with current-segment highlight and over-pace warning#137
matej21 merged 1 commit into
mainfrom
feat/usage-graph-time-grid

Conversation

@jonasnobile

Copy link
Copy Markdown
Member

Summary

Makes the Claude and Codex usage popovers show whether you're in line with your rate limits — not just how full the bar is. Three layered cues:

  1. Per-hour / per-day grid. Each usage bar is split into time segments — per-hour for the 5h session window, per-day for the 7d windows. Codex derives the segment count from the window's actual duration (capped so thin bars don't get crowded; sub-hour windows get no grid). Dividers use the border colour so they read over both the filled and empty parts of the track.

  2. Current-segment highlight. The segment you're currently in (today / this hour) gets a translucent band derived from text_primary, so it lightens on dark themes and darkens on light ones.

  3. Over-pace warning. Previously the bar only changed at 80%+ absolute. Now:

    • The fill up to the pace marker is the on-budget portion (coloured by nearness to the hard cap); usage beyond the marker is drawn as overage in warning/critical, so being over budget for this point in the period is visible directly on the bar.
    • The percentage text reflects the worse of absolute-vs-cap and pace.
    • A "Slow down to last the period" (critical) / "Ahead of pace" (warning) line appears when usage is running ahead of schedule.

Notes

  • Pace uses even-burn pacing (budget should be spent linearly across the window). A user who deliberately front-loads work early in a 7d window will see "Ahead of pace" even if they'll be fine — consistent with how the bar fill already behaved, just now surfaced.
  • The grid is a pace reference over the current utilisation snapshot, not historical per-bucket consumption (the usage APIs return a single cumulative figure per window).

Test plan

  • cargo build — both crates compile
  • cargo clippy — clean
  • cargo test — all pass (added segments_for_window unit test in Codex)
  • Visual check of both popovers in the running app (overage cap, highlight band, message line)

🤖 Generated with Claude Code

…warning

Make the Claude and Codex usage popovers show whether the user is in line
with their rate limits, not just how full the bar is.

- Split each usage bar into time segments: per-hour for the 5h session
  window, per-day for the 7d windows (Codex derives the count from the
  actual window duration). Divider lines use the border colour so they read
  across both filled and empty track.
- Highlight the segment the user is currently in (today / this hour) with a
  translucent band derived from text_primary, so it adapts to light/dark.
- Surface over-pace state directly: the fill up to the pace marker is the
  on-budget portion; usage beyond it is drawn as overage in warning/critical.
  The percentage text now reflects the worse of absolute-vs-cap and pace, and
  a "Slow down to last the period" / "Ahead of pace" line appears when ahead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonasnobile

Copy link
Copy Markdown
Member Author
image

@matej21 matej21 merged commit 5966c91 into main Jun 11, 2026
8 checks passed
@matej21 matej21 deleted the feat/usage-graph-time-grid branch June 11, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants