From f1257ea35682274523dd7b70c1fb7551519035e2 Mon Sep 17 00:00:00 2001 From: Robin Scholtes Date: Tue, 9 May 2023 18:42:14 +1200 Subject: [PATCH] bit of refactoring --- src/web/App.mjs | 16 ++++++---------- src/web/TODO.md | 1 - src/web/waiters/OperationsWaiter.mjs | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/web/App.mjs b/src/web/App.mjs index be1cc4df..46b01979 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -330,7 +330,11 @@ class App { } /** - * Set mobile splitters + * Set mobile layout + * + * We don't actually use splitters on mobile, but we leverage the splitters + * to create our desired layout. This prevents some problems when resizing + * from mobile to desktop and vice versa */ setMobileSplitter() { if (this.columnSplitter) this.columnSplitter.destroy(); @@ -860,15 +864,7 @@ class App { * */ updateVisibility( elm, isVisible ){ - if ( isVisible ) { - if ( elm.classList.contains("hidden")) { - elm.classList.remove("hidden"); - } - } else if ( isVisible === false ) { - if ( !elm.classList.contains("hidden")){ - elm.classList.add("hidden"); - } - } + isVisible ? elm.classList.remove("hidden") : elm.classList.add("hidden"); } /** diff --git a/src/web/TODO.md b/src/web/TODO.md index 322a8980..56ad5fc9 100644 --- a/src/web/TODO.md +++ b/src/web/TODO.md @@ -7,7 +7,6 @@ - need long press checks on mobile to add favourites ( recipe is done ) > - check on window resizing -- raw bites dropup thingy is unusable - shannon entropy thingies - backspace on fs view should close max view. Keep making the same mistake and navigating away when for instance recipe is expanded and double click the window to fs > resolve. Reset layout diff --git a/src/web/waiters/OperationsWaiter.mjs b/src/web/waiters/OperationsWaiter.mjs index 471b781d..9d8e971b 100755 --- a/src/web/waiters/OperationsWaiter.mjs +++ b/src/web/waiters/OperationsWaiter.mjs @@ -346,9 +346,9 @@ class OperationsWaiter { search.value = ''; } - this.app.updateVisibility(document.getElementById( "categories"), false ); - this.app.updateVisibility(document.getElementById( "search-results"), false ); - this.app.updateVisibility(document.getElementById("close-operations-dropdown"), false ); + this.app.updateVisibility(document.getElementById("categories"), false); + this.app.updateVisibility(document.getElementById("search-results"), false); + this.app.updateVisibility(document.getElementById("close-operations-dropdown"), false); } /**