Overhaul game page#3575
Conversation
Code ReviewThis is a substantial and well-structured refactor. A few issues worth noting. Bug: Popovers not closed on component unmount
Suggested fix: add a cleanup effect, e.g.: React.useEffect(() => {
return () => {
more_actions_popover_ref.current?.close();
settings_popover_ref.current?.close();
};
}, []);Performance:
|
… scope, remove dead guard in GameActionsPanel
Code Review — Bug FindingsPR: Overhaul game page (#3575) 1.
|
Code Review — Bugs FoundThree confirmed bugs in the new code: 1.
|
… to the instance, replacing global document.querySelector
Code ReviewBug: falsy-zero in
(goban: Goban | null) => goban?.engine.cur_move?.move_number || -1,
The new code in const live_player_to_move =
goban.engine.getMoveNumber() === current_move_number // 0 === -1 → false at move 0
? player_to_move
: goban.engine.playerNotToMove(); // always taken at game startAt move 0, The fix is to use nullish coalescing instead of the logical OR: (goban: Goban | null) => goban?.engine.cur_move?.move_number ?? -1,
Note: the old |
…er fallback to correctly handle move 0
|
Finding 1: Missing navigation controls -- FragBelowBoardControls removed with no mouse-accessible replacement. FragBelowBoardControls provided gotoFirstMove, gotoLastMove, previous10Moves, forwardTenMoves, and togglePlayPause. MoveNumberSlider only has previousMove/nextMove (one step) and a drag slider. Keyboard shortcuts via GameKeyboardShortcuts still work, but mouse-only users reviewing a long game have lost fast-navigation. Suggestion: expose first/last/skip-10 buttons in MoveNumberSlider, or render a condensed equivalent inside the game-main always-panel. |
|
Finding 2: AI-detector role loses per-player AI Suspected indicator -- black_ai_suspected / white_ai_suspected were removed from PlayerCardsProps. The new GameModeratorAreaPanel guards with if (!user?.is_moderator || !game_id) return null. Meanwhile show_mod_tab in Game.tsx correctly includes user_detects_ai, so users with moderator_powers & AI_DETECTOR but is_moderator === false can open the gavel tab -- but GameModeratorAreaPanel returns null for them. The per-player AI Suspected label they previously saw inline on the player card is gone; GameModToolsPanel renders for them but only provides action buttons, not the passive flag. Suggestion: mirror the show_mod_tab logic in the GameModeratorAreaPanel guard (include user_detects_ai), or pass ai_suspected back into PlayerCard so the inline indicator still renders. |
|
We need a decent effort to get e2e passing on this - I haven't tried yet, but it seems likely it will break selectors. AI is pretty good at reasoning about e2e - let me know if/when you need me to do that - or maybe your AI can run e2e now and handle it? |
This patch switches to using our GobanView class on the game page, completely getting rid of the pop out side bar and introducing a new layout option to have the player and clock info on the top and bottom of the board.