From e41563bd7e402450b23223092c8f0150db9eff09 Mon Sep 17 00:00:00 2001 From: yahya lafhal Date: Sun, 15 Dec 2024 23:19:41 +0000 Subject: [PATCH] Use scss for hiding the side UI rating in game --- modules/round/src/main/JsonView.scala | 1 - ui/round/css/_user.scss | 3 +++ ui/round/src/interfaces.ts | 1 - ui/round/src/view/user.ts | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/round/src/main/JsonView.scala b/modules/round/src/main/JsonView.scala index 0ef2f54e5fcbe..bf7dc549e2de4 100644 --- a/modules/round/src/main/JsonView.scala +++ b/modules/round/src/main/JsonView.scala @@ -116,7 +116,6 @@ final class JsonView( .add("confirmResign" -> (!flags.nvui && pref.confirmResign == Pref.ConfirmResign.YES)) .add("keyboardMove" -> (!flags.nvui && pref.hasKeyboardMove)) .add("voiceMove" -> (!flags.nvui && pref.hasVoice)) - .add("hideRatingsInGame" -> pref.hideRatingsInGame) .add("rookCastle" -> (pref.rookCastle == Pref.RookCastle.YES)) .add("highlight" -> pref.highlight) .add("destination" -> pref.destination) diff --git a/ui/round/css/_user.scss b/ui/round/css/_user.scss index 9f557e045f141..d0b3512c6113a 100644 --- a/ui/round/css/_user.scss +++ b/ui/round/css/_user.scss @@ -26,6 +26,9 @@ margin: 0 0.25em 0 0.3em; color: $c-font-dim; letter-spacing: -0.5px; + body.no-rating & { + display: none; + } } .line { diff --git a/ui/round/src/interfaces.ts b/ui/round/src/interfaces.ts index 514ceb269ba86..16c4662476874 100644 --- a/ui/round/src/interfaces.ts +++ b/ui/round/src/interfaces.ts @@ -187,7 +187,6 @@ export interface Pref { highlight: boolean; is3d: boolean; keyboardMove: boolean; - hideRatingsInGame: boolean; voiceMove: boolean; moveEvent: Prefs.MoveEvent; ratings: boolean; diff --git a/ui/round/src/view/user.ts b/ui/round/src/view/user.ts index 5a47e68edc51d..561670e1b1ea0 100644 --- a/ui/round/src/view/user.ts +++ b/ui/round/src/view/user.ts @@ -10,7 +10,6 @@ export function userHtml(ctrl: RoundController, player: Player, position: Positi user = player.user, perf = (user?.perfs || {})[d.game.perf], rating = player.rating || perf?.rating, - showRating = d.pref.hideRatingsInGame ? !ctrl.isPlaying() : !!rating, signal = user?.id === d.opponent.user?.id ? d.opponentSignal : undefined; if (user) { @@ -43,7 +42,7 @@ export function userHtml(ctrl: RoundController, player: Player, position: Positi line: false, }), !!signal && signalBars(signal), - showRating && h('rating', rating + (player.provisional ? '?' : '')), + !!rating && h('rating', rating + (player.provisional ? '?' : '')), !!rating && ratingDiff(player), player.engine && h('span', {