Skip to content

[FEATURE] Dynamic Top Contributors Podium from Live API Data#75

Merged
1 commit merged into
masterfrom
feat/contributors-podium-73
May 18, 2026
Merged

[FEATURE] Dynamic Top Contributors Podium from Live API Data#75
1 commit merged into
masterfrom
feat/contributors-podium-73

Conversation

@Aditya948351

Copy link
Copy Markdown
Collaborator

Resolves #73. Fetches live contributors and renders Gold, Silver, and Bronze podium dynamically with actual GitHub avatars.

Copilot AI review requested due to automatic review settings May 18, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Replaces the hardcoded top-3 podium on the /contributors page with a client-side fetch from the GitHub contributors API, mapping the top 3 by contributions to Gold/Silver/Bronze cards using real avatar URLs. Adds a loading state and a hardcoded fallback list for API failures.

Changes:

  • Adds useState/useEffect client fetch of api.github.com/repos/devpathindcommunity-india/DevPath-Web/contributors, sorted and sliced to top 3.
  • Introduces Contributor / TopContributor TypeScript interfaces and a FALLBACK_TOP list used on fetch error.
  • Renders a loading spinner, an arrangePodium helper to reorder as [2nd, 1st, 3rd], and uses <img> for avatar_url with initials as a null fallback.
Comments suppressed due to low confidence (1)

src/app/contributors/page.tsx:62

  • When the GitHub API responds successfully but with fewer than 3 contributors (e.g., a 200 with an empty array, or only 1–2 entries), topContributors will be set to that short list and the fallback is never used. arrangePodium returns the list unchanged in that case, so the podium will render incomplete (or empty) with no indication to the user. Consider falling back to FALLBACK_TOP (or padding) whenever mappedTop.length < 3, not only in the catch branch.
                const mappedTop = sorted.slice(0, 3).map((c: any, index: number) => ({
                    name: c.login,
                    handle: `@${c.login}`,
                    contributions: c.contributions,
                    rank: index + 1,
                    avatar: c.avatar_url,
                }));

                setTopContributors(mappedTop);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/contributors/page.tsx
Comment thread src/app/contributors/page.tsx
Comment thread src/app/contributors/page.tsx
Comment thread src/app/contributors/page.tsx
Comment thread src/app/contributors/page.tsx
Comment thread src/app/contributors/page.tsx
@devpathindcommunity-india devpathindcommunity-india closed this pull request by merging all changes into master in 1ff9c6f May 18, 2026
@devpathindcommunity-india devpathindcommunity-india deleted the feat/contributors-podium-73 branch May 18, 2026 08:59
@Aditya948351 Aditya948351 added level:advanced Advanced issues and removed level:intermediate Intermediate level issues labels May 19, 2026
@Aditya948351 Aditya948351 removed gssoc26 This is a official GirlScript Summer of Code label. gssoc:approved give 50+ base points level:advanced Advanced issues quality:clean type:assessibility type:design labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Dynamic Top Contributors Podium from Live API Data

3 participants