TS refactor

This commit is contained in:
Thibault Duplessis 2020-02-07 12:23:48 -06:00
parent 15fb891880
commit bf660208e3

View file

@ -155,12 +155,12 @@ function renderButtons(ctrl: RoundController) {
]);
}
function initMessage(d: RoundData, ctrl: RoundController) {
function initMessage(d: RoundData, trans: TransNoArg ) {
return (game.playable(d) && d.game.turns === 0 && !d.player.spectator) ?
h('div.message', util.justIcon(''), [
h('div', [
d.player.color === 'white' ? ctrl.trans.noarg('youPlayTheWhitePieces') : ctrl.trans.noarg('youPlayTheBlackPieces'),
...(d.player.color === 'white' ? [h('br'), h('strong', ctrl.trans.noarg('itsYourTurn'))] : [])
trans(d.player.color === 'white' ? 'youPlayTheWhitePieces' : 'youPlayTheBlackPieces'),
...(d.player.color === 'white' ? [h('br'), h('strong', trans('itsYourTurn'))] : [])
])
]) : null;
}
@ -204,7 +204,7 @@ export function render(ctrl: RoundController): VNode | undefined {
}, renderMoves(ctrl));
return ctrl.nvui ? undefined : h('div.rmoves', [
renderButtons(ctrl),
initMessage(d, ctrl) || (moves ? (
initMessage(d, ctrl.trans.noarg) || (moves ? (
col1 ? h('div.col1-moves', [
col1Button(ctrl, -1, 'Y', ctrl.ply == round.firstPly(d)),
moves,