more ui/round tweaks

round2
Thibault Duplessis 2017-04-27 11:46:45 +02:00
parent ba27006b45
commit 55989c3e67
2 changed files with 10 additions and 14 deletions

View File

@ -37,7 +37,6 @@ trans.threeChecks,
trans.variantEnding,
trans.backToTournament,
trans.withdraw,
trans.joinTheGame,
trans.rematch,
trans.rematchOfferSent,
trans.rematchOfferAccepted,

View File

@ -77,18 +77,18 @@ function renderMoves(ctrl) {
if (typeof lastPly === 'undefined') return [];
const pairs: Array<Array<any>> = [];
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<VNode | undefined> = [];
const els: Array<VNode | undefined> = [], 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] : '-'
}