Skip to content

feat(metrics): add GitHub Discussions metrics route and DiscussionsMe… - #3253

Open
Nareshkumawat-star wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Nareshkumawat-star:feature/discussions-metrics
Open

feat(metrics): add GitHub Discussions metrics route and DiscussionsMe…#3253
Nareshkumawat-star wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Nareshkumawat-star:feature/discussions-metrics

Conversation

@Nareshkumawat-star

Copy link
Copy Markdown

Summary

Adds a new GitHub Discussions metrics integration to DevTrack. This includes an enhanced GraphQL-backed API route (/api/metrics/discussions) and a new interactive DiscussionsMetrics component featuring key stat cards, a category breakdown bar chart via Recharts, and a time-range selector (7d / 30d / 90d).


#closes : #3252

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • src/app/api/metrics/discussions/route.ts: Updated the API route to fetch user discussion contributions, comments, accepted answers, and discussion nodes via GitHub GraphQL API (/graphql). Calculates answeredRate %, top 3 discussion categories, and accepts time-range parameters (days=7/30/90).
  • src/components/DiscussionsMetrics.tsx: Created a client component with stat cards (Discussions Started, Comments Left, Answered Rate %), a horizontal Recharts Bar Chart (Discussions by Category), interactive time-range selector buttons, multi-account support (useAccount), loading skeletons, error states, and empty states.
  • src/components/DiscussionsWidget.tsx: Updated to render DiscussionsMetrics directly within the customizable dashboard.

How to Test

  1. Navigate to the DevTrack dashboard.
  2. Locate the Discussion Activity widget.
  3. Click through the time range selector buttons (7d, 30d, 90d) to ensure metrics and category distribution re-fetch correctly.
  4. Verify that stat cards (Discussions Started, Comments Left, Answered Rate %) and the category bar chart render accurately.

Expected result: The discussion widget dynamically updates with stat metrics, category bar chart, and time range selection.


Checklist

  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • Tested responsive layout and mobile display
  • Preserved backward compatibility for legacy field names (commentsGiven, markedAsAnswer)

Accessibility (UI changes only)

  • Keyboard navigation works correctly
  • Color contrast meets WCAG AA standard
  • ARIA labels / roles added where needed
  • Tested on mobile / responsive layout

Additional Context

  • Direct PR creation link for this branch: https://github.com/Nareshkumawat-star/devtrack/pull/new/feature/discussions-metrics

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) gssoc26 GSSoC 2026 contribution labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added the type:devops GSSoC type bonus: devops (+15 pts) label Jul 28, 2026
@github-actions github-actions Bot added the type:testing GSSoC type bonus: tests (+10 pts) label Jul 28, 2026
@Nareshkumawat-star

Copy link
Copy Markdown
Author

Hi @Priyanshu-byte-coder kindly review and merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:devops GSSoC type bonus: devops (+15 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add GitHub Discussions metrics widget — total discussions, answered rate, top categories

1 participant