Skip to content

Add year-view heatmap to History window - #6

Open
mvanhorn wants to merge 1 commit into
rauchg:mainfrom
mvanhorn:feat/year-heatmap
Open

Add year-view heatmap to History window#6
mvanhorn wants to merge 1 commit into
rauchg:mainfrom
mvanhorn:feat/year-heatmap

Conversation

@mvanhorn

Copy link
Copy Markdown

Adds a GitHub-style year-view heatmap to the History window. Selecting
Year in the period picker replaces the bar chart with a 52×7 grid of
cells, color intensity scaled to the in-view 90th-percentile day.

heatmap demo

  • New HeatmapSection view in HistoryView.swift, mirrors ChartSection's
    EquatableView pattern to avoid re-renders on list scroll
  • 5-level accent-color ramp with empty days visibly distinct from low-count
    days; responsive cell sizing via GeometryReader so the window stays at
    the existing 540×550
  • Hovering a cell shows the same date / total-keystrokes tooltip as the
    existing chart
  • pruneAllDevices(keepingDays:) bumped from 60 to 365 in both call
    sites (applicationWillTerminate and loadAndReconcileCounts) so the
    year view actually has data to render
  • No schema change. No new dependencies in Package.swift

The demo uses a synthesized 365-day dataset with a seasonal pattern + a
couple of zero-stretch "vacation" weeks so the heatmap looks lived-in. Dev
builds run ad-hoc-signed without iCloud entitlements; the new view code
exercises the same SyncData.totalCount(for:) aggregation the production
app already uses.

AI was used for assistance.

Adds a "Year" option to the period picker that replaces the bar chart with a
52x7 grid of cells, color intensity scaled to the in-view 90th-percentile
day. Hovering a cell reveals the same date / total-keystrokes tooltip
pattern as the existing chart.

- Sources/HistoryView.swift: new HeatmapSection view, mirrors ChartSection's
  EquatableView pattern to avoid re-renders. 5-level accent-color ramp with
  empty-day distinct from low-count. Responsive cell sizing via GeometryReader
- Sources/AppDelegate.swift: pruneAllDevices(keepingDays:) bumped from 60 to
  365 in both call sites so the year view actually has data to render

No schema change. Uses existing SyncData.totalCount(for:) API. No new
dependencies in Package.swift.
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