fix study explorer game insertion
This commit is contained in:
parent
20476a6097
commit
7d54432cdc
|
@ -40,7 +40,10 @@ private final class ExplorerGame(
|
|||
val fromEndPath = fromNodes.drop(1).foldLeft(fromPath)(_ + _)
|
||||
val (path, foundGameNode) = fromNodes.reverse.foldLeft((fromEndPath, none[Node])) {
|
||||
case ((path, None), fromNode) =>
|
||||
path.init -> gameNodes.find(_.fen == fromNode.fen)
|
||||
gameNodes.find(_.fen == fromNode.fen) match {
|
||||
case Some(gameNode) => path -> gameNode.some
|
||||
case None => path.init -> none
|
||||
}
|
||||
case (found, _) => found
|
||||
}
|
||||
foundGameNode.flatMap(_.children.first).map { nextGameNode =>
|
||||
|
@ -68,9 +71,9 @@ private final class ExplorerGame(
|
|||
val result = chess.Color.showResult(g.winnerColor)
|
||||
val event = {
|
||||
val raw = pgn.flatMap(_.tag(_.Event))
|
||||
val year = gameYear(pgn, g)
|
||||
val year = gameYear(pgn, g).toString
|
||||
if (raw.exists(_ contains year)) raw
|
||||
else raw.fold(year.toString)(e => s"$e, $year")
|
||||
else raw.fold(year)(e => s"$e, $year")
|
||||
}
|
||||
s"$white - $black, $result, $event"
|
||||
}
|
||||
|
|
|
@ -632,7 +632,7 @@ body.dark .explorer_box .black {
|
|||
.explorer_box .game_menu .menu a:hover {
|
||||
background: rgba(255,255,255,0.2);
|
||||
}
|
||||
@media (max-width: 1140px) {
|
||||
@media (max-width: 1120px) {
|
||||
.explorer_box .game_menu {
|
||||
font-size: 0.8em;
|
||||
letter-spacing: 0;
|
||||
|
|
|
@ -138,7 +138,7 @@ function gameActions(ctrl: AnalyseCtrl, game: OpeningGame): VNode {
|
|||
h('a.text', {
|
||||
attrs: dataIcon('c'),
|
||||
hook: bind('click', _ => send(false), ctrl.redraw)
|
||||
}, 'Quote'),
|
||||
}, 'Cite'),
|
||||
h('a.text', {
|
||||
attrs: dataIcon('O'),
|
||||
hook: bind('click', _ => send(true), ctrl.redraw)
|
||||
|
|
Loading…
Reference in a new issue