round: hide init message when col1 and no move list - fixes #9898

pull/9903/head
Thibault Duplessis 2021-09-29 09:32:19 +02:00
parent 87bfa0c755
commit d9732aaea2
1 changed files with 7 additions and 6 deletions

View File

@ -8,7 +8,7 @@ import throttle from 'common/throttle';
import viewStatus from 'game/view/status';
import { game as gameRoute } from 'game/router';
import { h, VNode } from 'snabbdom';
import { Step, MaybeVNodes, RoundData } from '../interfaces';
import { Step, MaybeVNodes } from '../interfaces';
const scrollMax = 99999,
moveTag = 'u8t',
@ -200,12 +200,13 @@ function renderButtons(ctrl: RoundController) {
);
}
function initMessage(d: RoundData, trans: TransNoArg) {
return game.playable(d) && d.game.turns === 0 && !d.player.spectator
function initMessage(ctrl: RoundController) {
const d = ctrl.data;
return (ctrl.replayEnabledByPref() || !isCol1()) && game.playable(d) && d.game.turns === 0 && !d.player.spectator
? h('div.message', util.justIcon(''), [
h('div', [
trans(d.player.color === 'white' ? 'youPlayTheWhitePieces' : 'youPlayTheBlackPieces'),
...(d.player.color === 'white' ? [h('br'), h('strong', trans('itsYourTurn'))] : []),
ctrl.trans(d.player.color === 'white' ? 'youPlayTheWhitePieces' : 'youPlayTheBlackPieces'),
...(d.player.color === 'white' ? [h('br'), h('strong', ctrl.trans('itsYourTurn'))] : []),
]),
])
: null;
@ -259,7 +260,7 @@ export function render(ctrl: RoundController): VNode | undefined {
? undefined
: h(rmovesTag, [
renderButtons(ctrl),
initMessage(d, ctrl.trans.noarg) ||
initMessage(ctrl) ||
(moves
? isCol1()
? h('div.col1-moves', [