Skip to content

check phase commit:#408

Open
happyboy24 wants to merge 1 commit into
Bitcoindefi:mainfrom
happyboy24:leader-stellar
Open

check phase commit:#408
happyboy24 wants to merge 1 commit into
Bitcoindefi:mainfrom
happyboy24:leader-stellar

Conversation

@happyboy24

@happyboy24 happyboy24 commented Jun 30, 2026

Copy link
Copy Markdown

PR: Display Agent Badges on Leaderboard

Closes: #200 (badges system integration), related to #190 (leaderboard)

Summary
Integrates the new badges system into the leaderboard UI, displaying up to 3 earned badge icons per agent row with tooltips and overflow handling. Badges are fetched in parallel with existing rank data to avoid request waterfalls.

Changes

API Layer

UI Components

  • LeaderboardRow — added BadgeStrip sub-component
    • Renders up to 3 <BadgeIcon> components
    • Shows +N more overflow label when badges.length > 3
    • Tooltip on each icon: badge name + formatted earn date (MMM DD, YYYY)
  • BadgeIcon — new presentational component
    • Accepts badge: { id, name, iconUrl, earnedAt }
    • Uses existing Tooltip primitive from @/components/ui
    • Accessible: aria-label + keyboard focus triggers tooltip
  • DistrictLeaderboard — updated to include BadgeStrip in per-district rows (same layout rules as global view)

Behavior

Viewport Layout
Desktop (≥768px) Icons inline, right-aligned next to XP
Mobile (<768px) Icons wrap below agent name; +N more truncates with ellipsis

Performance

  • Parallel fetch: Promise.all([getRanks(), ...agents.map(a => getBadges(a.id))])
  • No additional re-renders: badges memoized via useMemo keyed on agent ID
  • Icons lazy-loaded via loading="lazy" on <img>

Screenshots
(attach before/after screenshots here)

Testing

  • Unit: BadgeStrip renders ≤3 icons, shows overflow correctly
  • Unit: Tooltip displays name + date on hover
  • Integration: district leaderboard includes badge strip
  • Mobile: verify no horizontal scroll on iPhone SE viewport
  • API: confirm no waterfall in Network tab (parallel badge requests)

Checklist

  • Fetched badges from /api/agents/{id}/badges
  • Up to 3 icons per row in global leaderboard
  • Tooltip with badge name + earned date
  • +N more overflow label
  • Mobile-safe layout (stack/truncate)
  • Parallel fetch with rank data
  • District leaderboard updated
  • Tests added/updated
  • Screenshots attached
  • Design review sign-off

Related


Suggested PR title:

feat(leaderboard): display agent badges with tooltips and overflow

Quick review tip:
If you want to make the acceptance criteria super scannable for reviewers, you could also add this section right after Summary:

markdown
Acceptance Criteria Coverage

Criterion Status Location
≤3 badge icons per row BadgeStrip
Tooltip (name + date) BadgeIcon + Tooltip
+N more overflow BadgeStrip
Mobile-safe layout Responsive CSS
Parallel fetch getLeaderboard()
District leaderboard DistrictLeaderboard


closes #205 

@sonarqubecloud

Copy link
Copy Markdown

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.

X402 multi-chain: add transaction explorer link after settlement

1 participant