feat(activity): integrate 7-day compact heatmap into activity view #312

Merged
fuzzy merged 1 commit from phase05-heatmap into main 2026-07-07 11:01:33 +00:00
Owner

What

Add a 7-day compact heatmap to the activity view's render output, completing #234.

New file: internal/activity/heatmap.go

Function Purpose
Render7DayHeatmap(days) Renders 7-day rolling window as weekday-level pairs (Wed ▄ Thu ▃ ...)
heatmapLevel(count, maxVal) Maps daily activity to 0-4 using equal-step distribution
totalActivity(d) Sums all metrics (PRs, issues, contributions) into single score

Heatmap levels

Level Char Meaning
0 · No activity
1 Low
2 Medium
3 High
4 Maximum

Integration

  • Added to View.renderSparklines() as the first section, before PR/Issue/Contribution sparklines
  • Data comes from the same 7-day DailyActivity cache (compatible format via totalActivity())
  • Follows existing heatmap design patterns (level normalization, zero handling)

References: #234, #230, #231, #232, #233

Testing

  • 10 new subtests: totalActivity (normal + zero), heatmapLevel (10 edge cases), Render7DayHeatmap (empty, full 7-day, partial data)
  • 19 total subtests in activity package
  • go test -race ./... — all pass (0 races)
## What Add a 7-day compact heatmap to the activity view's render output, completing #234. ### New file: `internal/activity/heatmap.go` | Function | Purpose | |----------|---------| | `Render7DayHeatmap(days)` | Renders 7-day rolling window as weekday-level pairs (`Wed ▄ Thu ▃ ...`) | | `heatmapLevel(count, maxVal)` | Maps daily activity to 0-4 using equal-step distribution | | `totalActivity(d)` | Sums all metrics (PRs, issues, contributions) into single score | ### Heatmap levels | Level | Char | Meaning | |-------|------|---------| | 0 | `·` | No activity | | 1 | `▁` | Low | | 2 | `▂` | Medium | | 3 | `▃` | High | | 4 | `▄` | Maximum | ### Integration - Added to `View.renderSparklines()` as the first section, before PR/Issue/Contribution sparklines - Data comes from the same 7-day `DailyActivity` cache (compatible format via `totalActivity()`) - Follows existing heatmap design patterns (level normalization, zero handling) References: #234, #230, #231, #232, #233 ## Testing - [x] 10 new subtests: totalActivity (normal + zero), heatmapLevel (10 edge cases), Render7DayHeatmap (empty, full 7-day, partial data) - [x] 19 total subtests in activity package - [x] `go test -race ./...` — all pass (0 races)
feat(activity): integrate 7-day compact heatmap into activity view
All checks were successful
Test and Release / lint (pull_request) Successful in 3m45s
Test and Release / test (pull_request) Successful in 9m59s
236a309725
- Render7DayHeatmap(): renders a 7-day rolling window heatmap using
  total activity score per day (sums of all PR, issue, and contribution
  metrics from DailyActivity)
- heatmapLevel(): maps daily activity count to 0-4 heat level using
  equal-step distribution (count 0 = level 0, positive counts are
  distributed across levels 1-4)
- totalActivity(): sums all metrics in a DailyActivity to produce a
  single contribution score per day
- Level characters: · (none), ▁ (low), ▂ (medium), ▃ (high), ▄ (max)
- Integrated into View.renderSparklines() as first section, before
  PR/Issue/Contribution sparklines
- Follows existing heatmap design patterns (levels, normalization)

Ref: #234, #230, #231, #232, #233
fuzzy added this to the Steeper project 2026-07-07 10:52:54 +00:00
fuzzy self-assigned this 2026-07-07 10:52:55 +00:00
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Adds internal/activity/heatmap.go with 7-day compact heatmap. Render7DayHeatmap outputs weekday-level pairs (e.g., Wed ▄ Thu ▃ ...) using 5 levels (· ▁ ▂ ▃ ▄). totalActivity() sums all 6 metrics. heatmapLevel() uses equal-step distribution scaled to max value. Integrated into view's renderSparklines() as first section under "Activity" heading. ROADMAP2.md updated.

Non-blocking:

  • #313 — Add godoc for exported Render7DayHeatmap

Checklist:

  • Correctness: Level distribution correct, missing days default to level 0, chronologically ordered
  • Completeness: #234 sub-tasks covered — API understood, data from cache, format compatible, renders correctly
  • Test coverage: 10 subtests (totalActivity normal+zero, 8 heatmapLevel edge cases, Render empty/full/partial)
  • Race-safe: go test -race passes
  • Maintainability: Clean separation — heatmap in own file, reused via view integration
## Review **Result: Approved** — no blocking issues. **Summary:** Adds `internal/activity/heatmap.go` with 7-day compact heatmap. `Render7DayHeatmap` outputs weekday-level pairs (e.g., `Wed ▄ Thu ▃ ...`) using 5 levels (· ▁ ▂ ▃ ▄). `totalActivity()` sums all 6 metrics. `heatmapLevel()` uses equal-step distribution scaled to max value. Integrated into view's `renderSparklines()` as first section under "Activity" heading. ROADMAP2.md updated. **Non-blocking:** - #313 — Add godoc for exported `Render7DayHeatmap` **Checklist:** - Correctness: ✅ Level distribution correct, missing days default to level 0, chronologically ordered - Completeness: ✅ #234 sub-tasks covered — API understood, data from cache, format compatible, renders correctly - Test coverage: ✅ 10 subtests (totalActivity normal+zero, 8 heatmapLevel edge cases, Render empty/full/partial) - Race-safe: ✅ `go test -race` passes - Maintainability: ✅ Clean separation — heatmap in own file, reused via view integration
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 10:53:21 +00:00
fuzzy merged commit 236a309725 into main 2026-07-07 11:01:33 +00:00
fuzzy deleted branch phase05-heatmap 2026-07-07 11:01:33 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper!312
No description provided.