Skip to content

feat(dashboard): refine activity calendar gradation, colors, alignment + chart day markers#443

Merged
SantiagoDePolonia merged 3 commits into
mainfrom
feat/github-chart-refinement
Jun 29, 2026
Merged

feat(dashboard): refine activity calendar gradation, colors, alignment + chart day markers#443
SantiagoDePolonia merged 3 commits into
mainfrom
feat/github-chart-refinement

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Refines the dashboard's GitHub-style Activity calendar and the live token throughput chart's day markers.

Activity calendar

  • More gradual gradation. Replaced the 5-level log scale with a 10-level power scale (exponent 0.7). Log compressed the busy end, so high-volume days were indistinguishable (a 1M and a 1.5M tokens/day both pinned to the top shade). Power 0.7 keeps big days separated while still lifting quiet days off the lightest level. With a 1.5M max: 1M→L8, 1.25M→L9, 1.5M→L10.
  • Green → prompt-cache blue. The ramp is now a graduated blue derived from --info (the prompt-cache blue), across the dark and both light theme blocks. Legend is now data-driven so it always mirrors the grid.
  • Sunday alignment fix. Week columns were aligned to Monday (ISO), so the top row held Monday while the Mon label lined up with the second row. Now aligned to Sunday → rows read Sun..Sat, matching the Mon/Wed/Fri labels (GitHub style). Applied to both buildCalendarGrid and calendarMonthLabels.

Live token throughput chart

  • The day-boundary divider line + date label were drawn in the muted axis color (--chart-text) at low opacity, so they were faint. They now use a new high-contrast --chart-day-marker color (the primary text color: bright on dark, dark on light) at higher opacity — the date label especially is now legible.

User-visible impact

Dashboard-only (Overview page). No API or provider behavior changes.

Tests

contribution-calendar.test.cjs updated for the new scale; added legend-coverage and Sunday-first regression tests. 8/8 pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Expanded the contribution calendar intensity range to fully cover levels 0–10, with matching footer legend entries.
    • Improved visual theming for charts/calendar (including unified day-marker color) for consistent dark/light/system appearance.
  • Bug Fixes
    • Fixed contribution calendar layout to use Sunday-first weekly alignment and consistent month labels.
    • Updated calendar intensity scaling for smoother, more accurate heatmap levels.
    • Refined overview chart stacking behavior and enhanced tooltips to better summarize totals.
    • Improved day separator line styling/opacity and date label rendering.

SantiagoDePolonia and others added 2 commits June 29, 2026 20:17
The activity calendar used a 5-level log scale, which compressed the busy
end so high-volume days were indistinguishable (e.g. a 1M and a 1.5M
tokens/day both pinned to the top shade).

- Switch to a 10-level power scale (exponent 0.7): keeps high-volume days
  separated while still lifting quiet days off the lightest level.
- Recolor the green ramp to a graduated blue derived from the prompt-cache
  blue (--info), across the dark and both light theme blocks.
- Make the legend data-driven so it always mirrors the grid's level count.
- Update tests for the new scale and add a legend-coverage test.

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

Two dashboard chart fixes:

- Activity calendar: align week columns to Sunday (was Monday/ISO) so the
  rows read Sun..Sat top-to-bottom, matching the Mon/Wed/Fri day labels.
  Previously Monday sat in the top row while its label aligned to the
  second row. Applied to both buildCalendarGrid and calendarMonthLabels so
  month headers stay over the right columns; added a Sunday-first test.

- Live token throughput chart: draw the day-boundary divider and date label
  in a new high-contrast --chart-day-marker color (the primary text color:
  bright on dark, dark on light) at higher opacity, so the marker and
  especially its date label are legible instead of faint muted gray.

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

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 002cc840-87eb-465a-a289-f218e8031df4

📥 Commits

Reviewing files that changed from the base of the PR and between 57d1524 and ffb5d96.

