From 01c6a688890924246fdc52dab12e01c01a6be4a9 Mon Sep 17 00:00:00 2001 From: Zack Date: Fri, 11 Feb 2022 09:40:10 -0600 Subject: [PATCH 1/2] Fix Lovelace Empty Menu when not advanced or admin --- src/panels/lovelace/hui-root.ts | 280 +++++++++++++++++--------------- 1 file changed, 151 insertions(+), 129 deletions(-) diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index ccd4ee08fbf8..9bc6d0e2c9a7 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -276,137 +276,159 @@ class HUIRoot extends LitElement { > ` : ""} - - - ${this.narrow && - this._conversation(this.hass.config.components) - ? html` - + - ${this.hass!.localize( - "ui.panel.lovelace.menu.start_conversation" - )} - - - ` - : ""} - ${this._yamlMode - ? html` - - ${this.hass!.localize("ui.common.refresh")} - - - - ${this.hass!.localize( - "ui.panel.lovelace.unused_entities.title" - )} - - - ` - : ""} - ${(this.hass.panels.lovelace?.config as LovelacePanelConfig) - ?.mode === "yaml" - ? html` - - ${this.hass!.localize( - "ui.panel.lovelace.menu.reload_resources" - )} - - - ` - : ""} - ${this.hass!.user?.is_admin && !this.hass!.config.safe_mode - ? html` - - ${this.hass!.localize( - "ui.panel.lovelace.menu.configure_ui" - )} - - - ` - : ""} - ${this._editMode - ? html` - - - ${this.hass!.localize( - "ui.panel.lovelace.menu.help" - )} - - - - ` - : ""} - + .path=${mdiDotsVertical} + > + ${this.narrow && + this._conversation(this.hass.config.components) + ? html` + + ${this.hass!.localize( + "ui.panel.lovelace.menu.start_conversation" + )} + + + ` + : ""} + ${this._yamlMode + ? html` + + ${this.hass!.localize( + "ui.common.refresh" + )} + + + + ${this.hass!.localize( + "ui.panel.lovelace.unused_entities.title" + )} + + + ` + : ""} + ${( + this.hass.panels.lovelace + ?.config as LovelacePanelConfig + )?.mode === "yaml" + ? html` + + ${this.hass!.localize( + "ui.panel.lovelace.menu.reload_resources" + )} + + + ` + : ""} + ${this.hass!.user?.is_admin && + !this.hass!.config.safe_mode + ? html` + + ${this.hass!.localize( + "ui.panel.lovelace.menu.configure_ui" + )} + + + ` + : ""} + ${this._editMode + ? html` + + + ${this.hass!.localize( + "ui.panel.lovelace.menu.help" + )} + + + + ` + : ""} + + ` + : ""} `} ${this._editMode From 412fc4a3af321feef1ff0834909cb9d6674db500 Mon Sep 17 00:00:00 2001 From: Zack Date: Fri, 11 Feb 2022 09:45:47 -0600 Subject: [PATCH 2/2] move to getter --- src/panels/lovelace/hui-root.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index 9bc6d0e2c9a7..d2c2a1a6b7c0 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -276,13 +276,7 @@ class HUIRoot extends LitElement { > ` : ""} - ${this._editMode || - (this.hass!.user?.is_admin && !this.hass!.config.safe_mode) || - (this.hass.panels.lovelace?.config as LovelacePanelConfig) - ?.mode === "yaml" || - this._yamlMode || - (this.narrow && - this._conversation(this.hass.config.components)) + ${this._showButtonMenu ? html` ): void { if (!shouldHandleRequestSelectedEvent(ev)) { return;