feat(heatmap): add shared 365-day contribution calendar#2839
Open
Honey-pg wants to merge 1 commit into
Open
Conversation
…te-coder#18) Extract ContributionHeatmapCalendar for dashboard and public profiles, paginate public contribution fetch for a full year, and align cell colors to absolute commit thresholds.
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
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.
Extract ContributionHeatmapCalendar for dashboard and public profiles, paginate public contribution fetch for a full year, and align cell colors to absolute commit thresholds.
Summary
Adds a shared GitHub-style 365-day contribution heatmap calendar used on both the authenticated dashboard and public profiles. The dashboard widget is refactored to use the shared component, public profiles now show the full-year grid (with paginated data fetch), and cell colors use absolute commit thresholds with theme support.
Closes #2809
Type of Change
What Changed
src/lib/contribution-heatmap.ts— Shared helpers:buildHeatmap,buildMonthMarkers, date/tooltip formatters, and legend constants.src/components/ContributionHeatmapCalendar.tsx— Reusable 7×53 grid with month labels, hover/focus tooltips, horizontal scroll, legend, andgetHeatmapCellStyle()absolute color levels.src/components/ContributionHeatmap.tsx— Refactored into a thin wrapper (fetch, range controls, theme toggle, drill-down) that renders the shared calendar.src/lib/public-profile-data.ts—fetchPublicContributionsnow defaults to 365 days and paginates GitHub Search (up to 1000 commits).src/components/public/PublicContributionHeatmap.tsx— New public profile heatmap usinguseHeatmapTheme()and server-provided data.src/app/u/[username]/page.tsx— Replaced inlinePublicContributionGraphwithPublicContributionHeatmap.test/contribution-heatmap-calendar.test.ts— Unit tests for heatmap grid helpers.test/public-profile-data.test.ts— Tests for 365-day default and pagination.README.md— Moved contribution heatmap calendar ([FEAT] Add contribution heatmap calendar view #18) from Planned to Completed.How to Test
feat/contribution-heatmap-calendarand runnpm installif needed.npm run dev, sign in, and open the dashboard Contribution Heatmap widget./u/{username}and confirm the full-year heatmap renders with horizontal scroll on a narrow viewport.Expected result: Dashboard and public profile both show the same GitHub-style calendar grid with theme-aware absolute color levels and accurate year-long data.
Automated checks:
npm run lint npm test -- test/contribution-heatmap-calendar.test.ts test/useHeatmapTheme.test.ts test/public-profile-data.test.ts