📒 Files selected for processing (1)
  • internal/admin/dashboard/static/js/modules/charts.js

📝 Walkthrough

Walkthrough

The dashboard updates calendar heatmap scaling to 10 levels with Sunday-aligned grid layout, adds a dedicated day-marker color token, makes the legend dynamic, and changes the overview token chart to use stacked fills and summed tooltip totals.

Changes

Dashboard calendar scaling and chart marker updates

Layer / File(s) Summary
Theme ramp and day marker token
internal/admin/dashboard/static/css/dashboard.css, internal/admin/dashboard/static/js/dashboard.js, internal/admin/dashboard/static/js/modules/live-tokens.js
Adds --chart-day-marker, expands the calendar level palette to --cal-level-0 through --cal-level-10 across theme modes, exposes the token through chartColors(), and uses it for the live day-marker stroke and label rendering.
Calendar scaling and Sunday alignment
internal/admin/dashboard/static/js/modules/contribution-calendar.js, internal/admin/dashboard/static/js/modules/contribution-calendar.test.cjs
Replaces log-based calendar intensity bucketing with exponent-based levels, expands legend levels to 0..10, aligns the grid and month labels to Sunday, and updates the related calendar tests.
Dynamic calendar legend rendering
internal/admin/dashboard/templates/page-overview.html
Replaces the fixed contribution-calendar legend cells with a loop over calendarLegendLevels().
Overview chart stacking and totals
internal/admin/dashboard/static/js/modules/charts.js
Switches the overview token chart datasets to stacked fills, enables stacked y-axis behavior, and adds a tooltip footer that totals visible values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ENTERPILOT/GoModel#144: Introduced the contribution-calendar heatmap and legend paths that this PR extends with 10-level scaling and Sunday alignment.
  • ENTERPILOT/GoModel#185: Modifies buildCalendarGrid in the same module and overlaps with the grid-alignment logic changed here.
  • ENTERPILOT/GoModel#425: Adjusts calendarLevel and related tests in the same contribution-calendar code path.

Poem

