Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ui/analyse/src/view/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { renderPgnError } from '../pgnImport';
import { storage } from 'lib/storage';
import { makeChat } from 'lib/chat/chat';
import { backToLiveView } from '../study/relay/relayView';
import { findTag } from '../study/studyChapters';

export interface ViewContext {
ctrl: AnalyseCtrl;
Expand Down Expand Up @@ -349,14 +350,14 @@ export function renderControls(ctrl: AnalyseCtrl) {
);
}

export function renderResult(ctrl: AnalyseCtrl, deps?: typeof studyDeps): VNode[] {
export function renderResult(ctrl: AnalyseCtrl): VNode[] {
const render = (result: string, status: VNodeKids) => [h('div.result', result), h('div.status', status)];
if (ctrl.data.game.status.id >= 30) {
const winner = ctrl.data.game.winner;
const result = winner === 'white' ? '1-0' : winner === 'black' ? '0-1' : '½-½';
return render(result, statusView(ctrl.data));
} else if (ctrl.study) {
const result = deps?.findTag(ctrl.study.data.chapter.tags, 'result');
const result = findTag(ctrl.study.data.chapter.tags, 'result');
if (!result || result === '*') return [];
if (result === '1-0') return render(result, [i18n.site.whiteIsVictorious]);
if (result === '0-1') return render(result, [i18n.site.blackIsVictorious]);
Expand Down