lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.53k stars 2.27k forks source link

Collapsable variations in lichess studies. #9735

Closed infiniteflash24 closed 4 months ago

infiniteflash24 commented 3 years ago

image

Hi it would be nice to have more readable studies if we had collapsible variations like this. Once collapsed, the variation would only show the first move. This is a low priority request.

schlawg commented 2 years ago

Excellent suggestion, I accidentally created the exact same issue.

The easiest implementation would be to add a "collapse variation" item to the node context menu which would collapse the tree up until the branch node, and then render that branch node with a special background or icon that indicates hidden variation(s). Throw a "show variation(s)" item in the branch node context menu and there's the entire UI. Of course that omits the first move display.

It could also be done with inline controls as in your screenshot. Just need to figure out how to retain clarity with them embedded in the movelist for all possible trees, both inline and table view.

It might be more manageable to only offer collapse on the entire variation tree up until the first mainline node it branches from to reduce complexity. Don't know if that's still useful for many of the use cases.

infiniteflash24 commented 2 years ago

@schlawg

Even if it's only on the first branch, that's helpful enough.

kraktus commented 1 year ago

To reduce clutter another idea would be to only show the option when the sideline is long enough (to be decided). Obviously with the potential issue of it appearing seemly randomly for the user.

Siderite commented 1 year ago

Check out the implementation in LiChess Tools v2.1.23. You add bookmarks and only collapse/expand from there. Also they serve as links to the position, which now depend on the label name, not the index of the position or if it's in the mainline or not. Let me know if you think it's a good idea.

kraktus commented 1 year ago

Hey, do you have screenshots available?

Siderite commented 1 year ago

image image

Siderite commented 1 year ago

image image image

Siderite commented 1 year ago

Please excuse the terrible design, I am not really a web design person :)

Dboingue commented 1 year ago

I would say that first line is a start but not entirely satisfying. It would perpetuate the micromanaging dance that we already have to do, when thinking on many sibling variations, and the mainline black hole attractor in studies, where context menu promote variation and make-mainline are doing the exact same thing (on slow machine one can see the promote to first non mainline sibling happening like in standalone analysis, BUT then slip up to mainline format (inline always btw, for me, so might be inline only behavior, doubt it).

so perhaps this might work well for 2 branches total. Also, all those issues look entangled (everything user created variations is), sorry if I invoked a tangent point. I think (impression) the study needs ground work, and less interference with the PGN import export, as it seems to be related for its PGN-RAV behavior (to the point that non-study analysis mode is not speaking to PGN export, sorry for animism in computer land, it makes for good communication though, a module speaking to another).

The post-game mechanism that transport local browser user-created variations, to server held studies, is not using the PGN data structure I would think, given the data point crumb that exporting to PGN from post-game, does not include those, but only the engine ones (if choosing annotated). I said crumb, because I reason from user-land facing lichess (with guesses to what might be behind that, explaining that; so I count on a benevolent translation-minded reading here, from those who know things).

Dboingue commented 1 year ago

To reduce clutter another idea would be to only show the option when the sideline is long enough (to be decided). Obviously with the potential issue of it appearing seemly randomly for the user.

There is also the behavior in post-game for engine annotations on engine created variations. but the branching is low there.

cyanfish commented 4 months ago

https://github.com/lichess-org/lila/pull/15488 has been merged for this.

@Siderite FYI there are some minor DOM changes to the move tree (currently visible on lichess.dev if you want to check) so this could cause issues with lichess-tools.

Siderite commented 4 months ago

Thanks for the heads up. Could you try to add some information on what exactly is collapsed? For example until now I expected to have an HTML element for each node in the move tree. Now, when collapsing, the elements are not there, but I also don't have a way to determine that a specific path is collapsed.

cyanfish commented 4 months ago

You can look for the <a class=expand> element to know that there is something to expand.