Notation: the review's mark right after the move, in its color; no reasons
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

As on Lichess: «Qg7??» in red instead of a pill at the cell's edge, on the
desktop and on Android; the author's own sign stands instead when there is one.
!! and ! get no block under the move (the reason line was more than needed).
Task 18: a shorter draw-offer button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-28 01:00:29 +03:00
parent 1aa85f59d3
commit 424c7830e7
16 changed files with 46 additions and 116 deletions

View file

@ -357,9 +357,9 @@ private fun MoveCell(
onLongMove: ((Int) -> Unit)?,
) {
val selected = id != null && id == current
// The engine's mark is left out where the author already put the same sign ("Nf6? ?"
// reads as a typo, §21.4).
val mark = mark?.takeIf { m -> id == null || game.nodes[id].nags.none { it.toInt() == judgementNag(m) } }
// The engine's mark stands right after the move, the move in its color (as on Lichess);
// where the author already gave the move a sign, the author's sign stands instead.
val mark = mark?.takeIf { id == null || game.nodes[id].nags.none { (it.toInt() and 0xFF) in 1..6 } }
// TalkBack reads "4, White, dxe5", the engine's judgement, and whether it is the
// current move.
val markName = mark?.let { judgementName(it) }
@ -411,7 +411,11 @@ private fun MoveCell(
.padding(horizontal = 8.dp, vertical = 6.dp),
horizontalArrangement = Arrangement.spacedBy(1.dp),
) {
Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onSurface)
val markColor = mark?.takeIf { !selected }?.let { judgementColor(it, chess.dark) }
Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface)
if (mark != null) {
Text(judgementSymbol(mark), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface)
}
if (n.nagSymbols.isNotEmpty()) {
Text(
n.nagSymbols,
@ -425,7 +429,6 @@ private fun MoveCell(
)
}
}
if (mark != null) ReviewBadge(mark, Modifier.padding(start = 2.dp))
}
}
}

View file

