diff --git a/custom_components/bahmcloud_store/panel/panel.js b/custom_components/bahmcloud_store/panel/panel.js new file mode 100644 index 0000000..12be78a --- /dev/null +++ b/custom_components/bahmcloud_store/panel/panel.js @@ -0,0 +1,25 @@ +class BahmcloudStorePanel extends HTMLElement { + set hass(hass) { + if (this._rendered) return; + this._rendered = true; + + const root = this.attachShadow({ mode: "open" }); + const iframe = document.createElement("iframe"); + + iframe.src = "/api/bahmcloud_store_static/index.html"; + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.border = "0"; + iframe.style.display = "block"; + + const style = document.createElement("style"); + style.textContent = ` + :host { display: block; height: 100vh; } + `; + + root.appendChild(style); + root.appendChild(iframe); + } +} + +customElements.define("bahmcloud-store-panel", BahmcloudStorePanel);