diff --git a/custom_components/bahmcloud_store/panel/panel.js b/custom_components/bahmcloud_store/panel/panel.js index e88bd6c..6b8c023 100644 --- a/custom_components/bahmcloud_store/panel/panel.js +++ b/custom_components/bahmcloud_store/panel/panel.js @@ -40,26 +40,19 @@ class BahmcloudStorePanel extends HTMLElement { } } - // --- Mobile navigation helpers --- - _isDesktop() { - // If the viewport is wide enough, HA typically shows the sidebar permanently. - // We treat this as "desktop" and hide/disable the menu toggle. return window.matchMedia && window.matchMedia("(min-width: 1024px)").matches; } _toggleMenu() { - // On desktop the sidebar is usually always visible; do nothing. if (this._isDesktop()) return; - // Primary: dispatch the standard HA event from THIS element so it bubbles. try { const ev = new Event("hass-toggle-menu", { bubbles: true, composed: true }); this.dispatchEvent(ev); - return; // often enough on mobile + return; } catch (_) {} - // Secondary: try again via host/root try { const host = this.shadowRoot?.host; if (host) { @@ -69,44 +62,6 @@ class BahmcloudStorePanel extends HTMLElement { } } catch (_) {} - // Fallback DOM attempts - try { - const ha = document.querySelector("home-assistant"); - const haRoot = ha?.shadowRoot; - - const main = - haRoot?.querySelector("home-assistant-main") || - haRoot?.querySelector("home-assistant-main#main"); - - const mainRoot = main?.shadowRoot; - - const drawer = - mainRoot?.querySelector("mwc-drawer") || - mainRoot?.querySelector("ha-drawer") || - mainRoot?.querySelector("app-drawer-layout"); - - if (drawer) { - if ("open" in drawer) { - drawer.open = true; - return; - } - if (typeof drawer.toggleDrawer === "function") { - drawer.toggleDrawer(); - return; - } - } - - const layout = - mainRoot?.querySelector("ha-panel-lovelace") || - mainRoot?.querySelector("ha-panel"); - - if (layout && typeof layout.toggleMenu === "function") { - layout.toggleMenu(); - return; - } - } catch (_) {} - - // Only show an error on mobile if everything failed. this._error = "Unable to open the sidebar on this client. Use the back button."; this._update(); } @@ -170,189 +125,98 @@ class BahmcloudStorePanel extends HTMLElement { root.innerHTML = `
@@ -364,7 +228,6 @@ class BahmcloudStorePanel extends HTMLElement {
BCS — loading…
-
@@ -441,9 +304,14 @@ class BahmcloudStorePanel extends HTMLElement { ? `Custom` : `Index`; - const owner = r.owner ? `Owner: ${this._esc(r.owner)}` : "Owner: -"; - const provider = r.provider ? `Provider: ${this._esc(r.provider)}` : "Provider: -"; - const desc = r.description || "No description available."; + const desc = r.meta_description || r.provider_description || "No description available."; + + const creator = r.owner ? `Creator: ${this._esc(r.owner)}` : "Creator: -"; + const author = r.meta_author ? `Author: ${this._esc(r.meta_author)}` : null; + const maint = r.meta_maintainer ? `Maintainer: ${this._esc(r.meta_maintainer)}` : null; + const metaSrc = r.meta_source ? `Meta: ${this._esc(r.meta_source)}` : null; + + const lineBits = [creator, author, maint, metaSrc].filter(Boolean); return `
@@ -451,7 +319,7 @@ class BahmcloudStorePanel extends HTMLElement {
${this._esc(r.name)}
${this._esc(desc)}
-
${owner} · ${provider}
+
${lineBits.map(x => this._esc(x)).join(" · ")}
${badge}