mobile icon indicating copy to clipboard operation
mobile copied to clipboard

feat: [BoardEditor] add reset board and starting position option

Open sid0-0 opened this issue 1 year ago • 5 comments

Implements #1010

Screenshot: image

sid0-0 avatar Sep 17 '24 10:09 sid0-0

Should I also add an option to Load from FEN?

sid0-0 avatar Sep 17 '24 10:09 sid0-0

These new buttons should not be placed here, and should not look like a chip. They are action buttons (clear board) where the other ones are toggles on the current position.

We should rearrange as follow imo:

  • add a 'menu' button (menu icon 3 bars as in game screen)
    • flip board, clear board and reset board should be part of this new menu
  • the actual BoardEditorMenu should be renamed BoardEditorPositionSettings
  • the button icon for the position settings should be changed to a 'settings' (cog) icon

veloce avatar Sep 23 '24 09:09 veloce

Should I also add an option to Load from FEN

We could, but we already have the "Load position" screen which achieves the same.

More interesting is to add the choice picker to choose a preconfigured opening or endgame position like in the website.

veloce avatar Sep 23 '24 09:09 veloce

Made the suggested changes. Screenshots:

While we're modifying menu(now settings), I also think we should move the castling options around for better clarity. I would suggest something like this:

More interesting is to add the choice picker to choose a preconfigured opening or endgame position like in the website.

A separate issue is raised for this. I can pick this separately.

sid0-0 avatar Sep 23 '24 20:09 sid0-0

I'm not sure about the settings icon on the top nav bar.

I'd expect these settings to be configuration for the board editor itself (like configuring behavior of the editor), and they actually are position related, switches to change the FEN output.

So the button should not be placed on top imo, but I agree that the settings (cog) icon is not a good choice either. Maybe we should just revert to the 'tune' icon and put it back at the bottom. Not entirely satisfied with the tune icon but I cannot find any better one.

veloce avatar Sep 24 '24 09:09 veloce

Hello! I was missing this from the app and decided to try and see if I could implement it without noticing there is a PR open.

It doesn't look like there is much activity around this, so I'll share my proposal:

image

which I think looks reasonably similar to the webpage:

image

The implementation is as simple as:

diff --git a/lib/src/view/board_editor/board_editor_screen.dart b/lib/src/view/board_editor/board_editor_screen.dart
index e5a66bd1879d..3a76be5579f5 100644
--- a/lib/src/view/board_editor/board_editor_screen.dart
+++ b/lib/src/view/board_editor/board_editor_screen.dart
@@ -315,6 +315,20 @@ class _BottomBar extends ConsumerWidget {
           ),
           icon: Icons.tune,
         ),
+        BottomBarButton(
+          label: context.l10n.startPosition,
+          onTap: () => ref
+              .read(boardEditorControllerProvider(initialFen).notifier)
+              .loadFen(kInitialFEN),
+          icon: CupertinoIcons.arrow_counterclockwise,
+        ),
+        BottomBarButton(
+          label: context.l10n.clearBoard,
+          onTap: () => ref
+              .read(boardEditorControllerProvider(initialFen).notifier)
+              .loadFen(kEmptyFEN),
+          icon: CupertinoIcons.delete_simple,
+        ),
         BottomBarButton(
           key: const Key('flip-button'),
           label: context.l10n.flipBoard,

Let me know if I should open a PR. Thanks for your hard work!

IEncinas10 avatar Dec 14 '24 22:12 IEncinas10

Closed by https://github.com/lichess-org/mobile/pull/1394

veloce avatar Feb 14 '25 13:02 veloce