From 55989c3e67f914073fbeac2506d3c10098f4e46f Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Thu, 27 Apr 2017 11:46:45 +0200 Subject: [PATCH] more ui/round tweaks --- app/views/round/jsI18n.scala.html | 1 - ui/round2/src/view/replay.ts | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/views/round/jsI18n.scala.html b/app/views/round/jsI18n.scala.html index 4512813726..a68f99042c 100644 --- a/app/views/round/jsI18n.scala.html +++ b/app/views/round/jsI18n.scala.html @@ -37,7 +37,6 @@ trans.threeChecks, trans.variantEnding, trans.backToTournament, trans.withdraw, -trans.joinTheGame, trans.rematch, trans.rematchOfferSent, trans.rematchOfferAccepted, diff --git a/ui/round2/src/view/replay.ts b/ui/round2/src/view/replay.ts index 6cb7ae9fc9..433bb5f0eb 100644 --- a/ui/round2/src/view/replay.ts +++ b/ui/round2/src/view/replay.ts @@ -77,18 +77,18 @@ function renderMoves(ctrl) { if (typeof lastPly === 'undefined') return []; const pairs: Array> = []; - if (firstPly % 2 === 0) - for (var i = 1, len = steps.length; i < len; i += 2) pairs.push([steps[i], steps[i + 1]]); - else { + let startAt = 1; + if (firstPly % 2 === 1) { pairs.push([null, steps[1]]); - for (var i = 2, len = steps.length; i < len; i += 2) pairs.push([steps[i], steps[i + 1]]); + startAt = 2; } + for (var i = startAt; i < steps.length; i += 2) pairs.push([steps[i], steps[i + 1]]); - var els: Array = []; + const els: Array = [], curPly = ctrl.vm.ply; for (var i = 0; i < pairs.length; i++) { els.push(h('index', i + 1 + '')); - els.push(renderMove(pairs[i][0], ctrl.vm.ply, true)); - els.push(renderMove(pairs[i][1], ctrl.vm.ply, false)); + els.push(renderMove(pairs[i][0], curPly, true)); + els.push(renderMove(pairs[i][1], curPly, false)); } els.push(renderResult(ctrl)); @@ -176,13 +176,10 @@ function renderButtons(ctrl) { ['V', lastPly] ].map((b, i) => { const enabled = ctrl.vm.ply !== b[1] && b[1] >= firstPly && b[1] <= lastPly; - return h('button', { - class: { - fbt: true, - glowed: i === 3 && ctrl.isLate() - }, + return h('button.fbt', { + class: { glowed: i === 3 && ctrl.isLate() }, attrs: { - disabled: ctrl.broken || !enabled, + disabled: !enabled, 'data-icon': b[0], 'data-ply': enabled ? b[1] : '-' }