Skip to content
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

ui/nvui cleanup #16560

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
edf0cdb
use destsToUcis from ui/chess
allanjoseph98 Dec 9, 2024
4b11790
move sanToUci to ui/chess
allanjoseph98 Dec 9, 2024
60e0b60
change some types
allanjoseph98 Dec 9, 2024
686690a
some code golf
allanjoseph98 Dec 9, 2024
c26acd4
use lichessrules chessops compat util
allanjoseph98 Dec 9, 2024
3dad0fb
golf + rename stuff to be more accurate
allanjoseph98 Dec 9, 2024
0e2b7cf
remove unused blindmode variants scala set
allanjoseph98 Dec 10, 2024
cafb9ae
type tweak
allanjoseph98 Dec 10, 2024
08dd1db
distinguish between cash and non cash variables
allanjoseph98 Dec 10, 2024
7e6b26b
rename `Style` to `MoveStyle` for clarity
allanjoseph98 Dec 10, 2024
1c067b8
cast type directly
allanjoseph98 Dec 10, 2024
2f36dac
use roles const from chessops
allanjoseph98 Dec 10, 2024
730a5f8
refactor
allanjoseph98 Dec 10, 2024
410d118
programatically render choice examples
allanjoseph98 Dec 10, 2024
e5cd01d
fix order
allanjoseph98 Dec 10, 2024
fbd6d0e
some weight loss
allanjoseph98 Dec 11, 2024
28d1180
`sanToWords` util func.
allanjoseph98 Dec 11, 2024
1a803a5
remove unused constructor parameter
allanjoseph98 Dec 12, 2024
21c1cc7
golf
allanjoseph98 Dec 12, 2024
036ca3c
correct lichess comment Regex
allanjoseph98 Dec 12, 2024
f242042
fix game start
allanjoseph98 Dec 14, 2024
79750ae
allow racingKings and antichess in nvui
allanjoseph98 Dec 14, 2024
f82f82c
refactor
allanjoseph98 Dec 16, 2024
894dac0
golf puzzle nvui
allanjoseph98 Dec 17, 2024
06d76fb
golf
allanjoseph98 Dec 18, 2024
e08c9c7
refactor:use analyse result rendering
allanjoseph98 Dec 18, 2024
23e014a
king underpromotion regex for antichess
allanjoseph98 Dec 18, 2024
eff01df
key attr regex
allanjoseph98 Dec 31, 2024
650b574
don't assume dests are available
allanjoseph98 Dec 31, 2024
4c4e607
Don't destroy chessground when the board is hidden by snabb. Required…
allanjoseph98 Dec 31, 2024
6dd0ca8
nvui study chapter select
allanjoseph98 Dec 31, 2024
bcea574
maybe pacify gh security warning
allanjoseph98 Dec 31, 2024
5a6b066
nvui study add and edit chapters
allanjoseph98 Dec 31, 2024
dfb3f54
golf
allanjoseph98 Jan 1, 2025
9b7d50f
remove debug
allanjoseph98 Jan 1, 2025
e6108d7
translate some existing commands
allanjoseph98 Jan 1, 2025
4ca3df1
refactor board commands
allanjoseph98 Jan 1, 2025
8c97326
fix puzzle i18n
allanjoseph98 Jan 1, 2025
8d24edc
some more i18n
allanjoseph98 Jan 3, 2025
4c076f9
uci is already treated as optional
allanjoseph98 Jan 3, 2025
cf05aa8
more i18n
allanjoseph98 Jan 4, 2025
ba0ada7
round i18n
allanjoseph98 Jan 4, 2025
8d02d02
golf
allanjoseph98 Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -239,18 +239,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
Loading