Skip to content

feat:Add a "Recently Completed" hunts section to the Arcade (#359)#412

Merged
Samuel1-ona merged 1 commit into
Samuel1-ona:mainfrom
Awointa:feat/issue-358-player-count-trending
Jun 1, 2026
Merged

feat:Add a "Recently Completed" hunts section to the Arcade (#359)#412
Samuel1-ona merged 1 commit into
Samuel1-ona:mainfrom
Awointa:feat/issue-358-player-count-trending

Conversation

@Awointa
Copy link
Copy Markdown
Contributor

@Awointa Awointa commented Jun 1, 2026

What changed

  • HuntCards now shows a live registered player count and a 🔥 Trending badge
    when a hunt exceeds 50 players.
  • The arcade page shows a horizontally scrollable "Recently Completed" strip
    (up to 5 hunts) with winner addresses and a "View results" link per card.
  • Player counts are cached in-memory (60 s TTL) and batch-fetched on each
    arcade page load to avoid N sequential calls.

New files

┌────────────────────────┬────────────────────────────────────────────────┐
│ File │ Purpose │
├────────────────────────┼────────────────────────────────────────────────┤
│ hooks/usePlayerCo │ Single-hunt count with TTL cache and no-throw │
│ unt.ts │ guarantee │
├────────────────────────┼────────────────────────────────────────────────┤
│ hooks/usePlayerCo │ Bulk fetch via Promise.allSettled; exposes │
│ unts.ts │ refetch() │
├────────────────────────┼────────────────────────────────────────────────┤
│ hooks/useRecently │ Derives completed hunts from existing query; │
│ Completed.ts │ slices to MAX_RECENTLY_COMPLETED = 5 │
├────────────────────────┼────────────────────────────────────────────────┤
│ components/Comple │ Separate card for completed hunts (distinct │
│ tedHuntCard.tsx │ data shape from HuntCards) │
├────────────────────────┼────────────────────────────────────────────────┤
│ components/Recent │ Returns null when empty; horizontal scroll, │
│ lyCompletedSection.tsx │ keyboard-navigable │
├────────────────────────┼────────────────────────────────────────────────┤
│ hooks/usePlayerCo │ 10 tests: storage scan, TTL cache, trending │
│ unt.test.ts │ threshold, stale re-fetch │
├────────────────────────┼────────────────────────────────────────────────┤
│ hooks/usePlayerCo │ 7 tests: bulk fetch, cache hit, refetch, │
│ unts.test.ts │ partial failure isolation │
├────────────────────────┼────────────────────────────────────────────────┤
│ components/test │ 20 tests: count display, badge, a11y, card │
│ s
/HuntCards.test.tsx │ rendering, answer submission │
└────────────────────────┴────────────────────────────────────────────────┘

Modified files

  • lib/types.ts — added TRENDING_PLAYER_THRESHOLD, PLAYER_COUNT_CACHE_TTL_MS,
    PlayerCountResult
  • components/HuntCards.tsx — optional playerCount/isTrending props; falls back
    to usePlayerCount in the play flow
  • app/page.tsx — calls usePlayerCounts + useRecentlyCompleted; renders
    RecentlyCompletedSection

Design decisions

  • Player counts are read from localStorage keys
    (hunt_registered_{id}_{address}), consistent with how registerPlayer and
    getPlayerProgress already work — no new RPC call.
  • RecentlyCompletedSection returns null (not an empty container) when there
    are no completed hunts.
  • Raw winner addresses never appear as visible text — always truncateAddress;
    full address on title + aria-label.
  • CompletedHuntCard is a separate component; sharing HuntCards would require
    nullable props that make the type system unhelpful.

Testing

All 37 new tests pass. Pre-existing failures in huntStore.test.ts and
GlobalActivityFeed.test.tsx are unrelated to this PR (pre-existing
localStorage.clear and logger issues in the test environment).

closes #359

@Awointa Awointa changed the title feat: live player count, Trending badge, and Recently Completed strip (#358) feat:Add a "Recently Completed" hunts section to the Arcade (#359) Jun 1, 2026
@Samuel1-ona Samuel1-ona merged commit 0f950cf into Samuel1-ona:main Jun 1, 2026
2 of 3 checks passed
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.

[FEAT] Add a "Recently Completed" hunts section to the Arcade

2 participants