From a2e1e6362b3769bb2f790cb0ce5624f5b117740c Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Mon, 13 Oct 2025 12:13:26 +0100 Subject: [PATCH] Migrate new backup dialog to ha-wa-dialog (#27430) --- .../backup/dialogs/dialog-new-backup.ts | 142 +++++++----------- 1 file changed, 58 insertions(+), 84 deletions(-) diff --git a/src/panels/config/backup/dialogs/dialog-new-backup.ts b/src/panels/config/backup/dialogs/dialog-new-backup.ts index 82927c07a8..0da94b246d 100644 --- a/src/panels/config/backup/dialogs/dialog-new-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-new-backup.ts @@ -1,14 +1,11 @@ -import { mdiCalendarSync, mdiClose, mdiGestureTap } from "@mdi/js"; +import { mdiCalendarSync, mdiGestureTap } from "@mdi/js"; import type { CSSResultGroup } from "lit"; import { LitElement, css, html, nothing } from "lit"; -import { customElement, property, query, state } from "lit/decorators"; +import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; -import "../../../../components/ha-dialog-header"; -import "../../../../components/ha-icon-button"; import "../../../../components/ha-icon-next"; -import "../../../../components/ha-md-dialog"; -import type { HaMdDialog } from "../../../../components/ha-md-dialog"; import "../../../../components/ha-md-list"; +import "../../../../components/ha-wa-dialog"; import "../../../../components/ha-md-list-item"; import "../../../../components/ha-svg-icon"; import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; @@ -24,92 +21,80 @@ class DialogNewBackup extends LitElement implements HassDialog { @state() private _params?: NewBackupDialogParams; - @query("ha-md-dialog") private _dialog?: HaMdDialog; - public showDialog(params: NewBackupDialogParams): void { this._opened = true; this._params = params; } public closeDialog() { - this._dialog?.close(); + this._opened = false; return true; } private _dialogClosed() { - if (this._params!.cancel) { - this._params!.cancel(); + if (this._params?.cancel) { + this._params.cancel(); } - if (this._opened) { - fireEvent(this, "dialog-closed", { dialog: this.localName }); - } - this._opened = false; this._params = undefined; + fireEvent(this, "dialog-closed", { dialog: this.localName }); } protected render() { - if (!this._opened || !this._params) { + if (!this._params) { return nothing; } return html` - - - - - ${this.hass.localize("ui.panel.config.backup.dialogs.new.title")} - - -
- + + - - - - ${this.hass.localize( - "ui.panel.config.backup.dialogs.new.automatic.title" - )} - - - ${this.hass.localize( - "ui.panel.config.backup.dialogs.new.automatic.description" - )} - - - - - - - ${this.hass.localize( - "ui.panel.config.backup.dialogs.new.manual.title" - )} - - - ${this.hass.localize( - "ui.panel.config.backup.dialogs.new.manual.description" - )} - - - - -
-
+ + + ${this.hass.localize( + "ui.panel.config.backup.dialogs.new.automatic.title" + )} + + + ${this.hass.localize( + "ui.panel.config.backup.dialogs.new.automatic.description" + )} + + + + + + + ${this.hass.localize( + "ui.panel.config.backup.dialogs.new.manual.title" + )} + + + ${this.hass.localize( + "ui.panel.config.backup.dialogs.new.manual.description" + )} + + + + + `; } @@ -128,24 +113,13 @@ class DialogNewBackup extends LitElement implements HassDialog { haStyle, haStyleDialog, css` - ha-md-dialog { + ha-wa-dialog { --dialog-content-padding: 0; - max-width: 500px; - } - @media all and (max-width: 450px), all and (max-height: 500px) { - ha-md-dialog { - max-width: none; - } - div[slot="content"] { - margin-top: 0; - } } ha-md-list { background: none; } - ha-md-list-item { - } ha-icon-next { width: 24px; }