Draft
feat: extensible leaderboard with local provider and async provider interface#2
Conversation
…nterface Agent-Logs-Url: https://github.com/zerebos/BlockCatcher/sessions/5934d34c-ef7f-4e46-ace9-c431f2006f75 Co-authored-by: zerebos <6865942+zerebos@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
zerebos
March 27, 2026 11:31
View session
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.
Implements a local personal leaderboard designed to support a future global backend (e.g. Supabase) without refactoring call sites.
Architecture
LeaderboardProviderinterface —getEntries() / addEntry() / isHighScore(), all async. New backends implement this and nothing else changes.LocalLeaderboardProvider— localStorage, Promise-wrapped, keeps top 10 entries sorted by score.LeaderboardManager— acceptsproviders: LeaderboardProvider[], fans writes to all providers, merges and deduplicates reads byentry.id.Adding Supabase later is a one-line change in
game.ts:LeaderboardEntryshapeGame flow
endGame()triggers a leaderboard overlay (name-entry form, pre-filled with last used name).startGame(): no-op during name-entry; dismisses the table and starts a new game when the table is visible.UI
New overlay panel with two phases (name-entry / score table), synthwave-styled to match the existing design system. Loading state is built in from the start so the async path works transparently when a remote provider is added.