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'
| 'crazyhouse';
declare type Speed = 'bullet' | 'blitz' | 'classical' | 'correspondence' | 'unlimited';
declare type Speed = 'bullet' | 'blitz' | 'classical' | 'correspondence';
declare type Perf =
| 'bullet'

View File

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

View File

@ -1,5 +1,6 @@
import { h, VNode } from 'snabbdom';
import { numberFormat } from 'common/number';
import { perf } from 'game/perf';
import { bind, dataIcon, MaybeVNode } from 'common/snabbdom';
import { defined } from 'common';
import { view as renderConfig } from './explorerConfig';
@ -16,6 +17,7 @@ import {
Opening,
} from './interfaces';
import ExplorerCtrl from './explorerCtrl';
import { iconTag } from '../util';
function resultBar(move: OpeningMoveStats): VNode {
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;
const openedId = ctrl.explorer.gameMenu();
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(
'tbody',
{
@ -147,7 +149,17 @@ function showGameTable(ctrl: AnalyseCtrl, title: string, games: OpeningGame[]):
[game.white, game.black].map(p => h('span', p.name))
),
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;
winner?: Color;
year?: string;
month?: string;
speed?: Speed;
}
interface OpeningPlayer {

View File

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