From 06e9a791de0cd25d5c7c39f9cc838773100ace31 Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Wed, 9 Oct 2024 13:16:58 -0700 Subject: [PATCH] [twizzle/edit] Improve UX if you keep changing notation when auto-notation is disabled. --- src/sites/alpha.twizzle.net/edit/app.ts | 40 ++++++++++----------- src/sites/alpha.twizzle.net/edit/index.html | 2 +- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/sites/alpha.twizzle.net/edit/app.ts b/src/sites/alpha.twizzle.net/edit/app.ts index 979c48aa9..c35653838 100644 --- a/src/sites/alpha.twizzle.net/edit/app.ts +++ b/src/sites/alpha.twizzle.net/edit/app.ts @@ -158,10 +158,6 @@ export class App { #autofixEnabled: boolean = true; // TODO: factor this out into a class async #onSetupOrAlgChange() { - console.log(this.#autofixEnabled); - if (!this.#autofixEnabled) { - return; - } (async () => { const [originalPuzzleID, puzzleAlgWithIssue, puzzleSetupAlgWithIssue] = await Promise.all([ @@ -195,29 +191,31 @@ export class App { this.#autoNotationPuzzleOld = originalPuzzleID; this.#autoNotationPuzzleNew = puzzleID; - for (const elem of this.element.querySelectorAll( - ".auto-notation-puzzle-old", - )) { - elem.textContent = puzzles[originalPuzzleID].fullName; - } for (const elem of this.element.querySelectorAll( ".auto-notation-puzzle-new", )) { elem.textContent = puzzleLoader.fullName; } - this.element.querySelector( - ".auto-notation", - )!.hidden = false; - this.element.querySelector( - ".auto-notation-change-back", - )!.hidden = false; - this.element.querySelector( - ".auto-notation-change-redo", - )!.hidden = true; - - this.controlPane.puzzleSelect.value = puzzleID; - this.controlPane.puzzleSelectChanged(); + if (this.#autofixEnabled) { + for (const elem of this.element.querySelectorAll( + ".auto-notation-puzzle-old", + )) { + elem.textContent = puzzles[originalPuzzleID].fullName; + } + this.element.querySelector( + ".auto-notation", + )!.hidden = false; + this.element.querySelector( + ".auto-notation-change-back", + )!.hidden = false; + this.element.querySelector( + ".auto-notation-change-redo", + )!.hidden = true; + + this.controlPane.puzzleSelect.value = puzzleID; + this.controlPane.puzzleSelectChanged(); + } return; } } catch {} diff --git a/src/sites/alpha.twizzle.net/edit/index.html b/src/sites/alpha.twizzle.net/edit/index.html index fb52eb3df..12be3b911 100644 --- a/src/sites/alpha.twizzle.net/edit/index.html +++ b/src/sites/alpha.twizzle.net/edit/index.html @@ -33,7 +33,7 @@ back to ?Auto-detection has been temporarily disabled. Want to re-enable it and change the puzzle to - to again?) + to ?)