Skip to content

feat(discussions): add GitHub Discussions activity widget#600

Open
mallya-m wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:feat/discussions-widget-258
Open

feat(discussions): add GitHub Discussions activity widget#600
mallya-m wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:feat/discussions-widget-258

Conversation

@mallya-m
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a Discussion Activity widget to the dashboard showing how active the user is in GitHub Discussions — discussions started, comments given, and marked-as-answer count.

Related issue

Closes #258

Changes made

  • New GET /api/metrics/discussions route using GitHub REST search + GraphQL
  • REST: discussions started via /search/issues?q=author:{user}+type:discussion
  • GraphQL: comments given and marked-as-answer count
  • 5-minute Cache-Control header to avoid rate limit issues
  • New DiscussionsWidget.tsx component with 3 stat chips
  • Added widget to dashboard below Issue Metrics

How to test

  1. Sign in and go to dashboard
  2. Scroll to Discussion Activity widget
  3. Three stat chips show: Discussions Started, Comments Given, Marked as Answer

Screenshots

image

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@mallya-m is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 21, 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

@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder could you please add the gssoc:approved , intermediate , quality and type:feature labels?
Thank you!

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix before merging:

  1. Missing EOF newlines — all changed files must end with \n
  2. Hardcoded Tailwind red colors in DiscussionsWidget — replace with CSS vars:
    • text-red-*text-[var(--destructive)]
    • bg-red-*bg-[var(--destructive)]

Colors must go through CSS variables to support dark/light theming.

@Priyanshu-byte-coder Priyanshu-byte-coder added the level:intermediate GSSoC: Intermediate difficulty (35 pts) label May 22, 2026
@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder both issues fixed:

  1. Replaced all hardcoded red Tailwind classes with CSS vars — text-[var(--destructive)], bg-[var(--destructive)]/10, border-[var(--destructive)]/20
  2. EOF newline added to DiscussionsWidget.tsx

Ready for merge!

@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder the only remaining CI failure is landing.spec.js — this is a pre-existing issue unrelated to this PR.

The test checks for a single heading named "DevTrack" but the landing page now has two:

  • <h1>DevTrack</h1>
  • <h2>DevTrack keeps your coding story in one place.</h2>

This was introduced by a recent merge to main. My changes only touch dashboard components and don't affect the landing page at all. The same test fails on a fresh checkout of main.

All 5 other tests pass. Ready for merge!

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Two issues to fix before merge:

1. GraphQL injection risk — use variables
The GraphQL queries interpolate login directly into the query string:

`{ search(query: "commenter: type:discussion", ...) { ... } }`

If githubLogin ever contains special characters (e.g., via session tampering), this could malform the query. Use GraphQL variables instead:

body: JSON.stringify({
  query: `query(: String!) { search(query: "commenter:$login type:discussion", type: DISCUSSION, first: 100) { discussionCount } }`,
  variables: { login },
})

2. Missing EOF newline in discussions/route.ts
File ends without trailing newline. Please add one.

@Priyanshu-byte-coder Priyanshu-byte-coder added the gssoc:approved GSSoC: PR approved for scoring label May 23, 2026
@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder the lint/build failures are caused by pre-existing errors in files I didn't touch:

  • src/components/Footer.tsx line 102 — target="_blank" without rel="noreferrer" (not my file)
  • src/components/BadgeSection.tsx lines 52-75 — <img> instead of <Image /> (not my file)

My PR only touches:

  • src/app/api/metrics/discussions/route.ts
  • src/app/dashboard/page.tsx
  • src/components/DiscussionsWidget.tsx

These errors exist on main independently of my changes.
Happy to fix them in a separate PR if that would help, but they shouldn't block this merge.

@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder rebased onto latest main — the lint errors in Footer.tsx and BadgeSection.tsx are now fixed via the upstream merge. Ready for merge!

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

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add GitHub Discussions activity widget

2 participants