Skip to content

feat: Add PR status donut chart (open/merged/closed) to PRMetrics widget#349

Merged
Priyanshu-byte-coder merged 6 commits into
Priyanshu-byte-coder:mainfrom
26Naitik:feat/issue-222-pr-status-donut-chart
May 20, 2026
Merged

feat: Add PR status donut chart (open/merged/closed) to PRMetrics widget#349
Priyanshu-byte-coder merged 6 commits into
Priyanshu-byte-coder:mainfrom
26Naitik:feat/issue-222-pr-status-donut-chart

Conversation

@26Naitik
Copy link
Copy Markdown
Contributor

Summary

Adds a donut/pie chart to the PRMetrics widget visualizing the distribution of Open, Merged, and Closed PRs at a glance.

Changes

  • New component: PRStatusDonutChart.tsx using Recharts PieChart with innerRadius (donut style)
  • Integrated into PRMetrics.tsx below the existing stats grid
  • Updated /api/metrics/prs route to return separate open, merged, and closed counts using GitHub's is:open, is:merged, and is:unmerged+is:closed search qualifiers
  • Colors: var(--accent) for Open, #10b981 (emerald-500) for Merged, var(--muted-foreground) for Closed
  • Center label shows total PR count
  • Hover tooltip shows count and percentage
  • Custom legend with colored dot indicators
  • No hardcoded colors beyond emerald-500 fallback

Closes #222

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@26Naitik 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.

@26Naitik 26Naitik force-pushed the feat/issue-222-pr-status-donut-chart branch from f291876 to 9c17973 Compare May 19, 2026 05:42
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Good idea adding the closed PR count and donut chart. Two issues:

1. Hardcoded color in PRStatusDonutChart.tsx:

const COLORS = [
  "var(--accent)",           // Open — good
  "#10b981",                 // Merged — hardcoded! Use: color-mix(in srgb, #10b981 100%, transparent) or a CSS var
  "var(--muted-foreground)", // Closed — good
];

Use "#10b981" as-is is acceptable for semantic success color, but ideally use a CSS var. At minimum keep it consistent in LEGEND_LABELS.

2. Conflictprs/route.ts was modified by a recently merged PR. Please rebase:

git fetch upstream && git rebase upstream/main

Fix conflict and push — will merge after rebase.

@26Naitik 26Naitik force-pushed the feat/issue-222-pr-status-donut-chart branch from 940a6ee to dc92981 Compare May 19, 2026 07:19
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

PR has merge conflicts with main. Rebase and push — no code changes needed, just conflict resolution:

git fetch upstream
git rebase upstream/main
# resolve any conflicts
git push --force-with-lease

Code looks good — the donut chart, closed field in the API, E2E fixes, and adding @playwright/test as a dev dependency are all correct. Ready to merge once rebased.

@26Naitik 26Naitik force-pushed the feat/issue-222-pr-status-donut-chart branch from cc4b191 to bab2aea Compare May 20, 2026 04:53
@26Naitik
Copy link
Copy Markdown
Contributor Author

"Hi @Priyanshu-byte-coder, I've resolved the merge conflicts and force-pushed the branch. All CI checks should be passing now. Could you please review and merge when ready? Thanks!"

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.

Clean addition. CSS vars used correctly (var(--success) defined in globals.css for both themes), combined-account merge updated, E2E mock updated to match. The center-label trick via a transparent second <Pie> is a known Recharts pattern — acceptable. One minor: add a trailing newline to PRStatusDonutChart.tsx. Merging.

@Priyanshu-byte-coder Priyanshu-byte-coder added level:intermediate GSSoC: Intermediate difficulty (35 pts) type:feature GSSoC type bonus: new feature gssoc:approved GSSoC: PR approved for scoring labels May 20, 2026
@Priyanshu-byte-coder Priyanshu-byte-coder merged commit cc98694 into Priyanshu-byte-coder:main May 20, 2026
7 checks passed
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 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 PR status donut chart (open/merged/closed) to PRMetrics widget

2 participants