From 86a6a0f0d6f94c0955eace88f0e72cfee598e74e Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 19 Oct 2021 18:50:52 +0200 Subject: [PATCH] more POE tweaks --- ui/@types/lichess/index.d.ts | 2 +- ui/analyse/src/explorer/explorerConfig.ts | 4 ++-- ui/analyse/src/explorer/explorerView.ts | 16 ++++++++++++++-- ui/analyse/src/explorer/interfaces.ts | 2 ++ ui/game/src/perf.ts | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/@types/lichess/index.d.ts b/ui/@types/lichess/index.d.ts index c999efdc0e..ab6ff1a6a3 100644 --- a/ui/@types/lichess/index.d.ts +++ b/ui/@types/lichess/index.d.ts @@ -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' diff --git a/ui/analyse/src/explorer/explorerConfig.ts b/ui/analyse/src/explorer/explorerConfig.ts index c0c2516dfb..ffdb4e77c6 100644 --- a/ui/analyse/src/explorer/explorerConfig.ts +++ b/ui/analyse/src/explorer/explorerConfig.ts @@ -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('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)), }, diff --git a/ui/analyse/src/explorer/explorerView.ts b/ui/analyse/src/explorer/explorerView.ts index ce3b3a9471..7fd4d59b07 100644 --- a/ui/analyse/src/explorer/explorerView.ts +++ b/ui/analyse/src/explorer/explorerView.ts @@ -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]), + }, + }) + ), ] ); }) diff --git a/ui/analyse/src/explorer/interfaces.ts b/ui/analyse/src/explorer/interfaces.ts index 5bbdd6887e..60debfd348 100644 --- a/ui/analyse/src/explorer/interfaces.ts +++ b/ui/analyse/src/explorer/interfaces.ts @@ -43,6 +43,8 @@ export interface OpeningGame { black: OpeningPlayer; winner?: Color; year?: string; + month?: string; + speed?: Speed; } interface OpeningPlayer { diff --git a/ui/game/src/perf.ts b/ui/game/src/perf.ts index a3a1f93ab6..110f15f8dd 100644 --- a/ui/game/src/perf.ts +++ b/ui/game/src/perf.ts @@ -3,7 +3,7 @@ export const perf = { ultraBullet: '', bullet: '', blitz: '', - rapid: '', + rapid: '', classical: '', correspondence: '', chess960: '',