Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
09aaa0d55f Move narrow and dockedSidebar check into webui_ha_aware conditional
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-10-13 14:22:01 +00:00
copilot-swe-agent[bot]
baa049ea7a Add webui_ha_aware property to HassioAddonDetails and implement sidebar toggle support
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
2025-10-13 13:26:32 +00:00
copilot-swe-agent[bot]
e16037a712 Initial plan 2025-10-13 13:16:13 +00:00
2 changed files with 33 additions and 11 deletions

View File

@@ -46,9 +46,22 @@ class HassioIngressView extends LitElement {
private _fetchDataTimeout?: number;
private _messageListener = (ev: MessageEvent) => {
if (this._addon?.webui_ha_aware && ev.data?.type === "toggle-sidebar") {
this._toggleMenu();
}
};
public connectedCallback() {
super.connectedCallback();
window.addEventListener("message", this._messageListener);
}
public disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener("message", this._messageListener);
if (this._sessionKeepAlive) {
clearInterval(this._sessionKeepAlive);
this._sessionKeepAlive = undefined;
@@ -83,17 +96,25 @@ class HassioIngressView extends LitElement {
</hass-subpage>`;
}
return html`${this.narrow || this.hass.dockedSidebar === "always_hidden"
? html`<div class="header">
<ha-icon-button
.label=${this.hass.localize("ui.sidebar.sidebar_toggle")}
.path=${mdiMenu}
@click=${this._toggleMenu}
></ha-icon-button>
<div class="main-title">${this._addon.name}</div>
</div>
${iframe}`
: iframe}`;
// If webui_ha_aware is true, or if narrow or sidebar is always hidden,
// don't render the header and just render the iframe
if (
this._addon.webui_ha_aware ||
this.narrow ||
this.hass.dockedSidebar === "always_hidden"
) {
return iframe;
}
return html`<div class="header">
<ha-icon-button
.label=${this.hass.localize("ui.sidebar.sidebar_toggle")}
.path=${mdiMenu}
@click=${this._toggleMenu}
></ha-icon-button>
<div class="main-title">${this._addon.name}</div>
</div>
${iframe}`;
}
protected async firstUpdated(): Promise<void> {

View File

@@ -112,6 +112,7 @@ export interface HassioAddonDetails extends HassioAddonInfo {
translations: Record<string, AddonTranslations>;
watchdog: null | boolean;
webui: null | string;
webui_ha_aware?: boolean;
}
export interface HassioAddonsInfo {