Skip to content

feat(render): heatmap renderer for contribution grids - #42

Merged
unhappychoice merged 8 commits into
mainfrom
feat/heatmap-renderer
Apr 21, 2026
Merged

unhappychoice merged 8 commits into
mainfrom
feat/heatmap-renderer

Conversation

@unhappychoice

Copy link
Copy Markdown
Owner

Ticks the `heatmap grid` primitive in #41.

Summary

  • New `Body::Heatmap { cells, thresholds, row_labels, col_labels }` payload variant.
  • New `heatmap` renderer in `src/render/heatmap.rs` — 2-column × 1-row cells, 5 intensity levels, reserved level-0 for zero, auto-quartile thresholds when the payload doesn't supply them, right-aligns wide grids in narrow slots ("last N weeks" survive). Hardcoded GitHub-grass palette for now; will migrate to theme once feat: Theme / color scheme system #17 lands.
  • New `contributions` stub fetcher with a deterministic 7×52 LCG-seeded fake. Stands in for the real `github_contributions` / `git_commits_activity` fetchers so the renderer is visible out of the box.
  • Default config now has a 52-week slot above the existing rows.

Why this first

Per #41's prioritization rubric: renderer primitives unlock many fetchers at once. One heatmap renderer covers github contributions, habit trackers, goal heatmaps, and any ReadStore-backed daily metric. Highest leverage among primitive gaps, and visually striking enough to show in screenshots.

Test plan

  • `cargo test` (158 passing, +9 new for heatmap renderer, +1 for stub coverage)
  • `cargo clippy --all-targets -- -D warnings` clean
  • manual: run `splashboard` and confirm the contribution strip renders with varying intensities

🤖 Generated with Claude Code

unhappychoice and others added 4 commits April 22, 2026 03:21
A 2D intensity grid — the primitive that powers GitHub contribution graphs,
habit trackers, and any daily/periodic metric. One renderer unlocks a whole
family of widgets that all share the "grid of colored cells" shape; future
fetchers (github_contributions, git_commits_activity, ReadStore-backed habit
trackers) feed this same renderer.

Each cell is 2 columns × 1 row to read as square-ish despite terminal's 1:2
aspect. Values bucket into 5 intensity levels; level 0 is reserved for zero
("no activity") so it stays visually distinct even on low-variance data.
Thresholds come from the payload when supplied, otherwise auto-quartile from
the non-zero values. When the slot is narrower than the grid, the rightmost
columns survive — "the most recent weeks" is what users want to see.

Palette is hardcoded to the classic GitHub grass for now; will route through
the theme system once #17 lands.

Ships a deterministic `contributions` stub fetcher so the default config
shows the grid out of the box without needing github_contributions or
ReadStore to exist yet. The default config now has a 52-week slot above the
existing disk/commits/system/prs rows.

Checkbox tracked in #41.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Keeps the dogfood config's "every shape, every renderer" invariant — the
heatmap renderer was added on this branch but only to the default baked
config.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The first pass painted both columns of each 2-column cell with a background
fill, so adjacent cells merged into a continuous band with no cell
definition. Now paints a filled-block glyph in column 0 with a colored
foreground and leaves column 1 as the terminal default — cells read as
distinct squares separated by subtle gaps, matching the GitHub
contribution-graph look and how gitfetch renders.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Level 0 now uses GitHub's light-mode empty color (#ebedf0) instead of the
dark background fill. Inactive cells read as "no activity" rather than as a
dark mass, and the green gradient stands out more against the light base.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 21, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 15 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 15 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f0bf224-7b59-4282-b5b3-7c9658e25487

📥 Commits

Reviewing files that changed from the base of the PR and between 009fd56 and 5b98509.

📒 Files selected for processing (6)
  • .splashboard/config.toml
  • src/default_config.toml
  • src/fetcher/stub.rs
  • src/payload.rs
  • src/render/heatmap.rs
  • src/render/mod.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/heatmap-renderer

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 and usage tips.

unhappychoice and others added 4 commits April 22, 2026 03:29
Paints `col_labels` as a top row when the area has vertical room for it
(grid rows + 1). Labels right-align with their cell column and truncate
before colliding with the next label. The contributions stub now fills in
labels for the week that contains each month's 1st, so the demo shows Jan
through Dec sliding with today's date.

Both the baked default config and the dogfood config bump the contributions
row by one line to accommodate the label row.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Heatmap was pinning to the left edge of its slot, which looked lopsided
next to centered widgets in the same splash. The renderer now reads
`opts.align` (left / center / right) and shifts the grid's x-origin by the
slack inside the area. Column labels shift with the grid so they stay
above their weeks.

Both the baked default and dogfood configs set `align = "center"` for the
contribution widget, which is the natural default for a decorative primary
widget in a wide terminal.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Promotes the contributions widget into the hero band — right after `notes`
— and drops the border + title so it reads as a flat decorative element,
matching the other hero-band widgets. The previous slot at the bottom of
the dense grid is removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit a38b01e into main Apr 21, 2026
4 of 5 checks passed
@unhappychoice
unhappychoice deleted the feat/heatmap-renderer branch April 21, 2026 18:35
unhappychoice added a commit that referenced this pull request May 17, 2026
Open merge requests authored by the authenticated GitLab user across every
project. Uses `/api/v4/merge_requests?scope=created_by_me&state=opened`.

9 shapes via the shared forge_items dispatcher: LinkedTextBlock (default) /
TextBlock / MarkdownTextBlock / ImageLinkedList / Entries / Text / Bars /
Badge ("N open MRs") / Timeline. `host` option (default `gitlab.com`)
covers self-hosted instances; `limit` clamps 1..=30 (default 10).

Mirrors `github_my_prs`; differences are GitLab-specific (`reviewer_username`
filter, `references.full` slug, MR `!42` instead of PR `#42`).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.

1 participant