diff --git a/src/components/boards/EvalBar.tsx b/src/components/boards/EvalBar.tsx index 51d9e7ce..f3cfb7f1 100644 --- a/src/components/boards/EvalBar.tsx +++ b/src/components/boards/EvalBar.tsx @@ -78,7 +78,7 @@ function EvalBar({ - Math.min(Math.round(Math.abs(score.value) / 10) / 10, 99).toFixed(1), - ) + .with("cp", () => { + const absScore = Math.abs(score.value); + return ( + truncate + ? // idea from: https://github.com/lichess-org/lila/blob/e110605c138c1f6fec417ab9317968b32a928a16/ui/ceval/src/util.ts#L8 + Math.min(Math.round(absScore / 10) / 10, 99).toFixed(1) + : (absScore / 100).toFixed(2) + ).toString(); + }) .with("mate", () => `M${Math.abs(score.value)}`) .with("dtz", () => `DTZ${Math.abs(score.value)}`) .exhaustive();