🐇 I hop by Sunday, bright and new,
Ten little levels in a color stew.
Day markers shimmer, charts stack tall,
The legend loops for every call.
Hooray, says I, with twitchy nose—
The dashboard blooms where soft light glows.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main dashboard changes: activity calendar gradation, alignment, colors, and chart day markers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/github-chart-refinement

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/admin/dashboard/static/js/modules/contribution-calendar.test.cjs`:
- Around line 96-105: The calendarLegendLevels test is too loose and can miss
ordering or duplicate issues in the legend data. Update the assertion in
contribution-calendar.test.cjs so it verifies the exact full 0 through 10
sequence returned by createCalendarModule().calendarLegendLevels(), rather than
only checking the endpoints and membership. Keep the focus on the
calendarLegendLevels helper and ensure the expected array order matches what
page-overview.html renders.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0eeb890c-5ff8-41ec-8159-1cf2e380c8a3

📥 Commits

Reviewing files that changed from the base of the PR and between 8a202c3 and 57d1524.

📒 Files selected for processing (6)
  • internal/admin/dashboard/static/css/dashboard.css
  • internal/admin/dashboard/static/js/dashboard.js
  • internal/admin/dashboard/static/js/modules/contribution-calendar.js
  • internal/admin/dashboard/static/js/modules/contribution-calendar.test.cjs
  • internal/admin/dashboard/static/js/modules/live-tokens.js
  • internal/admin/dashboard/templates/page-overview.html

Comment on lines +96 to +105
test('calendarLegendLevels covers level 0 through the max level', () => {
const m = createCalendarModule();
const levels = m.calendarLegendLevels();
assert.equal(levels[0], 0, 'starts at the empty level');
assert.equal(levels[levels.length - 1], 10, 'ends at the darkest level');
// Every active level must have a matching swatch so the legend mirrors the grid.
for (let v = 1; v <= 10; v++) {
assert.ok(levels.includes(v), `legend includes level ${v}`);
}
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the exact legend sequence.

Because the template renders swatches in the returned order, this test should verify the full 0..10 array, not just endpoints and membership. A shuffled or duplicate-filled result would still pass here but break the legend ordering in internal/admin/dashboard/templates/page-overview.html, Lines 219-221.

Suggested tightening
 test('calendarLegendLevels covers level 0 through the max level', () => {
     const m = createCalendarModule();
     const levels = m.calendarLegendLevels();
-    assert.equal(levels[0], 0, 'starts at the empty level');
-    assert.equal(levels[levels.length - 1], 10, 'ends at the darkest level');
-    // Every active level must have a matching swatch so the legend mirrors the grid.
-    for (let v = 1; v <= 10; v++) {
-        assert.ok(levels.includes(v), `legend includes level ${v}`);
-    }
+    assert.deepEqual(
+        levels,
+        Array.from({ length: 11 }, (_, i) => i),
+        'legend should render each level exactly once in ascending order'
+    );
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test('calendarLegendLevels covers level 0 through the max level', () => {
const m = createCalendarModule();
const levels = m.calendarLegendLevels();
assert.equal(levels[0], 0, 'starts at the empty level');
assert.equal(levels[levels.length - 1], 10, 'ends at the darkest level');
// Every active level must have a matching swatch so the legend mirrors the grid.
for (let v = 1; v <= 10; v++) {
assert.ok(levels.includes(v), `legend includes level ${v}`);
}
});
test('calendarLegendLevels covers level 0 through the max level', () => {
const m = createCalendarModule();
const levels = m.calendarLegendLevels();
assert.deepEqual(
levels,
Array.from({ length: 11 }, (_, i) => i),
'legend should render each level exactly once in ascending order'
);
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/admin/dashboard/static/js/modules/contribution-calendar.test.cjs`
around lines 96 - 105, The calendarLegendLevels test is too loose and can miss
ordering or duplicate issues in the legend data. Update the assertion in
contribution-calendar.test.cjs so it verifies the exact full 0 through 10
sequence returned by createCalendarModule().calendarLegendLevels(), rather than
only checking the endpoints and membership. Keep the focus on the
calendarLegendLevels helper and ensure the expected array order matches what
page-overview.html renders.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The changes are dashboard-only visual refinements with no API or provider behavior impact.

The modified calendar scale, Sunday-first alignment, legend generation, and chart marker color changes are narrowly scoped and covered by updated calendar tests.

T-Rex T-Rex Logs

What T-Rex did

  • Observed the calendar scale re-mapping from max 1.5M to 1M/1.25M/1.5M with a new legend level range and a Monday-first week layout.
  • Noted the color ramp changed from green to blue and the first week rows now run Sun through Sat.
  • Rendered captures compare the UI before and after, showing the shift from a 5-swatch green legend/calendar to an 11-swatch blue legend/calendar.
  • Updated live token day marker styling to increase contrast by moving from a muted chart-text color to a brighter text color using a higher alpha value for stroke and a full alpha for the label.
  • Compared render images confirm the after-day-marker and label have visibly higher contrast than the before version.
  • Poster-frame captures were taken for the muted and high-contrast live token day markers to document visual changes.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(dashboard): Sunday-align activity ca..." | Re-trigger Greptile

The Daily Token Usage line chart drew every series from the axis baseline,
so Input/Output/Prompt-cached/Locally-cached overlapped instead of summing.
Convert it to a stacked area chart so each series sits on the one below and
the band's top edge is the per-unit total. Enable y/x axis stacking and add
a 'Total' line to the tooltip.

The series are additive and non-overlapping (paid input, output, prompt-cache
reads, local cache) — the same model the live throughput bar chart stacks —
so the total is correct with no double-counting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SantiagoDePolonia SantiagoDePolonia merged commit 92d4e88 into main Jun 29, 2026
20 checks passed
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