feat(app): add token activity heatmap to home sidebar#31157
Open
devinoldenburg wants to merge 1 commit into
Open
feat(app): add token activity heatmap to home sidebar#31157devinoldenburg wants to merge 1 commit into
devinoldenburg wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a “Token activity” heatmap to the Home page by aggregating session records into a 280-day window and rendering a contribution-style grid with summary/streak metrics.
Changes:
- Introduces
buildHomeActivityutilities (token totals, streaks, month labels) plus sample data generation in dev. - Updates Home page to fetch more sessions and render the new activity heatmap component.
- Adds EN/DE i18n strings and unit tests for activity aggregation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/app/src/pages/home/activity.ts | Implements activity aggregation, formatting, and dev sampling for the heatmap. |
| packages/app/src/pages/home/activity.test.ts | Adds tests for windowing, updated-time bucketing, and streak calculations. |
| packages/app/src/pages/home.tsx | Fetches more sessions and renders the activity heatmap on the Home screen. |
| packages/app/src/i18n/en.ts | Adds English strings for the activity section and summary. |
| packages/app/src/i18n/de.ts | Adds German strings for the activity section and summary. |
Comments suppressed due to low confidence (1)
packages/app/src/pages/home.tsx:1
- Home now loads up to 360 sessions per project directory, concurrently, on a single query. This is a significant increase from 64 and can amplify startup latency/memory/network usage for users with many projects. Consider reducing concurrency (queue/throttle), fetching only what the activity window needs (or a dedicated aggregated endpoint), and/or limiting the data processed for the heatmap to the same cap actually fetched.
import type { Session } from "@opencode-ai/sdk/v2/client"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- 40-week GitHub-style contribution grid showing daily token usage - Cells colored by 4 intensity levels using theme accent CSS variables - Keyboard-accessible cells with hover tooltips (compact K/M/B format) - Screen reader summary with totals, peak, and streak info - Session count fallback when token data is unavailable (explicit metric) - Dev-only synthetic sample data when no real sessions exist - 14 i18n keys translated into all 18 supported languages - 35 unit tests covering formatting, bucketing, streaks, metrics, edges
a987306 to
b5d758f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
Adds a compact token activity heatmap directly above the Projects section in the home sidebar. The heatmap visualizes daily token usage over 280 days (40 weeks) as a GitHub-style contribution grid with 7 rows. Each cell's color intensity reflects that day's token volume (4 levels), using theme accent colors so it works across light/dark/high-contrast themes.
Key behaviors:
1.4K,12.3M) and the date, also accessible via keyboard (Tab to cells)metricfield so tooltips/labels remain accurateFiles:
packages/app/src/pages/home/activity.ts– new helper: day bucketing, token aggregation, streak calculation, formattingpackages/app/src/pages/home/activity.test.ts– new testspackages/app/src/pages/home.tsx– wiresHomeActivityGraphintoHomeProjectColumnpackages/app/src/i18n/en.ts/de.ts– i18n stringsHow did you verify your code works?
bun test --preload ./happydom.ts ./src/pages/home/activity.test.ts— 3/3 passbun run typecheck— all 28 packages passbun run lint— 0 errorsbun run build— successfulhttp://localhost:4444with and without real sessionsScreenshots / recordings
Checklist