Skip to content

Commit

Permalink
Merge pull request #16560 from allanjoseph98/ui-nvui-cleanup
Browse files Browse the repository at this point in the history
ui/nvui cleanup
  • Loading branch information
ornicar authored Jan 21, 2025
2 parents 8ac94ff + dbe1f76 commit c6d7b20
Show file tree
Hide file tree
Showing 19 changed files with 641 additions and 825 deletions.
1 change: 1 addition & 0 deletions app/views/analyse/replay.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def replay(
.css(ctx.blind.option("round.nvui"))
.css(ctx.pref.hasKeyboardMove.option("keyboardMove"))
.i18n(_.puzzle, _.study)
.i18nOpt(ctx.blind, _.keyboardMove)
.js(analyseNvuiTag)
.js(
bits.analyseModule(
Expand Down
1 change: 1 addition & 0 deletions app/views/study.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def show(
.css("analyse.study")
.css(ctx.pref.hasKeyboardMove.option("keyboardMove"))
.i18n(_.puzzle, _.study)
.i18nOpt(ctx.blind, _.keyboardMove)
.js(analyseNvuiTag)
.js(
PageModule(
Expand Down
1 change: 1 addition & 0 deletions modules/analyse/src/main/ui/AnalyseUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class AnalyseUi(helpers: Helpers)(externalEngineEndpoint: String):
.css(ctx.pref.hasKeyboardMove.option("keyboardMove"))
.csp(csp.compose(_.withExternalAnalysisApis))
.i18n(_.puzzle, _.study)
.i18nOpt(ctx.blind, _.keyboardMove)
.graph(
title = "Chess analysis board",
url = s"$netBaseUrl${routes.UserAnalysis.index.url}",
Expand Down
12 changes: 0 additions & 12 deletions modules/game/src/main/Game.scala
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,6 @@ object Game:

val unanalysableVariants: Set[Variant] = Variant.list.all.toSet -- analysableVariants

val blindModeVariants: Set[Variant] = Set(
chess.variant.Standard,
chess.variant.Chess960,
chess.variant.KingOfTheHill,
chess.variant.ThreeCheck,
chess.variant.FromPosition,
chess.variant.Antichess,
chess.variant.Atomic,
chess.variant.RacingKings,
chess.variant.Horde
)

val hordeWhitePawnsSince = instantOf(2015, 4, 11, 10, 0)

def isOldHorde(game: Game) =
Expand Down
3 changes: 2 additions & 1 deletion modules/practice/src/main/PracticeUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ final class PracticeUi(helpers: Helpers)(
):
import helpers.{ *, given }

def show(us: UserStudy, data: JsonView.JsData)(using Context) =
def show(us: UserStudy, data: JsonView.JsData)(using ctx: Context) =
Page(us.practiceStudy.name.value)
.css("analyse.practice")
.i18n(_.puzzle, _.study)
.i18nOpt(ctx.blind, _.keyboardMove)
.js(analyseNvuiTag)
.js(
PageModule(
Expand Down
1 change: 1 addition & 0 deletions modules/puzzle/src/main/ui/PuzzleUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ final class PuzzleUi(helpers: Helpers, val bits: PuzzleBits)(
.css(ctx.pref.hasVoice.option("voice"))
.css(ctx.blind.option("round.nvui"))
.i18n(_.puzzle, _.puzzleTheme, _.storm)
.i18nOpt(ctx.blind, _.keyboardMove)
.js(ctx.blind.option(Esm("puzzle.nvui")))
.js(
PageModule(
Expand Down
1 change: 1 addition & 0 deletions modules/round/src/main/ui/RoundUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class RoundUi(helpers: Helpers, gameUi: lila.game.ui.GameUi):
.css(ctx.pref.hasKeyboardMove.option("keyboardMove"))
.css(ctx.pref.hasVoice.option("voice"))
.css(ctx.blind.option("round.nvui"))
.i18nOpt(ctx.blind, _.keyboardMove)
.zoom
.csp(_.withPeer.withWebAssembly)

Expand Down
5 changes: 4 additions & 1 deletion ui/analyse/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ export default class AnalyseCtrl {
if (this.data.forecast) this.forecast = new ForecastCtrl(this.data.forecast, this.data, redraw);
if (this.opts.wiki) this.wiki = wikiTheory();
if (site.blindMode)
site.asset.loadEsm<NvuiPlugin>('analyse.nvui', { init: this }).then(nvui => (this.nvui = nvui));
site.asset.loadEsm<NvuiPlugin>('analyse.nvui', { init: this }).then(nvui => {
this.nvui = nvui;
this.redraw();
});

this.instanciateEvalCache();

Expand Down
1 change: 0 additions & 1 deletion ui/analyse/src/ground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const render = (ctrl: AnalyseCtrl): VNode =>
h('div.cg-wrap.cgv' + ctrl.cgVersion.js, {
hook: {
insert: vnode => ctrl.setChessground(makeChessground(vnode.elm as HTMLElement, makeConfig(ctrl))),
destroy: _ => ctrl.chessground.destroy(),
},
});

Expand Down
Loading

0 comments on commit c6d7b20

Please sign in to comment.