Skip to content

Conversation

@brollin
Copy link
Collaborator

@brollin brollin commented Apr 2, 2024

Let's add the keyboardMove input to the analysis and study page. Not sure that the normal location directly under the board is best, but I implemented it there for the time being:

image

@schlawg
Copy link
Contributor

schlawg commented Apr 2, 2024

I'm really pumped about this. Especially if you're interested in adding voice after! It's been requested several times. Variants may be tricky.

@brollin
Copy link
Collaborator Author

brollin commented Apr 3, 2024

Totally! Hoping to get voice in there right after. And I also have expectations of bug reports with both given the complexity of analysis+study+variants O_O

}

mainlinePathToPly(ply: Ply): Tree.Path {
mainlinePlyToPath(ply: Ply): Tree.Path {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol good catch!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't unsee it 🙃

@brollin
Copy link
Collaborator Author

brollin commented Apr 6, 2024

Okay it seems to be wired up correctly, with only one very questionable bit of hackery (fixed now). As for placement, now that we have something to look at maybe we can collectively decide where it should go. There are some outstanding styling issues that I didn't want to spend to much time on in case we decided on a different location.

@brollin brollin marked this pull request as ready for review April 6, 2024 02:01
brollin and others added 4 commits April 7, 2024 16:34
* master: (258 commits)
  remove more dependencies
  remove deps to security WIP
  complete permission migration to lila.core.perm
  move permission list to lila.core.perm
  provide sample issues for puzzle cli example
  fix table formatting
  New Crowdin updates (lichess-org#15015)
  Fix hub -> core path in bin/trans-dump
  Fix element name
  don't dox poster info in forum post search results
  fix Playban bus event, simplify playban api
  give enough space to crazyhouse pocket
  grantable wip
  fix fide monitoring
  remove deps to lobby & relation
  remove oauth dependency to user
  refactor UserId functions
  remove last shutup dependency
  add missing LightUser.Me conversion
  remove gathering dep to user
  ...
this.sendMove(orig, dest, capture, prom);
};

auxUpdate = (fen: string) => {
Copy link
Collaborator

@ornicar ornicar Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this comes from ui/round, but still, what does that even mean "auxUpdate"? It was bad then and there, and it's bad here and now.

Why do we need it, and can it get a helpful name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the intention was "auxiliary update", but agreed even spelled out it could be improved. Its purpose is to fan out updates to the various plugins, and I think it existing at all will make more sense when we implement voiceMove. We could name it something like updatePlugins?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pluginUpdate and pluginMove sound good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the risk of getting too in the weeds, curious why pluginUpdate vs updatePlugins? At a glance, I wouldn't necessarily know that the first is performing an action. Maybe it's returning a "plugin update" object or something. The latter is more unmistakably an action an my head, and follows the verb object order of an English sentence.

Very light preference for me here, just want to understand how you think about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, made that naming change here: 10b0d24

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for pluginMove, something like handlePluginMove makes the most sense to me. If I'm in a controller and see that function, I know that we are handling a move that's coming from the plugin. I'm always reminding myself which way the data is flowing, and in theory this could help with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the actor followed by the verb is a convention shared by rounds, puzzles, and chessground. i.e userMove, apiMove, etc.

but i don't care at all, i'm the one who chose auxMove so just shut me in a soundproof closet and pick something - it's fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, consistency is important. Too light of a preference to break with consistency or shove anyone in a closet I think. Side note, I've loved seeing the refactored controllers (functions->classes) and overall the code is in a great spot it feels like, a nice departure from my work's codebase 😌

fen: ctrl.node.fen,
canMove: true,
cg: ctrl.chessground,
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctrl sub-ctrls should be instanciated within the ctrl, not in a view.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That definitely feels better. I ended up mimicking how we do things in ui/round: fcbf24f

{ "path": "../chess/tsconfig.json" },
{ "path": "../common/tsconfig.json" },
{ "path": "../game/tsconfig.json" },
{ "path": "../keyboardMove/tsconfig.json" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tsc dependency mechanism isn't documented anywhere so I'm impressed. I think you're the first to do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't pretend to understand it, but I will pretend to be quite good at pattern matching 😎

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's actually straightforward. tsc doesn't care about our monorepo dependencies (package.json), so if you want correct behavior when type checking - you have to either compile everything in the correct order (bad) or express dependencies in tsconfig.json (better, but still not great).

@brollin
Copy link
Collaborator Author

brollin commented Apr 14, 2024

Good catches. I fixed the up and down arrow behavior in 1a4004b.

It turns out that the computer evaluation toggle was the next thing in the tab order, and when it is focused, or any input element for that matter, mousetrap key bindings are not respected. I solved this two ways:

  • I changed the tab order in 06b84be such that the keyboard input was after all of the right hand side tools (ceval, move list, controls, etc) in the tab order. Now, the under board is focused after the keyboard input.
  • I allowed toggling the computer evaluation via enter in 7f4517e, only when it is focused. Now if that element happens to be focused and enter is pressed, something happens at least. Since it is an input, it will still be swallowing lots of other key presses (like the arrows).

I tried to move the keyboard input such that the next thing in the tab order would be the move list, but the move list is in the middle of renderTools, and the keyboard input is rendered alongside those tools. Basically the hierarchy doesn't easily allow that. Open to changing the tab order around more if desired.

ArrowLeft: -1,
ArrowRight: 1,
};
root.userJumpPlyDelta?.(arrowKeyToPlyDelta[arrowKey]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an opportunity here to just remove root.userJumpPlyDelta in favor of root.handleArrowKey. I was debating whether it would be cleaner or not 🤔

schlawg and others added 3 commits April 28, 2024 17:41
* master: (117 commits)
  Update LameNameTest.scala
  increase specificity of tv grid layout, was overridden by round
  remove "shit" from lamename
  move `object Tellable` back to lila.common
  final class
  fix unrelated typo in comment
  support empty study chapter player name - closes lichess-org#15185
  remove 'pool' from boards.scss too
  fix old dasher langs style bug
  remove dasher .category
  Fix insights aggregation by opening
  move dasher reset button so that its text is visible, move board css to board.css
  hack around dasher board pref debounce
  only reset non-default board settings
  refactor dasher board defaults
  remove pool.webp board image due to low quality
  remove unused import
  refactor code dup, add explicit typing
  refactor common.Form
  study list pages shouldn't be full-screen
  ...
@ornicar
Copy link
Collaborator

ornicar commented May 1, 2024

It's looking a bit wrong on /analysis
258x685_2024-05-01

Also I couldn't get it to appear on a game analysis page?

@schlawg
Copy link
Contributor

schlawg commented May 1, 2024

Should we put it up on lichess.dev or testy and let some power users see how well it integrates with the existing keyboard navigation?

* master:
  Add missing "gameOver" i18n key to puzzles
  why so lazy
  rename lila.app.UiEnv
  ui tweaks
  AuthUi
  rename lila.web.ui
  move Controller.action
  complete lila.coach.ui
  lila.coach.ui
  only hide dasher board reset when actually resetting
@ornicar
Copy link
Collaborator

ornicar commented May 2, 2024

yes, it's on lichess.dev now

@brollin
Copy link
Collaborator Author

brollin commented May 2, 2024

Just catching back up, I can look into why it isn't on the analysis page anymore as well as the styling.

How should I log into lichess.dev? Is there a preexisting user I can use or some way to register? Attempting to register doesn't send me an email at the moment.

@brollin
Copy link
Collaborator Author

brollin commented May 2, 2024

Turns out there is an error when rendering the keyboard input before the underboard, but it displays fine after it (and in other positions in the vdom children array). Not sure why that error is happening, the message isn't making much sense to me: Uncaught DOMException: Node.insertBefore: Child to insert before is not a child of this node

@brollin
Copy link
Collaborator Author

brollin commented May 2, 2024

Okay I think it's in a better state now for testing

@ornicar
Copy link
Collaborator

ornicar commented May 2, 2024

Uncaught DOMException: Node.insertBefore: Child to insert before is not a child of this node

This error usually means something changed the dom that snabbdom manages.

ornicar added 2 commits May 2, 2024 16:46
* master:
  Update _app.scss
  more puzzle ui
  fix lichess-org#15194
  page/snippet tweaks
  page & snippet, it compiles
  only render Page and Snippet WIP
  lila.event.ui
  more user ui
  lila.web.ui.DevUi
  extra space
  lila.setup.ui
  lila.challenge.ui
  continue ui refactoring
  lila.storm.ui
  more analysis ui
…lila into analysis-keyboard-input

* 'analysis-keyboard-input' of https://github.com/brollin/lila:
  one column styling fixes
  optionally include keyboardMove styling on user analysis page
  fix rendering bug with tab order change
@ornicar
Copy link
Collaborator

ornicar commented May 2, 2024

Deployed to lichess.dev!

ornicar added 2 commits May 3, 2024 11:43
* master:
  New Crowdin updates (lichess-org#15198)
  tweak site-header-margin to fully render the analysis board top player - closes lichess-org#14953
  invalidate study chapter preview cache after a broadcast reset - closes lichess-org#15135
  lila.report.ui
  more ui refactor
  always more ui refactor
  lila.relay.ui
  move forms to their modules
  fixed external link urls
  better fix for Bus.sub match errors
  hackfix Bus.sub match errors
  fix monitoring warning
  remove 4 new boards due to bad image compression
  fix typos (lichess-org#15196)
  New Crowdin updates (lichess-org#15190)
  Zero[A => A]
  add panels for placing extra pieces
  hide glyphs when computer analysis is disabled
@ornicar
Copy link
Collaborator

ornicar commented May 3, 2024

ready to go?

@brollin
Copy link
Collaborator Author

brollin commented May 3, 2024

I think so! I'll keep my eyes out for any bug reports.

@ornicar ornicar merged commit c4d18da into lichess-org:master May 3, 2024
ornicar added a commit that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants