feat(mobile): hide quick search

This commit is contained in:
Elian Doran 2024-11-23 09:34:26 +02:00
parent 8a61b58970
commit d2d2620742
No known key found for this signature in database
2 changed files with 24 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import CommandButtonWidget from "../buttons/command_button.js";
import utils from "../../services/utils.js";
import TodayLauncher from "../buttons/launcher/today_launcher.js";
import HistoryNavigationButton from "../buttons/history_navigation.js";
import QuickSearchWidget from "../quick_search.js";
import QuickSearchLauncherWidget from "../quick_search_launcher.js";
export default class LauncherWidget extends BasicWidget {
constructor(isHorizontalLayout) {
@ -118,7 +118,7 @@ export default class LauncherWidget extends BasicWidget {
case "todayInJournal":
return new TodayLauncher(note);
case "quickSearch":
return this.isHorizontalLayout ? new QuickSearchWidget() : null;
return this.isHorizontalLayout ? new QuickSearchLauncherWidget() : null;
default:
throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`);
}

View File

@ -0,0 +1,22 @@
import utils from "../services/utils.js";
import QuickSearchWidget from "./quick_search.js";
/**
* Similar to the {@link QuickSearchWidget} but meant to be included inside the launcher bar.
*
* <p>
* Adds specific tweaks such as:
*
* - Hiding the widget on mobile.
*/
export default class QuickSearchLauncherWidget extends QuickSearchWidget {
isEnabled() {
if (utils.isMobile()) {
return false;
}
return super.isEnabled();
}
}