Conversation
|
(Based on #2660 so that I can test support in analysis board) |
86416d4 to
060440b
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for the Crazyhouse chess variant to the Lichess mobile app. Crazyhouse is a variant where captured pieces can be dropped back onto the board, requiring UI for displaying and interacting with "pockets" of captured pieces.
Changes:
- Introduces a new
PocketsMenuwidget to display captured pieces that can be dragged onto the board - Refactors board parameter passing by introducing a sealed
GameBoardParamsclass to unify readonly and interactive board states - Adds variant-changing capability in standalone analysis mode
- Enables the Crazyhouse TV channel and updates variant support lists
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/widgets/pockets.dart | New widget for displaying captured pieces with drag-and-drop support |
| lib/src/model/game/game_board_params.dart | New sealed class unifying board parameters (readonly vs interactive) |
| lib/src/widgets/game_layout.dart | Refactored to use GameBoardParams and display pockets for Crazyhouse |
| lib/src/view/analysis/analysis_layout.dart | Added sideToMove parameter and pocket rendering support |
| lib/src/view/analysis/analysis_screen.dart | Added "Change variant" menu option for standalone analysis |
| lib/src/model/common/chess.dart | Added Crazyhouse to supported variants and hasDropMoves property |
| lib/src/model/tv/tv_channel.dart | Uncommented Crazyhouse TV channel |
| lib/src/widgets/pgn.dart | Strip 'P' prefix from pawn drops in PGN display |
| lib/src/utils/screen.dart | Added helper function for pocket square sizing |
| lib/src/constants.dart | Added padding constant for Crazyhouse layout |
| test/widgets/game_layout_test.dart | Added test for Crazyhouse drop moves |
| test/view/analysis/analysis_screen_test.dart | Added tests for variant changing and Crazyhouse support |
| Multiple screen files | Updated to use new GameBoardParams API |
Comments suppressed due to low confidence (6)
lib/src/view/analysis/analysis_layout.dart:216
- Typo in comment: "to large" should be "too large"
lib/src/utils/screen.dart:3 - Potentially unnecessary import: The import 'package:lichess_mobile/src/widgets/pockets.dart' appears to only be used in a documentation comment (line 48). Documentation references don't require imports. Consider removing this import to avoid creating an unnecessary dependency, unless PocketsMenu types are actually used in the code.
import 'package:lichess_mobile/src/widgets/pockets.dart';
lib/src/widgets/pockets.dart:23
- Grammar error in documentation comment. The phrase "pieces from the pockets are can be dragged" should be "pieces from the pockets can be dragged" (remove "are").
/// If this is equal to [side], pieces from the pockets are can be dragged onto the board to make a move.
lib/src/widgets/pgn.dart:1245
- The logic to strip the 'P' prefix from pawn drops is too broad and could potentially affect non-drop moves. Consider checking if the move contains '@' (the drop move indicator) before stripping the prefix. For example:
branch.sanMove.san.contains('@') && branch.sanMove.san.startsWith('P@'). This would make the logic more robust and only apply to actual pawn drop moves in crazyhouse notation.
final san = branch.sanMove.san.startsWith('P')
? branch.sanMove.san.substring(1)
: branch.sanMove.san;
test/view/analysis/analysis_screen_test.dart:162
- Typo in comment: "crazhouse" should be "Crazyhouse"
// Change to crazhouse, pockets should be displayed:
lib/src/view/analysis/analysis_screen.dart:598
- Missing localization: The text 'Change variant' is hardcoded and has a TODO comment for l10n. This should be properly localized before merging.
makeLabel: (context) => const Text('Change variant'), // TODO l10n
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
950a9b9 to
d9258b3
Compare
rebased now 👍 |
d9258b3 to
5279396
Compare
|
There are conflicts from your other PR @tom-anders |
5279396 to
2109c44
Compare
fixed now 👍 |
|
Will review asap. I am focusing on releasing offline computer right now. Next will be variants. |
|
Oh, sorry there is another conflict. |
2109c44 to
8e07722
Compare
8e07722 to
3b4fa42
Compare
Phone Screen:
Tablet:
Small phone: