Skip to content

Conversation

@stdolan
Copy link
Contributor

@stdolan stdolan commented May 12, 2023

Fixes #12209

For Swiss tournament games, this PR:

  1. Dims and disables the claim draw on 3-fold repetition button.
  2. Adds a tooltip explaining why for that case and for the normal draw button.

Here's what the UI on a 3-fold looks like:
image

I haven't figured out how to take a screenshot of the tooltip, any help would be appreciated on that.

const enabled = () => !condition || condition(ctrl.data).enabled;
const hintFn = () => {
if (!condition) return hint;
return condition(ctrl.data)?.overrideHint || hint;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually do condition.?(..) here to avoid the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, fixed!

{
hook: util.bind('click', () => ctrl.socket.sendLoading('draw-claim')),
attrs: { title: ctrl.noarg('claimADraw') },
hook: util.bind('click', () => (condition(ctrl.data).enabled ? ctrl.socket.sendLoading('draw-claim') : () => {})),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you actually want a () => {} here? Just undefined should work, or maybe better to just use an if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, fixed.

stdolan and others added 3 commits May 13, 2023 14:27
* master: (28 commits)
  Revet changes to uniboard default width
  Fix uniboard overflow
  rename UciToSan
  code golf
  add puzzle data to /api/puzzle/activity
  remove superfluous route (use /api/puzzle/activity instead)
  add ?before= to /api/user/puzzle-activity
  delete unused /training/mobile/history
  provide explorer cache hint also for /opening
  scala code golf
  avoid using Map.head
  Change empty message on explorer max depth
  fix analysis / change voice icon
  yarn run format
  make ExplorerCtrl.cacheUseful a prop
  provide hint to avoid clobbering explorer cache
  JsDump.translatedJs: no quantity if there's only 1
  3 column layout fix
  update critical, de dict
  fix racer websocket connection - broken by dda3f64
  ...
@ornicar ornicar merged commit c6f9487 into lichess-org:master May 14, 2023
@stdolan stdolan deleted the swiss-3-fold-and-tooltip branch May 15, 2023 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3-fold claim shown in swiss before move 30 even though it's not possible

3 participants