From 194e3ce4febce6de47a01828ad19ddc1c227c41d Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Thu, 16 Jan 2020 22:52:51 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=B8=20prompt=20user=20to=20confirm?= =?UTF-8?q?=20logout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/panels/profile/ha-panel-profile.ts | 6 +++++- src/translations/en.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/panels/profile/ha-panel-profile.ts b/src/panels/profile/ha-panel-profile.ts index 184866014048..365a67651efd 100644 --- a/src/panels/profile/ha-panel-profile.ts +++ b/src/panels/profile/ha-panel-profile.ts @@ -37,6 +37,7 @@ import { haStyle } from "../../resources/styles"; import { HomeAssistant } from "../../types"; import { fireEvent } from "../../common/dom/fire_event"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { showConfirmationDialog } from "../../dialogs/confirmation/show-dialog-confirmation"; class HaPanelProfile extends LitElement { @property() public hass!: HomeAssistant; @@ -173,7 +174,10 @@ class HaPanelProfile extends LitElement { } private _handleLogOut() { - fireEvent(this, "hass-logout"); + showConfirmationDialog(this, { + text: this.hass.localize("ui.panel.profile.confirm_logout"), + confirm: () => fireEvent(this, "hass-logout"), + }); } static get styles(): CSSResultArray { diff --git a/src/translations/en.json b/src/translations/en.json index c55df7c9d6cb..554d95985460 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1834,6 +1834,7 @@ "current_user": "You are currently logged in as {fullName}.", "is_owner": "You are an owner.", "logout": "Log out", + "confirm_logout": "Are you sure you want to log out?", "force_narrow": { "header": "Always hide the sidebar", "description": "This will hide the sidebar by default, similar to the mobile experience." From d254d2c601ae6b0fd4bd394a5e98901d295d8cba Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Fri, 17 Jan 2020 15:39:44 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=91=8C=20update=20dialog=20title/text?= =?UTF-8?q?/confirm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/panels/profile/ha-panel-profile.ts | 4 +++- src/translations/en.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panels/profile/ha-panel-profile.ts b/src/panels/profile/ha-panel-profile.ts index 365a67651efd..1331e068fd61 100644 --- a/src/panels/profile/ha-panel-profile.ts +++ b/src/panels/profile/ha-panel-profile.ts @@ -175,7 +175,9 @@ class HaPanelProfile extends LitElement { private _handleLogOut() { showConfirmationDialog(this, { - text: this.hass.localize("ui.panel.profile.confirm_logout"), + title: this.hass.localize("ui.panel.profile.logout_title"), + text: this.hass.localize("ui.panel.profile.logout_text"), + confirmBtnText: this.hass.localize("ui.panel.profile.logout"), confirm: () => fireEvent(this, "hass-logout"), }); } diff --git a/src/translations/en.json b/src/translations/en.json index 554d95985460..3b471ed9e4d6 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1834,7 +1834,8 @@ "current_user": "You are currently logged in as {fullName}.", "is_owner": "You are an owner.", "logout": "Log out", - "confirm_logout": "Are you sure you want to log out?", + "logout_title": "Log out?", + "logout_text": "Are you sure you want to log out?", "force_narrow": { "header": "Always hide the sidebar", "description": "This will hide the sidebar by default, similar to the mobile experience."