Overview
Located insrc/components/GithubActivity.tsx, this component provides:
- Activity graph showing contributions over time
- Streak statistics tracking consecutive contribution days
- Snake animation visualizing contribution grid
- Automatic updates from GitHub’s public API
- Error handling with graceful fallbacks
All GitHub data is pulled live from public GitHub APIs and third-party services. No backend configuration is required.
Component Structure
Visualizations
1. Activity Graph
The main contribution graph displays commit activity over time:- Shows contribution frequency
- Color-coded by activity level
- Displays recent months
- Automatically updates daily
Activity Graph
The graph uses GitHub’s contribution data to show coding patterns, highlighting periods of high activity and consistent contributions.
2. Streak Statistics
Tracks consecutive days of contributions:- Current streak (consecutive days)
- Longest streak achieved
- Total contributions
- Last contribution date
3. Snake Animation
Animated snake that “eats” contributions from the grid:The snake animation requires a GitHub Action to generate the SVG. See Setup Guide for configuration instructions.
Section Header
Error Handling
The component gracefully handles missing or failed images:- Error event is triggered
- State is updated to hide that visualization
- Other visualizations remain visible
- No error message is shown to users
Theme Configuration
The component uses the “merko” theme for consistent styling:default- GitHub’s default colorsdark- Dark mode friendlyradical- Vibrant purple/pinkmerko- Green/yellow (currently used)gruvbox- Retro color schemetokyonight- Blue/purple themeonedark- Atom One Darkcobalt- Blue themesynthwave- Neon/retrohighcontrast- High contrast
theme constant:
Scroll Animations
Each visualization appears with a staggered delay:Responsive Design
Mobile
- Full-width visualizations
- Stacked layout
- Maintained aspect ratios
- Touch-friendly sizing
Desktop
- Centered max-width container
- Generous padding
- Hover effects on cards
- Optimal viewing size
Integration
Add the GitHub Activity section to your portfolio:Customization
Change Username
Adjust Container Styles
Modify Card Appearance
External Services Used
Activity Graph Service
Provider: github-readme-activity-graph.vercel.appEndpoint:
https://github-readme-activity-graph.vercel.app/graphParameters:
username- GitHub usernametheme- Color theme name
Streak Stats Service
Provider: randolph-santos.vercel.app (GitHub Readme Streak Stats)Endpoint:
https://randolph-santos.vercel.appParameters:
user- GitHub usernametheme- Color theme name
Snake Animation
Provider: GitHub Actions (self-hosted)Location:
https://raw.githubusercontent.com/{username}/{username}/output/github-contribution-grid.svg
Setting Up Snake Animation
The snake animation requires a GitHub Action in your profile repository. See the GitHub Snake Setup Guide for step-by-step instructions.
Privacy Considerations
All data displayed is already public on your GitHub profile. No private repository information or sensitive data is exposed.
- Public repository contributions
- Public commit activity
- Contribution streaks
- Total contribution counts
- Private repository activity
- Organization private repos
- Commit messages or code
- Repository names or details
Performance
The component loads images from external services: Optimization tips:- Images are cached by browser
- Loading is non-blocking
- Failed images don’t break layout
- Lazy loading via ScrollReveal
- Activity graph: ~1-2 seconds
- Streak stats: ~1 second
- Snake animation: ~500ms (if pre-generated)
Troubleshooting
Visualizations Not Appearing
- Check username: Ensure
usernamevariable is correct - Verify profile is public: Private profiles won’t work
- Check browser console: Look for 404 or CORS errors
- Test image URLs directly: Open image URLs in browser
Snake Animation Missing
- Setup GitHub Action: Required for snake generation
- Check repository name: Should match username exactly
- Verify action ran: Check Actions tab in GitHub
- Wait for generation: Initial setup takes a few minutes
Theme Not Applying
- Check theme name: Ensure it’s spelled correctly
- Try different theme: Some services support different themes
- Clear cache: Hard refresh to see changes
Images Look Broken on Mobile
- Check responsive classes: Ensure
w-fullis applied - Test on real device: Not just browser dev tools
- Verify image aspect ratio: Some themes have fixed dimensions
Alternative Services
If the default services are slow or unavailable, consider alternatives: Activity Graphs:github-readme-stats.vercel.appgithub-profile-summary-cards.vercel.app
github-readme-streak-stats.herokuapp.com- Custom implementation with GitHub API
github-readme-activity-graph(different output)- Custom D3.js visualization
Advanced: Custom GitHub Integration
For more control, you can use the GitHub GraphQL API:- Custom visualizations
- Real-time updates
- Additional data points
- Complete styling control