@ -125,14 +125,6 @@ fun judgementName(j: MoveJudgement): String = stringResource(
},
)
/// Why a move of note is one (none for an error).
@Composable
fun judgementReason(j: MoveJudgement): String? = when (j) {
MoveJudgement.BRILLIANT -> stringResource(R.string.review_why_brilliant)
MoveJudgement.GREAT -> stringResource(R.string.review_why_great)
else -> null
}
@Composable
private fun judgementPlural(j: MoveJudgement): String = stringResource(
when (j) {
@ -144,23 +136,6 @@ private fun judgementPlural(j: MoveJudgement): String = stringResource(
},
)
/// The engine's mark after a main-line move in the notation (§21.4): a layer of its own,
/// apart from the author's NAGs.
@Composable
fun ReviewBadge(j: MoveJudgement, modifier: Modifier = Modifier) {
val c = judgementColor(j, LocalChessColors.current.dark)
Text(
judgementSymbol(j),
fontSize = 13.sp,
fontWeight = FontWeight.Bold,
color = c,
modifier = modifier
.clip(RoundedCornerShape(4.dp))
.background(c.copy(alpha = 0.16f))
.padding(horizontal = 4.dp, vertical = 1.dp),
)
}
/// The place in `state.points` of a node: itself on the main line, or the main-line move
/// its variation leaves from.
fun pointIndex(points: Map<Int, Int>, game: GameData, node: Int): Int? {
@ -228,7 +203,6 @@ fun ReviewPanel(
val link = MaterialTheme.colorScheme.primary
val text = buildAnnotatedString {
withStyle(SpanStyle(color = c, fontWeight = FontWeight.Bold)) { append(judgementSymbol(mark.judgement) + " " + name) }
judgementReason(mark.judgement)?.let { append(" · "); append(it) }
if (better != null && betterText != null) {
append(" · ")
append(betterText.first())

View file

@ -251,8 +251,6 @@
<string name="review_brilliant">Brillanter Zug</string>
<string name="review_greats">Starke Züge</string>
<string name="review_brilliants">Brillante Züge</string>
<string name="review_why_brilliant">Ein korrektes Opfer</string>
<string name="review_why_great">Der einzige gute Zug</string>
<string name="review_missing">Ohne Bewertung: %d</string>
<string name="review_failed">Die Analyse wurde unterbrochen</string>
<string name="review_resume">Fortsetzen</string>

View file

@ -255,8 +255,6 @@
<string name="review_brilliant">Jugada brillante</string>
<string name="review_greats">Grandes jugadas</string>
<string name="review_brilliants">Jugadas brillantes</string>
<string name="review_why_brilliant">Un sacrificio correcto</string>
<string name="review_why_great">La única buena jugada</string>
<string name="review_missing">Sin evaluar: %d</string>
<string name="review_failed">El análisis se interrumpió</string>
<string name="review_resume">Continuar</string>

View file

@ -255,8 +255,6 @@
<string name="review_brilliant">Coup brillant</string>
<string name="review_greats">Excellents coups</string>
<string name="review_brilliants">Coups brillants</string>
<string name="review_why_brilliant">Un sacrifice correct</string>
<string name="review_why_great">Le seul bon coup</string>
<string name="review_missing">Non évaluées : %d</string>
<string name="review_failed">L\'analyse s\'est interrompue</string>
<string name="review_resume">Continuer</string>

View file

@ -255,8 +255,6 @@
<string name="review_brilliant">Mossa brillante</string>
<string name="review_greats">Ottime mosse</string>
<string name="review_brilliants">Mosse brillanti</string>
<string name="review_why_brilliant">Un sacrificio corretto</string>
<string name="review_why_great">L\'unica buona mossa</string>
<string name="review_missing">Non valutate: %d</string>
<string name="review_failed">L\'analisi si è interrotta</string>
<string name="review_resume">Continua</string>

View file

@ -251,8 +251,6 @@
<string name="review_brilliant">Тамаша жүріс</string>
<string name="review_greats">Мықты жүрістер</string>
<string name="review_brilliants">Тамаша жүрістер</string>
<string name="review_why_brilliant">Дұрыс құрбандық</string>
<string name="review_why_great">Жалғыз жақсы жүріс</string>
<string name="review_missing">Бағаланбаған: %d</string>
<string name="review_failed">Талдау тоқтап қалды</string>
<string name="review_resume">Жалғастыру</string>

View file

@ -255,8 +255,6 @@
<string name="review_brilliant">Lance brilhante</string>
<string name="review_greats">Ótimos lances</string>
<string name="review_brilliants">Lances brilhantes</string>
<string name="review_why_brilliant">Um sacrifício correto</string>
<string name="review_why_great">O único lance bom</string>
<string name="review_missing">Não avaliadas: %d</string>
<string name="review_failed">A análise parou</string>
<string name="review_resume">Continuar</string>

View file

@ -259,8 +259,6 @@
<string name="review_brilliant">Блестящий ход</string>
<string name="review_greats">Отличные ходы</string>
<string name="review_brilliants">Блестящие ходы</string>
<string name="review_why_brilliant">Корректная жертва</string>
<string name="review_why_great">Единственный хороший ход</string>
<string name="review_missing">Без оценки: %d</string>
<string name="review_failed">Анализ прервался</string>
<string name="review_resume">Продолжить</string>

View file

@ -251,8 +251,6 @@
<string name="review_brilliant">Ajoyib yurish</string>
<string name="review_greats">Kuchli yurishlar</string>
<string name="review_brilliants">Ajoyib yurishlar</string>
<string name="review_why_brilliant">Toʻgʻri qurbonlik</string>
<string name="review_why_great">Yagona yaxshi yurish</string>
<string name="review_missing">Baholanmagan: %d</string>
<string name="review_failed">Tahlil toʻxtadi</string>
<string name="review_resume">Davom etish</string>

View file

@ -254,8 +254,6 @@
<string name="review_brilliant">Brilliant move</string>
<string name="review_greats">Great moves</string>
<string name="review_brilliants">Brilliant moves</string>
<string name="review_why_brilliant">A sound sacrifice</string>
<string name="review_why_great">The only good move</string>
<string name="review_missing">Not evaluated: %d</string>
<string name="review_failed">The analysis stopped</string>
<string name="review_resume">Continue</string>