export function renderResult(ctrl: RoundController): VNode | undefined { let result; if (status.finished(ctrl.data)) switch (ctrl.data.game.winner) { case 'white': result = '1-0'; break; case 'black': result = '0-1'; break; default: result = '½-½'; } if (result || status.aborted(ctrl.data)) { const winner = game.getPlayer(ctrl.data, ctrl.data.game.winner); return h('div.result_wrap', [ result ? h('p.result', result) : null, h('p.status', { hook: { insert: _ => { if (ctrl.autoScroll) ctrl.autoScroll(); else setTimeout(() => ctrl.autoScroll(), 200); } } }, [ h('div', viewStatus(ctrl)), winner ? h('div', ctrl.trans.noarg(winner.color + 'IsVictorious')) : null ]) ]); } return; }
function renderPlayer(ctrl: AnalyseCtrl, color: Color): VNode { const p = game.getPlayer(ctrl.data, color); if (p.user) return h('a.user-link.ulpt', { attrs: { href: '/@/' + p.user.username } }, [ p.user.username, ' ', renderRatingDiff(p.ratingDiff) ]); return h('span', p.name || (p.ai && 'Stockfish level ' + p.ai) || (ctrl.study && findTag(ctrl.study.data.chapter.tags, color)) || 'Anonymous'); }
function renderResult(ctrl: AnalyseCtrl): VNode[] { let result: string | undefined; if (ctrl.data.game.status.id >= 30) switch (ctrl.data.game.winner) { case 'white': result = '1-0'; break; case 'black': result = '0-1'; break; default: result = '½-½'; } const tags: VNode[] = []; if (result) { tags.push(h('div.result', result)); const winner = getPlayer(ctrl.data, ctrl.data.game.winner!); tags.push(h('div.status', [ statusView(ctrl), winner ? ', ' + ctrl.trans(winner.color == 'white' ? 'whiteIsVictorious' : 'blackIsVictorious') : null ])); } return tags; }