Skip to content

Switch leaderboard to real API data and show contributor points#36

Open
jinhojang6 wants to merge 21 commits intodevelopfrom
seasonal-leaderboard
Open

Switch leaderboard to real API data and show contributor points#36
jinhojang6 wants to merge 21 commits intodevelopfrom
seasonal-leaderboard

Conversation

@jinhojang6
Copy link
Contributor

@jinhojang6 jinhojang6 commented Jan 14, 2026

  • Switch /leaderboard to the new LeaderboardContainer and remove old dev/legacy leaderboard components.
  • Add seasonal + all-time leaderboard data fetching with sorting (points, newest).
  • Add reusable SortDropdown and fix dropdown visibility in dark mode.
  • Show contributor points in the contributor row and support tier badge display.
  • Update contributor API mapping to new response fields (total_points, contribution_count, latest_*, rank info) with safe number parsing.
  • Add social proof stats hook and wire home stats to /contribute/stats.

@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
contribute-logos-co Ready Ready Preview, Comment Feb 16, 2026 7:23am

Request Review

@jinhojang6 jinhojang6 marked this pull request as ready for review February 16, 2026 04:56
Copilot AI review requested due to automatic review settings February 16, 2026 04:56
@jinhojang6 jinhojang6 changed the title [WIP] Seasonal leaderboard Switch leaderboard to real API data and show contributor points Feb 16, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This work-in-progress PR implements a seasonal leaderboard feature alongside the existing all-time (historical) leaderboard. The implementation migrates from Hasura-based APIs to a new contribute API endpoint, removes mock data generation, and introduces real-time data fetching with sorting capabilities.

Changes:

  • Migrated from Hasura API to new contribute API for stats and contributor data
  • Added seasonal leaderboard with current season tracking alongside all-time rankings
  • Introduced sort dropdown UI component with "points" and "newest" options
  • Updated contributor data model to include points and tier information

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
types/index.d.ts Added optional points and tier fields to Contributor interface
messages/*.json Changed label from "score" to "point" across all languages
lib/utils.ts Temporarily hardcoded API URL for testing (needs reversion)
lib/leaderboard-utils.ts Removed mock data generation functions
lib/jsonld-schemas.ts Removed leaderboard-specific JSON-LD schema generation
hooks/useSocialProofData.ts Refactored to use new contribute API endpoint
hooks/useSeasonalLeaderboard.ts New hook for fetching seasonal leaderboard data
hooks/useContributors.ts Updated to support sorting, limits, and new API structure
components/ui/sort-dropdown.tsx New dropdown component for sorting options
components/leaderboard/leaderboard-tabs.tsx Swapped tab order (historical first, seasonal second)
components/leaderboard/leaderboard-table.tsx Removed in favor of ContributorDirectory component
components/contributors/*.tsx Updated to show points, optional tiers, and handle missing data
containers/leaderboard/leaderboard-container.tsx Major refactor to support tabbed interface with sorting
containers/leaderboard/tier-system-container.tsx Increased top margin spacing
containers/leaderboard/scoring-system-container.tsx Minor class order change
containers/directory/directory-container.tsx Removed (functionality merged into leaderboard)
app/[locale]/leaderboard/page.tsx Updated to use LeaderboardContainer instead of DirectoryContainer
Comments suppressed due to low confidence (1)

components/contributors/contributor-item.tsx:71

  • Duplicate link with empty href: similar to the username link, when profileUrl is empty, this button will link to nowhere. Consider conditionally rendering this button only when the contributor has a valid GitHub profile URL.
          <a href={contributor.profileUrl} target="_blank" rel="noopener noreferrer">
            <Button variant="outlined" size="small">
              {t('contributors.viewGithubProfile')}
            </Button>
          </a>

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

Comment on lines 50 to 70
const data = (await res.json()) as ContributorApiResponse[]

return data.map((contributor, idx) => ({
id: idx + 1,
username: contributor.login,
profileUrl: contributor.profileUrl,
contributions: contributor.contributionCount,
latestContribution: contributor.latest.date,
latestRepo: contributor.latest.repo,
avatarUrl: `https://github.com/${contributor.login}.png`,
}))
return data.map((contributor) => {
const points = toNumber(contributor.total_points)

return {
id: toNumber(contributor.contributor_id),
username: contributor.github_username || contributor.alias,
profileUrl: contributor.github_username
? `https://github.com/${contributor.github_username}`
: '',
points,
contributions: toNumber(contributor.contribution_count),
tier: getTierName(contributor.rank_name, points),
latestContribution: contributor.latest_contribution_at || '',
latestRepo: contributor.latest_repo || '',
avatarUrl: contributor.github_username
? `https://github.com/${contributor.github_username}.png`
: '',
}
})
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

Missing validation for API response structure. If the backend returns an unexpected structure (e.g., data is null or not an array), this will throw an unhandled error at runtime. Consider adding a guard check: if (!data || !Array.isArray(data)) before mapping the data.

Copilot uses AI. Check for mistakes.
Comment on lines 33 to 36
<img
src={contributor.avatarUrl}
alt={`${contributor.username} avatar`}
className="h-10 w-10 rounded-full sm:h-12 sm:w-12"
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

Potential issue with empty avatarUrl: when a contributor has no GitHub username, avatarUrl is set to an empty string. This will cause a broken image to be displayed. Consider adding a fallback placeholder image or conditionally rendering the image only when avatarUrl is available.

Copilot uses AI. Check for mistakes.
Comment on lines 51 to 62
const json = (await res.json()) as SeasonApiResponse

const contributors = json.data.map((entry) => ({
id: toNumber(entry.contributor_id),
username: entry.github_username || entry.alias,
profileUrl: entry.github_username ? `https://github.com/${entry.github_username}` : '',
points: toNumber(entry.season_points),
contributions: toNumber(entry.contribution_count),
latestContribution: entry.latest_contribution_at || '',
latestRepo: entry.latest_repo || '',
avatarUrl: entry.github_username ? `https://github.com/${entry.github_username}.png` : '',
}))
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

Missing validation for API response structure. If the backend returns an unexpected structure (e.g., json.data is null or undefined), this will throw an unhandled error at runtime. Consider adding a guard check: if (!json.data || !Array.isArray(json.data)) before mapping the data.

Copilot uses AI. Check for mistakes.
jinhojang6 and others added 2 commits February 16, 2026 16:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jinhojang6 and others added 2 commits February 16, 2026 16:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant