diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index a4ba863a12..4d67c4dbf6 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,8 +57,6 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @state() private _currentType?: string; - @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -113,7 +111,6 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } - this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -214,14 +211,12 @@ export class HuiDialogEditView extends LitElement { } } - const isEmpty = - !this._config?.cards?.length && !this._config?.sections?.length; - const isCompatibleViewType = - isEmpty || - (this._currentType === SECTION_VIEW_LAYOUT - ? this._config?.type === SECTION_VIEW_LAYOUT - : this._config?.type !== SECTION_VIEW_LAYOUT); + this._config?.type === SECTION_VIEW_LAYOUT + ? this._config?.type === SECTION_VIEW_LAYOUT && + !this._config?.cards?.length + : this._config?.type !== SECTION_VIEW_LAYOUT && + !this._config?.sections?.length; return html` + ${!isCompatibleViewType + ? html` + + ${this._config?.type === SECTION_VIEW_LAYOUT + ? this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_sections" + ) + : this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_others" + )} + + ` + : nothing} ${!this._yamlMode ? html` ` : nothing} - ${!isCompatibleViewType - ? html` - - ${this._config?.type === SECTION_VIEW_LAYOUT - ? this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_sections" - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_others" - )} - - ` - : nothing}