[FEATURE] Dynamic Top Contributors Podium from Live API Data#75
Merged
1 commit merged intoMay 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/useEffectclient fetch ofapi.github.com/repos/devpathindcommunity-india/DevPath-Web/contributors, sorted and sliced to top 3. - Introduces
Contributor/TopContributorTypeScript interfaces and aFALLBACK_TOPlist used on fetch error. - Renders a loading spinner, an
arrangePodiumhelper to reorder as[2nd, 1st, 3rd], and uses<img>foravatar_urlwith 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),
topContributorswill be set to that short list and the fallback is never used.arrangePodiumreturns the list unchanged in that case, so the podium will render incomplete (or empty) with no indication to the user. Consider falling back toFALLBACK_TOP(or padding) whenevermappedTop.length < 3, not only in thecatchbranch.
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.
devpathindcommunity-india
approved these changes
May 18, 2026
1ff9c6f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #73. Fetches live contributors and renders Gold, Silver, and Bronze podium dynamically with actual GitHub avatars.