- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.5k
 
Analysis/study page keyboard input #15019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
           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.  | 
    
| 
           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 { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't unsee it 🙃
| 
           Okay it seems to be wired up correctly,   | 
    
* 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 ...
        
          
                ui/analyse/src/ctrl.ts
              
                Outdated
          
        
      | this.sendMove(orig, dest, capture, prom); | ||
| }; | ||
| 
               | 
          ||
| auxUpdate = (fen: string) => { | 
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😌
        
          
                ui/analyse/src/ground.ts
              
                Outdated
          
        
      | fen: ctrl.node.fen, | ||
| canMove: true, | ||
| cg: ctrl.chessground, | ||
| }); | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" }, | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😎
There was a problem hiding this comment.
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).
| 
           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 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   | 
    
| ArrowLeft: -1, | ||
| ArrowRight: 1, | ||
| }; | ||
| root.userJumpPlyDelta?.(arrowKeyToPlyDelta[arrowKey]); | 
There was a problem hiding this comment.
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 🤔
* 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 ...
| 
           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
| 
           yes, it's on lichess.dev now  | 
    
| 
           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.  | 
    
| 
           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:   | 
    
| 
           Okay I think it's in a better state now for testing  | 
    
| 
           
 This error usually means something changed the dom that snabbdom manages.  | 
    
* 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
| 
           Deployed to lichess.dev!  | 
    
* 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
| 
           ready to go?  | 
    
| 
           I think so! I'll keep my eyes out for any bug reports.  | 
    
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: