This implementation adds comprehensive enhancements to the CYWF Analytics Dashboard, including new visualizations, interactive features, and an automated data pipeline using GitHub Actions.
-
GitHub Actions Workflow (
.github/workflows/metrics.yml)- Runs every 30 minutes (at :17 and :47 past each hour)
- Fetches data from GitHub GraphQL API
- Generates static JSON files in
public/data/ - Commits and pushes updates automatically
-
Metrics Fetcher (
scripts/fetchMetrics.mjs)- Fetches owned and public contributed repositories
- Calculates activity tallies (commits, PRs, issues, reviews)
- Generates monthly time series data
- Approximates activity by hour distribution
- Fetches public gists with previews
- Fetches Quote of the Day from ZenQuotes/Quotable
- Optionally fetches Daily Brief content
- Donut Chart: Shows PRs vs Issues vs Commits ratio
- Stacked Bar Chart: Displays monthly activity trends (last 12 months)
- Enhanced Activity by Hour: Alternating bar shades for better readability
- Language Distribution: Color-coded by language using GitHub Linguist colors
-
Mermaid Diagram Playground
- Support for Flowchart, Mind Map, ER, and C4 diagrams
- Live editing with instant rendering
- Dark theme integration
-
Latest Gists Panel
- Scrollable list of public gists
- Modal preview with syntax highlighting
- Direct links to GitHub
-
Daily Brief
- Supports Markdown and HTML content
- Collapsible panel
- Sanitized rendering with DOMPurify
-
Quote of the Day
- Displays inspirational quotes
- Configurable source (ZenQuotes or Quotable)
-
TypeScript Utilities
lib/utils/dataClient.ts: Fetch with stale-while-revalidate cachinglib/utils/palette.ts: Color management with HSL utilities
-
Chart Components
components/charts/DonutChart.tsxcomponents/charts/StackedBarChart.tsxcomponents/charts/ActivityByHourChart.tsxcomponents/charts/LanguageDistribution.tsx
-
Data Files
public/data/linguist-colors.json: Language color mappingspublic/data/.gitkeep: Ensures directory is tracked
Set these in GitHub repository settings:
GH_LOGIN: Your GitHub username (e.g., "cywf")DAILY_BRIEF_URL: (Optional) URL to Markdown/HTML fileQOTD_SOURCE: (Optional) "zenquotes" (default) or "quotable"
METRICS_TOKEN: GitHub PAT with scopes:read:userread:gistpublic_repo
✅ Public Data Only: Only public repositories and contributions are displayed ✅ No Tokens in Browser: All API calls are server-side via GitHub Actions ✅ Static Files: Browser only fetches pre-generated JSON files ✅ Content Sanitization: HTML/Markdown is sanitized with DOMPurify ✅ CodeQL Clean: No security vulnerabilities detected
- ✅ Build succeeds with no errors
- ✅ TypeScript type checking passes
- ✅ ESLint warnings minimized (only acceptable
anytypes for dynamic data) - ✅ Code review feedback addressed:
- Magic numbers extracted to named constants
- Cache size limits implemented
- Modal focus management improved
- Clear documentation for approximations
- GitHub Actions workflow runs successfully
- Metrics JSON files are generated correctly
- Dashboard displays all new visualizations
- Donut and stacked bar charts render properly
- Language colors are applied correctly
- Mermaid playground renders all diagram types
- Gists panel shows previews and modal works
- Daily Brief content renders (if configured)
- Quote of the Day displays correctly
- Focus management works in modals (Tab, Shift+Tab, Esc)
- All links open correctly
- Mobile responsive design works
- Chrome/Edge (Chromium-based)
- Firefox
- Safari
- Mobile browsers
-
Activity by Hour: Approximated from contribution calendar since GraphQL doesn't provide commit timestamps. Real distribution would require REST API calls.
-
Monthly Time Series: Uses typical ratios (50% commits, 30% PRs, 20% issues) to split contribution counts since calendar doesn't distinguish between types.
-
CDN Dependencies: Mermaid, Marked, and DOMPurify are loaded from CDN at runtime. Consider bundling for production.
- Add SRI hashes for CDN scripts
- Implement actual commit timestamp fetching for accurate hourly distribution
- Add more diagram types to Mermaid playground
- Implement client-side search/filter for gists
- Add export functionality for charts (PNG/SVG)
- Implement dark/light theme toggle
- Add animation preferences for reduced motion
- Ensure all environment variables and secrets are configured
- Merge PR to main branch
- GitHub Actions will automatically:
- Run the metrics workflow
- Build the Next.js site
- Deploy to GitHub Pages
DASHBOARD_README.md: Updated with new features, configuration, and privacy notes- Inline code comments: Added for clarification of approximations and trade-offs
- This summary: Comprehensive implementation overview
- Files Created: 19 new files
- Files Modified: 3 existing files
- Lines Added: ~2,500
- Build Size: ~439 KB (main bundle)
- No Breaking Changes: Existing features preserved
Implementation Date: November 2025 Implemented By: GitHub Copilot Tested On: Node 20.x, Next.js 14.2.15