From 429226f77f96c0cf8e1fedd5cce94d0e68798050 Mon Sep 17 00:00:00 2001 From: Jonathan Gamble Date: Sat, 26 Oct 2024 12:22:31 -0500 Subject: [PATCH] on second thought, always use puzzleTheme.mix --- app/views/puzzle/dashboard.scala | 2 +- modules/coreI18n/src/main/key.scala | 4 ++-- modules/puzzle/src/main/PuzzleAngle.scala | 2 +- modules/puzzle/src/main/PuzzleCount.scala | 2 +- modules/puzzle/src/main/PuzzleFinisher.scala | 2 +- modules/puzzle/src/main/PuzzleHistory.scala | 2 +- modules/puzzle/src/main/PuzzleReplay.scala | 2 +- modules/puzzle/src/main/PuzzleStreak.scala | 2 +- modules/puzzle/src/main/PuzzleTheme.scala | 8 ++++---- modules/puzzle/src/main/ui/PuzzleBits.scala | 2 +- modules/puzzle/src/main/ui/PuzzleUi.scala | 2 +- modules/storm/src/main/StormSelector.scala | 2 +- public/images/puzzle-themes/{healthyMix.svg => mix.svg} | 0 translation/source/puzzleTheme.xml | 4 ++-- ui/@types/lichess/i18n.d.ts | 8 ++++---- 15 files changed, 22 insertions(+), 22 deletions(-) rename public/images/puzzle-themes/{healthyMix.svg => mix.svg} (100%) diff --git a/app/views/puzzle/dashboard.scala b/app/views/puzzle/dashboard.scala index 41d8a16c45fb1..0eaa181ca2ad9 100644 --- a/app/views/puzzle/dashboard.scala +++ b/app/views/puzzle/dashboard.scala @@ -19,7 +19,7 @@ object dashboard: )(dash => (dash.mostPlayed.size > 2).option( div(cls := s"${baseClass}__global")( - metricsOf(days, PuzzleTheme.healthyMix.key, dash.global), + metricsOf(days, PuzzleTheme.mix.key, dash.global), canvas(cls := s"${baseClass}__radar") ) ) diff --git a/modules/coreI18n/src/main/key.scala b/modules/coreI18n/src/main/key.scala index 5bb1465cd4446..44349d89f9f38 100644 --- a/modules/coreI18n/src/main/key.scala +++ b/modules/coreI18n/src/main/key.scala @@ -1322,8 +1322,8 @@ object I18nKey: val `xRayAttackDescription`: I18nKey = "puzzleTheme:xRayAttackDescription" val `zugzwang`: I18nKey = "puzzleTheme:zugzwang" val `zugzwangDescription`: I18nKey = "puzzleTheme:zugzwangDescription" - val `healthyMix`: I18nKey = "puzzleTheme:healthyMix" - val `healthyMixDescription`: I18nKey = "puzzleTheme:healthyMixDescription" + val `mix`: I18nKey = "puzzleTheme:mix" + val `mixDescription`: I18nKey = "puzzleTheme:mixDescription" val `playerGames`: I18nKey = "puzzleTheme:playerGames" val `playerGamesDescription`: I18nKey = "puzzleTheme:playerGamesDescription" val `puzzleDownloadInformation`: I18nKey = "puzzleTheme:puzzleDownloadInformation" diff --git a/modules/puzzle/src/main/PuzzleAngle.scala b/modules/puzzle/src/main/PuzzleAngle.scala index 6fc6fd2c3b218..131f573d60dfa 100644 --- a/modules/puzzle/src/main/PuzzleAngle.scala +++ b/modules/puzzle/src/main/PuzzleAngle.scala @@ -47,7 +47,7 @@ object PuzzleAngle: .orElse(LilaOpeningFamily.find(key).map(apply)) .orElse(SimpleOpening.find(key).map(apply)) - val mix: PuzzleAngle = apply(PuzzleTheme.healthyMix) + val mix: PuzzleAngle = apply(PuzzleTheme.mix) def findOrMix(key: String): PuzzleAngle = find(key) | mix diff --git a/modules/puzzle/src/main/PuzzleCount.scala b/modules/puzzle/src/main/PuzzleCount.scala index 44aa97157a372..b57ec5cac637d 100644 --- a/modules/puzzle/src/main/PuzzleCount.scala +++ b/modules/puzzle/src/main/PuzzleCount.scala @@ -39,4 +39,4 @@ final private class PuzzleCountApi( colls .puzzle(_.countAll) .map: all => - themed.toMap + (PuzzleTheme.healthyMix.key -> all.toInt) + themed.toMap + (PuzzleTheme.mix.key -> all.toInt) diff --git a/modules/puzzle/src/main/PuzzleFinisher.scala b/modules/puzzle/src/main/PuzzleFinisher.scala index d230a6755e2a8..fd4cf65e07025 100644 --- a/modules/puzzle/src/main/PuzzleFinisher.scala +++ b/modules/puzzle/src/main/PuzzleFinisher.scala @@ -184,7 +184,7 @@ final private[puzzle] class PuzzleFinisher( private def weightOf(angle: PuzzleAngle, win: PuzzleWin) = angle.asTheme.fold(1f): theme => - if theme == PuzzleTheme.healthyMix.key then 1 + if theme == PuzzleTheme.mix.key then 1 else if isObvious(theme) then if win.yes then 0.1f else 0.4f else if isHinting(theme) then if win.yes then 0.2f else 0.7f else if win.yes then 0.7f diff --git a/modules/puzzle/src/main/PuzzleHistory.scala b/modules/puzzle/src/main/PuzzleHistory.scala index 5051b9f935118..e45204f5d3b4f 100644 --- a/modules/puzzle/src/main/PuzzleHistory.scala +++ b/modules/puzzle/src/main/PuzzleHistory.scala @@ -47,7 +47,7 @@ object PuzzleHistory: for doc <- r round <- doc.asOpt[PuzzleRound] - theme = doc.getAsOpt[PuzzleTheme.Key](PuzzleRound.BSONFields.theme) | PuzzleTheme.healthyMix.key + theme = doc.getAsOpt[PuzzleTheme.Key](PuzzleRound.BSONFields.theme) | PuzzleTheme.mix.key puzzle <- doc.getAsOpt[Puzzle]("puzzle") yield SessionRound(round, puzzle, theme) .map(groupBySessions) diff --git a/modules/puzzle/src/main/PuzzleReplay.scala b/modules/puzzle/src/main/PuzzleReplay.scala index 2acec602d86c6..4455f09d9d11a 100644 --- a/modules/puzzle/src/main/PuzzleReplay.scala +++ b/modules/puzzle/src/main/PuzzleReplay.scala @@ -86,7 +86,7 @@ final class PuzzleReplayApi( $doc( "$match" -> $doc( $expr { - if theme == PuzzleTheme.healthyMix.key then $doc("$eq" -> $arr("$_id", "$$pid")) + if theme == PuzzleTheme.mix.key then $doc("$eq" -> $arr("$_id", "$$pid")) else $doc( $and( diff --git a/modules/puzzle/src/main/PuzzleStreak.scala b/modules/puzzle/src/main/PuzzleStreak.scala index 3bc1c5a943eb8..0a0a4e06af400 100644 --- a/modules/puzzle/src/main/PuzzleStreak.scala +++ b/modules/puzzle/src/main/PuzzleStreak.scala @@ -32,7 +32,7 @@ final class PuzzleStreakApi(colls: PuzzleColls, cacheApi: CacheApi)(using Execut 2799 -> 21 ) private val poolSize = buckets.map(_._2).sum - private val theme = lila.puzzle.PuzzleTheme.healthyMix.key + private val theme = lila.puzzle.PuzzleTheme.mix.key private val current = cacheApi.unit[Option[PuzzleStreak]]: _.refreshAfterWrite(30 seconds).buildAsyncFuture: _ => diff --git a/modules/puzzle/src/main/PuzzleTheme.scala b/modules/puzzle/src/main/PuzzleTheme.scala index db535726179db..a4d6e5bc05ef1 100644 --- a/modules/puzzle/src/main/PuzzleTheme.scala +++ b/modules/puzzle/src/main/PuzzleTheme.scala @@ -15,7 +15,7 @@ object PuzzleTheme: case class WithCount(theme: PuzzleTheme, count: Int) - val healthyMix = PuzzleTheme(i.healthyMix, i.healthyMixDescription) + val mix = PuzzleTheme(i.mix, i.mixDescription) val advancedPawn = PuzzleTheme(i.advancedPawn, i.advancedPawnDescription) val advantage = PuzzleTheme(i.advantage, i.advantageDescription) val anastasiaMate = PuzzleTheme(i.anastasiaMate, i.anastasiaMateDescription) @@ -85,7 +85,7 @@ object PuzzleTheme: val categorized = List[(I18nKey, List[PuzzleTheme])]( I18nKey.puzzle.recommended -> List( - healthyMix + mix ), I18nKey.puzzle.phases -> List( opening, @@ -233,10 +233,10 @@ object PuzzleTheme: theme.key -> id }.toMap - def apply(key: Key): PuzzleTheme = byKey.getOrElse(key, healthyMix) + def apply(key: Key): PuzzleTheme = byKey.getOrElse(key, mix) def find(key: String) = byLowerKey.get(key.toLowerCase) - def findOrMix(key: String) = find(key) | healthyMix + def findOrMix(key: String) = find(key) | mix def findDynamic(key: String) = find(key).filterNot(t => staticThemes(t.key)) diff --git a/modules/puzzle/src/main/ui/PuzzleBits.scala b/modules/puzzle/src/main/ui/PuzzleBits.scala index 1e56cbe470b2a..8b857160d4ffb 100644 --- a/modules/puzzle/src/main/ui/PuzzleBits.scala +++ b/modules/puzzle/src/main/ui/PuzzleBits.scala @@ -16,7 +16,7 @@ final class PuzzleBits(helpers: Helpers): chessgroundMini(fen, p.color, lastMove.some)(span) lazy val jsonThemes = PuzzleTheme.visible - .collect { case t if t != PuzzleTheme.healthyMix => t.key } + .collect { case t if t != PuzzleTheme.mix => t.key } .partition(PuzzleTheme.staticThemes.contains) match case (static, dynamic) => Json.obj( diff --git a/modules/puzzle/src/main/ui/PuzzleUi.scala b/modules/puzzle/src/main/ui/PuzzleUi.scala index 8c65326f40f44..d4966d998c3a6 100644 --- a/modules/puzzle/src/main/ui/PuzzleUi.scala +++ b/modules/puzzle/src/main/ui/PuzzleUi.scala @@ -104,7 +104,7 @@ final class PuzzleUi(helpers: Helpers, val bits: PuzzleBits)( div(cls := s"puzzle-themes__list ${cat.value.replace(":", "-")}")( themes.map: pt => val url = - if pt.theme == PuzzleTheme.healthyMix then routes.Puzzle.home + if pt.theme == PuzzleTheme.mix then routes.Puzzle.home else routes.Puzzle.show(pt.theme.key.value) a( cls := "puzzle-themes__link", diff --git a/modules/storm/src/main/StormSelector.scala b/modules/storm/src/main/StormSelector.scala index 67ef3c7541292..c156cfe46c0d4 100644 --- a/modules/storm/src/main/StormSelector.scala +++ b/modules/storm/src/main/StormSelector.scala @@ -15,7 +15,7 @@ final class StormSelector(colls: PuzzleColls, cacheApi: CacheApi)(using Executor def apply: Fu[List[StormPuzzle]] = current.get {} - private val theme = lila.puzzle.PuzzleTheme.healthyMix.key + private val theme = lila.puzzle.PuzzleTheme.mix.key private val tier = lila.puzzle.PuzzleTier.good.key private val maxDeviation = 85 diff --git a/public/images/puzzle-themes/healthyMix.svg b/public/images/puzzle-themes/mix.svg similarity index 100% rename from public/images/puzzle-themes/healthyMix.svg rename to public/images/puzzle-themes/mix.svg diff --git a/translation/source/puzzleTheme.xml b/translation/source/puzzleTheme.xml index e9515be548667..3ae2dd556eb57 100644 --- a/translation/source/puzzleTheme.xml +++ b/translation/source/puzzleTheme.xml @@ -119,8 +119,8 @@ A piece attacks or defends a square, through an enemy piece. Zugzwang The opponent is limited in the moves they can make, and all moves worsen their position. - Healthy mix - A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games. + Healthy mix + A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games. Player games Lookup puzzles generated from your games, or from another player's games. These puzzles are in the public domain, and can be downloaded from %s. diff --git a/ui/@types/lichess/i18n.d.ts b/ui/@types/lichess/i18n.d.ts index 4352705306642..d2aa99d7b45bd 100644 --- a/ui/@types/lichess/i18n.d.ts +++ b/ui/@types/lichess/i18n.d.ts @@ -2431,10 +2431,6 @@ interface I18n { hangingPiece: string; /** A tactic involving an opponent piece being undefended or insufficiently defended and free to capture. */ hangingPieceDescription: string; - /** Healthy mix */ - healthyMix: string; - /** A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games. */ - healthyMixDescription: string; /** Hook mate */ hookMate: string; /** Checkmate with a rook, knight, and pawn along with one enemy pawn to limit the enemy king's escape. */ @@ -2495,6 +2491,10 @@ interface I18n { middlegame: string; /** A tactic during the second phase of the game. */ middlegameDescription: string; + /** Healthy mix */ + mix: string; + /** A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games. */ + mixDescription: string; /** One-move puzzle */ oneMove: string; /** A puzzle that is only one move long. */