From 1aa7469fbe1b26cd85565c0e8ecf152234614259 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Wed, 28 Aug 2024 12:29:35 +0200 Subject: [PATCH] update seek creation UI --- ui/lobby/src/view/setup/components/colorButtons.ts | 11 ++++++----- ui/lobby/src/view/setup/modal.ts | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/lobby/src/view/setup/components/colorButtons.ts b/ui/lobby/src/view/setup/components/colorButtons.ts index 6f327777b22c..da7b39e2fc13 100644 --- a/ui/lobby/src/view/setup/components/colorButtons.ts +++ b/ui/lobby/src/view/setup/components/colorButtons.ts @@ -27,7 +27,7 @@ const renderBlindModeColorPicker = (ctrl: LobbyController) => [ ), ]; -export const colorButtons = (ctrl: LobbyController) => { +export const createButtons = (ctrl: LobbyController) => { const { setupCtrl } = ctrl; const enabledColors: (Color | 'random')[] = []; @@ -35,9 +35,10 @@ export const colorButtons = (ctrl: LobbyController) => { enabledColors.push('random'); const randomColorOnly = - setupCtrl.gameType !== 'ai' && - setupCtrl.gameMode() === 'rated' && - variantsWhereWhiteIsBetter.includes(setupCtrl.variant()); + setupCtrl.gameType === 'hook' || + (setupCtrl.gameType !== 'ai' && + setupCtrl.gameMode() === 'rated' && + variantsWhereWhiteIsBetter.includes(setupCtrl.variant())); if (!randomColorOnly) enabledColors.push('white', 'black'); } @@ -52,7 +53,7 @@ export const colorButtons = (ctrl: LobbyController) => { `button.button.button-metal.color-submits__button.${key}`, { attrs: { disabled: !enabledColors.includes(key), title: name, value: key }, - on: { click: () => ctrl.setupCtrl.submit(key) }, + on: { click: () => setupCtrl.submit(key) }, }, h('i'), ), diff --git a/ui/lobby/src/view/setup/modal.ts b/ui/lobby/src/view/setup/modal.ts index 5d5f23157106..c3ecb0b0b53e 100644 --- a/ui/lobby/src/view/setup/modal.ts +++ b/ui/lobby/src/view/setup/modal.ts @@ -7,7 +7,7 @@ import { variantPicker } from './components/variantPicker'; import { timePickerAndSliders } from './components/timePickerAndSliders'; import { gameModeButtons } from './components/gameModeButtons'; import { ratingDifferenceSliders } from './components/ratingDifferenceSliders'; -import { colorButtons } from './components/colorButtons'; +import { createButtons } from './components/colorButtons'; import { ratingView } from './components/ratingView'; import { fenInput } from './components/fenInput'; import { levelButtons } from './components/levelButtons'; @@ -31,7 +31,7 @@ const views = { timePickerAndSliders(ctrl), gameModeButtons(ctrl), ratingDifferenceSliders(ctrl), - colorButtons(ctrl), + createButtons(ctrl), ]), ], friend: (ctrl: LobbyController): MaybeVNodes => [ @@ -42,7 +42,7 @@ const views = { fenInput(ctrl), timePickerAndSliders(ctrl, true), gameModeButtons(ctrl), - colorButtons(ctrl), + createButtons(ctrl), ]), ], ai: (ctrl: LobbyController): MaybeVNodes => [ @@ -52,7 +52,7 @@ const views = { fenInput(ctrl), timePickerAndSliders(ctrl, true), ...levelButtons(ctrl), - colorButtons(ctrl), + createButtons(ctrl), ]), ], };