Skip to content

Feature/badges - #463

Open
happyboy24 wants to merge 2 commits into
Bitcoindefi:mainfrom
happyboy24:feature/badges
Open

Feature/badges#463
happyboy24 wants to merge 2 commits into
Bitcoindefi:mainfrom
happyboy24:feature/badges

Conversation

@happyboy24

Copy link
Copy Markdown

Fetch and display agent badges on leaderboard views
Implements badge rendering for global and per-district leaderboards. Previously, leaderboard rows showed derived capability tokens; this fetches earned badges from the reputation store and surfaces them with proper metadata.
Changes

  • lib/leaderboard.ts — Added LeaderboardBadge type and enrichBadges() helper. LeaderboardAgent.badges now carries full badge objects.
  • app/api/leaderboard/route.ts — Enriches agents with badges in parallel via Promise.all to avoid waterfall.
  • app/api/openapi.json/route.ts — Updated schema to document badge object structure.
  • components/leaderboard/leaderboard-table.tsx — Renders up to 3 badge icons per row with rarity-based colors, tooltip on hover/focus showing name + earned date, and +N more when applicable. Layout uses flex-wrap and shrink-0 for mobile safety.
  • app/districts/[id]/leaderboard/page.tsx — Adds badges column to district competition table.
  • app/leaderboard/[agentId]/page.tsx — Updates badge collection display to use new object shape.
  • tests/api/leaderboard.test.ts — Added coverage for badge enrichment and empty-badge fallback.

Closes #205

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

Leaderboard: show earned badges alongside agent rank

1 participant