2024-11-23 09:34:26 +02:00
|
|
|
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.
|
2025-01-09 18:07:02 +02:00
|
|
|
*
|
2024-11-23 09:34:26 +02:00
|
|
|
* <p>
|
|
|
|
* Adds specific tweaks such as:
|
2025-01-09 18:07:02 +02:00
|
|
|
*
|
2024-11-23 09:34:26 +02:00
|
|
|
* - Hiding the widget on mobile.
|
|
|
|
*/
|
|
|
|
export default class QuickSearchLauncherWidget extends QuickSearchWidget {
|
2025-02-11 19:16:11 +02:00
|
|
|
|
|
|
|
private isHorizontalLayout: boolean;
|
|
|
|
|
|
|
|
constructor(isHorizontalLayout: boolean) {
|
2024-11-23 09:37:24 +02:00
|
|
|
super();
|
|
|
|
this.isHorizontalLayout = isHorizontalLayout;
|
|
|
|
}
|
|
|
|
|
2024-11-23 09:34:26 +02:00
|
|
|
isEnabled() {
|
2024-11-23 09:37:24 +02:00
|
|
|
if (!this.isHorizontalLayout) {
|
|
|
|
// The quick search widget is added somewhere else on the vertical layout.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-11-23 09:34:26 +02:00
|
|
|
if (utils.isMobile()) {
|
2024-11-23 09:37:24 +02:00
|
|
|
// The widget takes too much spaces to be included in the mobile layout.
|
2024-11-23 09:34:26 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.isEnabled();
|
|
|
|
}
|
2025-01-09 18:07:02 +02:00
|
|
|
}
|