more ui/round tweaks

This commit is contained in:
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.variantEnding,
trans.backToTournament, trans.backToTournament,
trans.withdraw, trans.withdraw,
trans.joinTheGame,
trans.rematch, trans.rematch,
trans.rematchOfferSent, trans.rematchOfferSent,
trans.rematchOfferAccepted, trans.rematchOfferAccepted,

View file

@ -77,18 +77,18 @@ function renderMoves(ctrl) {
if (typeof lastPly === 'undefined') return []; if (typeof lastPly === 'undefined') return [];
const pairs: Array<Array<any>> = []; const pairs: Array<Array<any>> = [];
if (firstPly % 2 === 0) let startAt = 1;
for (var i = 1, len = steps.length; i < len; i += 2) pairs.push([steps[i], steps[i + 1]]); if (firstPly % 2 === 1) {
else {
pairs.push([null, steps[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++) { for (var i = 0; i < pairs.length; i++) {
els.push(h('index', i + 1 + '')); els.push(h('index', i + 1 + ''));
els.push(renderMove(pairs[i][0], ctrl.vm.ply, true)); els.push(renderMove(pairs[i][0], curPly, true));
els.push(renderMove(pairs[i][1], ctrl.vm.ply, false)); els.push(renderMove(pairs[i][1], curPly, false));
} }
els.push(renderResult(ctrl)); els.push(renderResult(ctrl));
@ -176,13 +176,10 @@ function renderButtons(ctrl) {
['V', lastPly] ['V', lastPly]
].map((b, i) => { ].map((b, i) => {
const enabled = ctrl.vm.ply !== b[1] && b[1] >= firstPly && b[1] <= lastPly; const enabled = ctrl.vm.ply !== b[1] && b[1] >= firstPly && b[1] <= lastPly;
return h('button', { return h('button.fbt', {
class: { class: { glowed: i === 3 && ctrl.isLate() },
fbt: true,
glowed: i === 3 && ctrl.isLate()
},
attrs: { attrs: {
disabled: ctrl.broken || !enabled, disabled: !enabled,
'data-icon': b[0], 'data-icon': b[0],
'data-ply': enabled ? b[1] : '-' 'data-ply': enabled ? b[1] : '-'
} }