- Opening a finished game shows its final position, result, score, date and duration, with Watch from start - First / previous / play-pause / next / last, speed 1x, 2x, 4x, a timeline, the move list and arrow keys and space - Stepping forward animates the move like a live game; jumps show the position directly - ?move=n links to a move and follows the shown move - Players see the board from their own side - PitAnimator takes its step interval as a parameter
2.0 KiB
2.0 KiB
Game history and live games: tasks
Work through the tasks in order; each ends with its tests passing and a commit. Tick a task when it is committed.
- 1. Infrastructure:
postgresservice with init script for thekeycloakandmancaladatabases (replacingkeycloak-db),valkeyservice, backendDATABASE_URL/VALKEY_URL,.envvariables, README. - 2. Core types and history helpers:
PlayerSummary,MoveRecord, summaries,GameRecord,TURN_TIMEOUT_MS, new channels,offlineSince;getInitialBoard,getBoardAfterMove,describeMove,createGameAtMovewith unit tests; localized strings. - 3. Backend fixes: remove spectators on disconnect, remove finished games from memory, send the connection info once at game start.
- 4. Postgres repository: pool, migration runner,
gamesandgame_players,PostgresGameHistoryRepository(save, get, recent for user, popular), integration tests. - 5. Valkey store: live game snapshots and restore, pending saves, cache; integration tests.
- 6. Game lifecycle: start and move times, spectator counters, outcomes (completed, left, timeout, inactive),
timeout watcher,
offlineSince, rejecting a new game while playing, saving with retry, restore on startup; unit tests. - 7. API: public ids, Bearer auth middleware,
/games/me/active,/games/me,/games/popular,/game/:idfor finished games, live games channel with throttled push; tests. - 8. Board size:
--board-unitinBoardView,PitView,StoreView,StoneView;widthprop. - 9. Home page:
ActiveGameBanner,LiveGamesSectionwith live updates,RecentGamesSection; lobby rejection message. - 10. Live game history:
MoveList, review mode withReviewBannerand keyboard, timeout countdown. - 11. Replay:
ReplayViewwith controls, speed, timeline,?move=, own-side orientation, duration. - 12. End to end and docs: Chrome tests from
design.md, README andTODO.mdupdates.