feat(view): add view=commit_clock — 24-hour polar ring from real comm…#6037
feat(view): add view=commit_clock — 24-hour polar ring from real comm…#6037vivek0369 wants to merge 4 commits into
Conversation
|
@vivek0369 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod-Dev
left a comment
There was a problem hiding this comment.
The \commit_clock\ view is a great addition — replacing the simulated 'Night Owl' metric with actual commit timestamps from \etchCommitHourDistribution\ in \lib/github.ts. The polar ring rendering in \lib/svg/commitClock.ts\ with opacity-scaled segments and peak-hour annotations looks premium. Integration with the route is clean. Nice work!
Aamod-Dev
left a comment
There was a problem hiding this comment.
Review
This PR cannot be approved in its current state due to blocking issues (status:blocked label, merge conflicts, needs-rebase label, and/or failing CI checks). Please resolve the blocking issues and re-request review.
Once unblocked, I'm happy to re-review! 💚
|
🚨 Hey @vivek0369, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
Aamod-Dev
left a comment
There was a problem hiding this comment.
The Commit Clock SVG visualization is an excellent addition to the project's analytical capabilities. Adding fetchCommitHourDistribution in lib/github.ts to power the new commit_clock view parameter in app/api/streak/route.ts using real GraphQL data is beautifully implemented. Approved!
PR Title
feat(view): add
view=commit_clock— 24-hour polar ring from real commit timestamps📖 Description
This PR introduces a brand-new visualization:
view=commit_clock, a 24-hour polar contribution clock powered entirely by real GitHub commit timestamps.The current radar visualization contains a simulated Night Owl metric generated from deterministic random values:
While visually appealing, this metric does not represent actual user activity.
To provide meaningful insights based on real contribution behavior, this PR adds a dedicated SVG view that analyzes commit timestamps retrieved from the GitHub GraphQL API and visualizes commit frequency across all 24 hours of the day.
Example Usage
🎯 Pillar
🎨 Pillar 1 — New Theme Design
📐 Pillar 2 — Geometric SVG Improvement
🕐 Pillar 3 — Timezone Logic Optimization
🛠️ Other
🚀 What Was Changed
✨ New File —
lib/svg/commitClock.tsAdded:
Features:
24-segment radial contribution clock
Real commit activity visualization
Dynamic segment length based on contribution frequency
Opacity scaling for stronger visual contrast
Cardinal hour labels (12a, 6a, 12p, 6p)
Statistics panel:
Total sampled commits
Peak commit hour
Current streak
Longest streak
Theme-aware rendering
Full support for:
bgaccenttextsizeradiusborderhideBackgroundAccessibility support:
<title><desc>aria-labelledbyaria-describedby🔄 Modified —
lib/github.tsAdded:
Functionality:
Retrieves commit timestamps via GraphQL
Uses existing retry and token-rotation infrastructure
Aggregates commits into 24 hourly buckets
Queries top repositories by contribution volume
Supports capped concurrency
Gracefully skips unavailable repositories
✅ Modified —
lib/validations.tsAdded:
to the allowed view enum.
✅ Modified —
types/index.tsAdded:
to
BadgeParams.Updated related JSDoc documentation.
✅ Modified —
app/api/streak/route.tsIntegrated the new SVG generator and data pipeline.
Workflow:
Determine top repositories.
Fetch commit timestamps.
Build hourly distribution.
Generate SVG.
Return rendered badge.
🎨 Design Decisions
Decision | Reason -- | -- Top 5 repositories | Provides representative commit history while minimizing API cost 100 commits per repository | Good balance between performance and accuracy UTC timestamps | Consistent with GitHub GraphQL data source Silent repository failures | Prevents badge failures caused by private or archived repositories Radial length + opacity encoding | Improves readability at smaller sizes Separate view instead of radar modification | Preserves radar chart semantics while introducing a more powerful visualization🧪 Testing
Local Development
Default View
Theme Testing
Custom Colors
Size Variants
Validation Test
Expected Result:
Invalid view falls back to default rendering.
No runtime errors occur.
📸 Visual Preview
🔍 Benefits
Replaces simulated activity metrics with real GitHub data
Provides meaningful insight into coding habits
Adds a unique SVG visualization not currently available in CommitPulse
Maintains compatibility with existing themes and customization options
Improves transparency and analytical value
✅ Checklist
Read CONTRIBUTING.md
Tested locally
Ran
npm run formatRan
npm run lintRan
npm run testRan
npm run test:coverageConventional Commit format used
Updated documentation where required
Added accessibility attributes
No new TypeScript errors
Maintains CommitPulse design standards
🔗 Related Issue
Closes #5993
Suggested Labels