more POE tweaks

openingexplorer3
Thibault Duplessis 2021-10-19 18:50:52 +02:00
parent 07b44ba69e
commit 86a6a0f0d6
5 changed files with 20 additions and 6 deletions

View File

@ -300,7 +300,7 @@ declare type VariantKey =
| 'racingKings' | 'racingKings'
| 'crazyhouse'; | 'crazyhouse';
declare type Speed = 'bullet' | 'blitz' | 'classical' | 'correspondence' | 'unlimited'; declare type Speed = 'bullet' | 'blitz' | 'classical' | 'correspondence';
declare type Perf = declare type Perf =
| 'bullet' | 'bullet'

View File

@ -34,7 +34,7 @@ export class ExplorerConfigCtrl {
constructor(readonly root: AnalyseCtrl, readonly variant: VariantKey, readonly onClose: () => void) { constructor(readonly root: AnalyseCtrl, readonly variant: VariantKey, readonly onClose: () => void) {
if (variant === 'standard') allDbs.unshift('masters'); if (variant === 'standard') allDbs.unshift('masters');
this.data = { this.data = {
open: prop(true), open: prop(false),
db: storedProp('explorer.db.' + variant, allDbs[0]), db: storedProp('explorer.db.' + variant, allDbs[0]),
rating: storedJsonProp('explorer.rating', () => allRatings), rating: storedJsonProp('explorer.rating', () => allRatings),
speed: storedJsonProp<ExplorerSpeed[]>('explorer.speed', () => allSpeeds), speed: storedJsonProp<ExplorerSpeed[]>('explorer.speed', () => allSpeeds),
@ -230,7 +230,7 @@ const playerModal = (ctrl: ExplorerConfigCtrl) => {
'div.previous', 'div.previous',
[...(myName ? [myName] : []), ...ctrl.data.playerName.previous()].map(name => [...(myName ? [myName] : []), ...ctrl.data.playerName.previous()].map(name =>
h( h(
'button.button', `button.button${name == myName ? '.button-green' : ''}`,
{ {
hook: bind('click', () => onSelect(name)), hook: bind('click', () => onSelect(name)),
}, },

View File

@ -1,5 +1,6 @@
import { h, VNode } from 'snabbdom'; import { h, VNode } from 'snabbdom';
import { numberFormat } from 'common/number'; import { numberFormat } from 'common/number';
import { perf } from 'game/perf';
import { bind, dataIcon, MaybeVNode } from 'common/snabbdom'; import { bind, dataIcon, MaybeVNode } from 'common/snabbdom';
import { defined } from 'common'; import { defined } from 'common';
import { view as renderConfig } from './explorerConfig'; import { view as renderConfig } from './explorerConfig';
@ -16,6 +17,7 @@ import {
Opening, Opening,
} from './interfaces'; } from './interfaces';
import ExplorerCtrl from './explorerCtrl'; import ExplorerCtrl from './explorerCtrl';
import { iconTag } from '../util';
function resultBar(move: OpeningMoveStats): VNode { function resultBar(move: OpeningMoveStats): VNode {
const sum = move.white + move.draws + move.black; const sum = move.white + move.draws + move.black;
@ -114,7 +116,7 @@ function showGameTable(ctrl: AnalyseCtrl, title: string, games: OpeningGame[]):
if (!ctrl.explorer.withGames || !games.length) return null; if (!ctrl.explorer.withGames || !games.length) return null;
const openedId = ctrl.explorer.gameMenu(); const openedId = ctrl.explorer.gameMenu();
return h('table.games', [ return h('table.games', [
h('thead', [h('tr', [h('th.title', { attrs: { colspan: 4 } }, title)])]), h('thead', [h('tr', [h('th.title', { attrs: { colspan: 5 } }, title)])]),
h( h(
'tbody', 'tbody',
{ {
@ -147,7 +149,17 @@ function showGameTable(ctrl: AnalyseCtrl, title: string, games: OpeningGame[]):
[game.white, game.black].map(p => h('span', p.name)) [game.white, game.black].map(p => h('span', p.name))
), ),
h('td', showResult(game.winner)), h('td', showResult(game.winner)),
h('td', [game.year]), h('td', game.year || game.month),
h(
'td',
game.speed &&
h('i', {
attrs: {
title: game.speed,
...dataIcon(perf.icons[game.speed]),
},
})
),
] ]
); );
}) })

View File

@ -43,6 +43,8 @@ export interface OpeningGame {
black: OpeningPlayer; black: OpeningPlayer;
winner?: Color; winner?: Color;
year?: string; year?: string;
month?: string;
speed?: Speed;
} }
interface OpeningPlayer { interface OpeningPlayer {

View File

@ -3,7 +3,7 @@ export const perf = {
ultraBullet: '', ultraBullet: '',
bullet: '', bullet: '',
blitz: '', blitz: '',
rapid: '', rapid: '',
classical: '', classical: '',
correspondence: '', correspondence: '',
chess960: '', chess960: '',