From 5eae32ba47fd2e6479cbc1cef1ef4f2fb992fe15 Mon Sep 17 00:00:00 2001 From: r00t <106870489+shekharcharles@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:13:29 +0530 Subject: [PATCH] fix(dashboard): light-mode backgrounds + aligned savings tables (#1064) ## Description Several dashboard cards and tables hardcoded a dark background (`bg-[#141414]`) that ignored the light theme. The most visible case was the **Agent Usage** section, which rendered black in light mode while every other surface flipped correctly. This converts those hardcoded backgrounds to the theme-aware `bg-card-alt` utility so the whole dashboard responds to the active theme, and tightens table column alignment. ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [ ] Code refactoring (no functional changes) ## Changes Made - Replace hardcoded `bg-[#141414]` with the `bg-card-alt` utility (`var(--card-alt-bg)`: `#f3f4f6` light / `#141414` dark) across Agent Usage cards, the request-count badge, and per-agent rows. 0 hardcoded darks remain. - Per-model and per-project savings tables: `table-layout:fixed` + explicit `` widths for stable columns. - Recent Requests: switch table markup to a CSS grid so columns align regardless of content length. - Add a per-project savings section (progress bar, Last Active column, empty state). - Single file changed: `headroom/dashboard/templates/dashboard.html`. ## Testing - [x] Unit tests pass (`pytest`) - [ ] Linting passes (`ruff check .`) - [ ] Type checking passes (`mypy headroom`) - [ ] New tests added for new functionality - [x] Manual testing performed ### Test Output ```text $ .venv/Scripts/python.exe -m pytest tests/test_dashboard_agent_usage.py -q ======================== 13 passed, 1 warning in 0.89s ======================== $ grep -c "bg-\[#141414\]" headroom/dashboard/templates/dashboard.html 0 # zero hardcoded dark backgrounds remain $ grep -c "bg-card-alt" headroom/dashboard/templates/dashboard.html 8 # all converted to the theme-aware utility ``` ## Real Behavior Proof - Environment: Windows 11, headroom proxy 0.26.0 serving `/dashboard` (template read per-request from disk, no cache). - Exact command / steps: start proxy, open `http://127.0.0.1:8787/dashboard`, toggle light mode, inspect the Agent Usage section. - Observed result: Agent Usage cards (Before/After/Saved/Savings + per-agent rows) now use the light surface (`#f3f4f6`) in light mode and `#141414` in dark mode, matching the rest of the dashboard. Confirmed visually on refresh; `grep` confirms 0 hardcoded darks remain. - Not tested: `ruff`/`mypy` (HTML template, no Python changed); no automated visual-regression test added. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] I have updated the CHANGELOG.md if applicable ## Additional Notes Presentation-only change to a single HTML template; no Python touched, so `ruff`/`mypy` are N/A. No visual-regression test added (none exists for the dashboard); existing `test_dashboard_agent_usage.py` data tests still pass. CHANGELOG not updated (UI fix). --- headroom/dashboard/templates/dashboard.html | 270 ++++++++++++-------- 1 file changed, 157 insertions(+), 113 deletions(-) diff --git a/headroom/dashboard/templates/dashboard.html b/headroom/dashboard/templates/dashboard.html index 3d3021046..6d77d6342 100644 --- a/headroom/dashboard/templates/dashboard.html +++ b/headroom/dashboard/templates/dashboard.html @@ -99,6 +99,9 @@ html:not(.dark) .text-cyan-200\/80 { color: #0e7490; } html:not(.dark) .text-cyan-300\/75 { color: #0891b2; } html:not(.dark) .text-violet-300\/75 { color: #7c3aed; } + /* Light mode: fix hardcoded dark card backgrounds */ + .bg-card-alt { background: var(--card-alt-bg); } + .hover-bg-surface:hover { background: var(--color-surface); } @@ -324,26 +327,26 @@
-
-
+
Before
-
+
After
-
+
Saved
-
+
Savings
@@ -352,7 +355,7 @@