From c29401a5a53e79507ea1aefb4b54a817c371ae7c Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Wed, 11 Feb 2026 16:28:26 +0000 Subject: [PATCH] Migrate tags config dialog to wa (#29577) * Migrate config-tags dialog(s) to wa * Prevent scrim close --- src/panels/config/tags/dialog-tag-detail.ts | 103 +++++++++++--------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/src/panels/config/tags/dialog-tag-detail.ts b/src/panels/config/tags/dialog-tag-detail.ts index 1382e6f29a..f8c86b381d 100644 --- a/src/panels/config/tags/dialog-tag-detail.ts +++ b/src/panels/config/tags/dialog-tag-detail.ts @@ -5,10 +5,11 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { documentationUrl } from "../../../util/documentation-url"; import "../../../components/ha-alert"; import "../../../components/ha-button"; -import { createCloseHeading } from "../../../components/ha-dialog"; +import "../../../components/ha-dialog-footer"; import "../../../components/ha-qr-code"; import "../../../components/ha-switch"; import "../../../components/ha-textfield"; +import "../../../components/ha-wa-dialog"; import type { Tag, UpdateTagParams } from "../../../data/tag"; import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../resources/styles"; @@ -32,9 +33,12 @@ class DialogTagDetail @state() private _submitting = false; + @state() private _open = false; + public showDialog(params: TagDetailDialogParams): void { this._params = params; this._error = undefined; + this._open = true; if (this._params.entry) { this._name = this._params.entry.name || ""; } else { @@ -43,10 +47,14 @@ class DialogTagDetail } } - public closeDialog() { + public closeDialog(): boolean { + this._open = false; + return true; + } + + private _dialogClosed() { this._params = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); - return true; } protected render() { @@ -55,17 +63,14 @@ class DialogTagDetail } return html` -
${this._error @@ -79,7 +84,7 @@ class DialogTagDetail ${this._params.entry.id}` : ""} - ${this._params.entry - ? html` - - ${this.hass!.localize("ui.panel.config.tag.detail.delete")} - - ` - : nothing} - + ${this._params.entry - ? this.hass!.localize("ui.panel.config.tag.detail.update") - : this.hass!.localize("ui.panel.config.tag.detail.create")} - - ${this._params.openWrite && !this._params.entry - ? html` - ${this.hass!.localize( - "ui.panel.config.tag.detail.create_and_write" - )} - ` - : ""} - + ? html` + + ${this.hass!.localize("ui.panel.config.tag.detail.delete")} + + ` + : nothing} + + ${this._params.entry + ? this.hass!.localize("ui.panel.config.tag.detail.update") + : this.hass!.localize("ui.panel.config.tag.detail.create")} + + ${this._params.openWrite && !this._params.entry + ? html` + ${this.hass!.localize( + "ui.panel.config.tag.detail.create_and_write" + )} + ` + : ""} + + `; }