feat(profile): show the user's real GitHub contribution graph (#61)#68
Open
bae080311 wants to merge 10 commits into
Open
feat(profile): show the user's real GitHub contribution graph (#61)#68bae080311 wants to merge 10 commits into
bae080311 wants to merge 10 commits into
Conversation
Reshapes a user's real per-day contribution counts into a rendering-ready grid (Sun..Sat weeks, month labels, per-user quartile intensity levels, current streak). Framework-agnostic and fetch-free so it's trivially unit-tested on its own, ahead of wiring it into any UI.
…he profile fetch The scout already requests contributionCalendar in the profile query, but only reduced it to a single recentActiveDays count. Add `date` to the existing field selection (no new API call) and flatten the calendar into RawPayload.contributionDays; recentActiveDays now derives from that same array instead of walking the tree twice.
Card gains an optional contributionDays field, attached alongside buildCard's output in buildFresh rather than folded into Signals/buildCard itself — it's display data for the profile page, not a scoring input. Bumps the Redis cache version since this changes Card's cached shape.
Adds ContributionPanel — a real per-user grid rendered full-width below the scouting report, styled like the other report panels. Reuses the decorative Background motif's exact cell geometry and green (now exported as GRID_* constants) so the page never shows two different-looking grids, and suppresses that decorative strip only once a card actually has calendar data to replace it with.
The public /api/card/:username response has no reason to carry ~365 extra
{date,count} rows per request — that data only feeds the profile page's own
ContributionPanel render, which already has it via the server-rendered Card.
Adding a fourth section (the contribution graph) pushed the result page past typical laptop heights. Scale several previously width-only or fixed values (card size, grade stamp, name, vertical margins) with viewport height too, so the whole report — card, attributes, metrics, distribution, contributions — fits without scrolling on common desktop sizes (~1512x980+) and comes close on smaller ones (~1440x900), without touching the mobile-stacked layout (still governed by the max-[980px] breakpoint). Raised the card's width floor from 220 to 260 — CardActions' Download button needs that much room before its label starts truncating, which the more aggressive height-based shrinking would otherwise have hit.
… viewport" This reverts commit fe68e20.
…, not a new section The standalone ContributionPanel section added real page height on top of an already content-heavy result page, reintroducing the scroll it was meant to avoid. Since the decorative grid motif in Background.tsx is purely an absolutely-positioned layer (zero document-flow height), swapping in the user's real per-day calendar there instead costs nothing extra — same spot, same cell size/rounding/green, just real data instead of a seeded pattern. Falls back to the fake pattern whenever there's no real calendar to show (demo/sample cards, cards cached before contributionDays existed, or no card at all), so every page still gets *a* motif, just not a fabricated one when real data is available. ContributionPanel.tsx is removed; lib/contributions.ts (the pure transform) stays — Background now builds the real grid's SVG string from its output directly, the same way it already did for the fake one.
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.
What
Closes #61.
Adds the user’s actual GitHub contribution graph to the profile page.
This addresses the maintainer’s feedback:
The contribution days are flattened from the existing GraphQL response and passed through scout.ts onto Card. recentActiveDays is now derived from the same flattened data.
Screenshots
Notes
Tests
An AI assistant helped with the implementation. I reviewed the changes and ran the tests, lint, and build locally.