Skip to content

feat(languages): upgrade Language Breakdown widget to Recharts donut chart (#938)#2231

Open
mallya-m wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
mallya-m:feat/languages-donut-chart-938
Open

feat(languages): upgrade Language Breakdown widget to Recharts donut chart (#938)#2231
mallya-m wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
mallya-m:feat/languages-donut-chart-938

Conversation

@mallya-m

@mallya-m mallya-m commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #938 — upgrades the Language Breakdown widget from a stacked bar to a Recharts donut chart with interactive tooltips and a clean legend.


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • src/components/LanguageBreakdown.tsx — single file change
    • Replaced the stacked bar chart with a Recharts PieChart (donut style) using innerRadius/outerRadius for the ring shape
    • Added a centred label inside the donut showing the number of languages
    • Added a LanguageTooltip component that shows language name and percentage on hover
    • Expanded the GitHub language color map with 10 additional languages (Swift, Kotlin, C++, C, C#, PHP, Dart, Scala, Vue, Other)
    • Kept the Other bucket logic for languages beyond the top 6 (percentage remainder grouped automatically)
    • Improved empty state: bordered dashed container instead of plain text
    • Improved loading skeleton: circular placeholder matching donut shape
    • Responsive layout: donut + legend stack vertically on mobile, sit side-by-side on sm+
    • No new dependencies — recharts was already installed in the project

How to Test

  1. Log in and navigate to the dashboard
  2. Scroll to the Goals & Insights section → Language Breakdown widget
  3. Confirm a donut chart renders with coloured slices per language
  4. Hover over a slice — tooltip shows language name and percentage
  5. Confirm legend below lists all languages with matching colour dots and percentages
  6. Confirm "Other" slice appears if top-6 languages don't sum to 100%
  7. Confirm graceful empty state for accounts with no public repos

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors in changed file (npx tsc --noEmit 2>&1 | Select-String "LanguageBreakdown" → blank)
  • npm run build → ✓ Compiled successfully
  • Self-reviewed the diff
  • Added/updated tests if applicable

Accessibility Checklist

  • Donut chart container has role="img" and aria-label
  • Each legend dot SVG has role="img" and aria-label with language name
  • Loading skeleton has role="status", aria-live="polite", aria-busy="true", and sr-only text
  • Responsive UI verified

Additional Notes

The LanguageBreakdown component, API route (/api/metrics/languages), widget ID (language-breakdown), and dashboard registration were all already in place. This PR upgrades only the visual layer — the data pipeline is unchanged.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@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 Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

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

mallya-m commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Hey @Priyanshu-byte-coder — PR is up!

What I built:

  • Upgraded LanguageBreakdown.tsx from stacked bar → Recharts donut chart (single file change)
  • Interactive tooltip on hover showing language name + percentage
  • Centre label showing language count
  • Expanded GitHub language color map (20 languages + Other fallback)
  • Other bucket auto-calculated from percentage remainder
  • Responsive: stacks on mobile, side-by-side on desktop
  • Accessible: role="img" + aria-label on chart and legend dots

No new dependencies — recharts was already in the project. API route and dashboard registration were already in place.

Could you add level:intermediate and quality:clean labels to the PR when reviewing? Thanks!

Closes #938

@mallya-m

mallya-m commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review @Priyanshu-byte-coder! Single file change, no new dependencies, all CI checks passing.

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

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add most-used languages pie/donut chart to dashboard

1 participant