mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 12:46:35 +00:00
parent
8ee29b1e43
commit
c979cfb912
@ -287,27 +287,29 @@ class HaSidebar extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
${this._hiddenPanels.map((url) => {
|
${this._hiddenPanels.map((url) => {
|
||||||
const panel = this.hass.panels[url];
|
const panel = this.hass.panels[url];
|
||||||
|
if (!panel) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return html`<paper-icon-item
|
return html`<paper-icon-item
|
||||||
@click=${this._unhidePanel}
|
@click=${this._unhidePanel}
|
||||||
class="hidden-panel"
|
class="hidden-panel"
|
||||||
|
.panel=${url}
|
||||||
>
|
>
|
||||||
<ha-icon
|
<ha-icon
|
||||||
slot="item-icon"
|
slot="item-icon"
|
||||||
.icon=${panel.url_path === "lovelace"
|
.icon=${panel.url_path === this.hass.defaultPanel
|
||||||
? "mdi:view-dashboard"
|
? "mdi:view-dashboard"
|
||||||
: panel.icon}
|
: panel.icon}
|
||||||
></ha-icon>
|
></ha-icon>
|
||||||
<span class="item-text"
|
<span class="item-text"
|
||||||
>${panel.url_path === "lovelace"
|
>${panel.url_path === this.hass.defaultPanel
|
||||||
? hass.localize("panel.states")
|
? hass.localize("panel.states")
|
||||||
: hass.localize(`panel.${panel.title}`) ||
|
: hass.localize(`panel.${panel.title}`) ||
|
||||||
panel.title}</span
|
panel.title}</span
|
||||||
>
|
>
|
||||||
<ha-svg-icon
|
<mwc-icon-button class="hide-panel">
|
||||||
class="hide-panel"
|
<ha-svg-icon .path=${mdiPlus}></ha-svg-icon>
|
||||||
.panel=${url}
|
</mwc-icon-button>
|
||||||
.path=${mdiPlus}
|
|
||||||
></ha-svg-icon>
|
|
||||||
</paper-icon-item>`;
|
</paper-icon-item>`;
|
||||||
})}
|
})}
|
||||||
<div class="spacer" disabled></div>
|
<div class="spacer" disabled></div>
|
||||||
@ -544,7 +546,7 @@ class HaSidebar extends LitElement {
|
|||||||
|
|
||||||
private async _unhidePanel(ev: Event) {
|
private async _unhidePanel(ev: Event) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const index = this._hiddenPanels.indexOf((ev.target as any).panel);
|
const index = this._hiddenPanels.indexOf((ev.currentTarget as any).panel);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user