diff --git a/src/components/ha-analytics.ts b/src/components/ha-analytics.ts index d23ebb21f4..c232362ea1 100644 --- a/src/components/ha-analytics.ts +++ b/src/components/ha-analytics.ts @@ -5,7 +5,7 @@ import { fireEvent } from "../common/dom/fire_event"; import type { LocalizeFunc } from "../common/translations/localize"; import type { Analytics, AnalyticsPreferences } from "../data/analytics"; import { haStyle } from "../resources/styles"; -import "./ha-settings-row"; +import "./ha-md-list-item"; import "./ha-switch"; import "./ha-tooltip"; import type { HaSwitch } from "./ha-switch"; @@ -33,105 +33,80 @@ export class HaAnalytics extends LitElement { const baseEnabled = !loading && this.analytics!.preferences.base; return html` - - - ${this.localize( + + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.base.title` - )} - - - ${this.localize( + )} + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.base.description` - )} - + )} - - + > + ${ADDITIONAL_PREFERENCES.map( (preference) => html` - - - ${this.localize( + + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.${preference}.title` - )} - - - ${this.localize( + )} + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.${preference}.description` - )} - - - - - ${baseEnabled - ? nothing - : html` - ${this.localize( - `ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled` - )} - `} - - + )} + + ${baseEnabled + ? nothing + : html` + ${this.localize( + `ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled` + )} + `} + ` )} - - - ${this.localize( + + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.diagnostics.title` - )} - - - ${this.localize( + )} + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.diagnostics.description` - )} - + )} - - + > + `; } - protected updated(changedProps) { - super.updated(changedProps); - - this.shadowRoot!.querySelectorAll("*[data-for]").forEach((el) => { - const forEl = (el as HTMLElement).dataset.for; - delete (el as HTMLElement).dataset.for; - - el.addEventListener("click", () => { - const toFocus = this.shadowRoot!.querySelector( - `*[name=${forEl}]` - ) as HTMLElement | null; - - if (toFocus) { - toFocus.focus(); - toFocus.click(); - } - }); - }); - } - private _handleRowClick(ev: Event) { const target = ev.currentTarget as HaSwitch; const preference = (target as any).preference; @@ -164,13 +139,10 @@ export class HaAnalytics extends LitElement { color: var(--error-color); } - ha-settings-row { - padding: 0; - } - - span[slot="heading"], - span[slot="description"] { - cursor: pointer; + ha-md-list-item { + --md-list-item-leading-space: 0; + --md-list-item-trailing-space: 0; + --md-item-overflow: visible; } `, ]; diff --git a/src/panels/config/cloud/account/cloud-account.ts b/src/panels/config/cloud/account/cloud-account.ts index 70d486f4c1..bdc952212d 100644 --- a/src/panels/config/cloud/account/cloud-account.ts +++ b/src/panels/config/cloud/account/cloud-account.ts @@ -229,7 +229,6 @@ export class CloudAccount extends SubscribeMixin(LitElement) { diff --git a/src/panels/config/cloud/account/cloud-webhooks.ts b/src/panels/config/cloud/account/cloud-webhooks.ts index fddbcaa7ad..3ad296d0ed 100644 --- a/src/panels/config/cloud/account/cloud-webhooks.ts +++ b/src/panels/config/cloud/account/cloud-webhooks.ts @@ -5,7 +5,7 @@ import { isComponentLoaded } from "../../../../common/config/is_component_loaded import "../../../../components/ha-card"; import "../../../../components/ha-button"; import "../../../../components/ha-spinner"; -import "../../../../components/ha-settings-row"; +import "../../../../components/ha-md-list-item"; import "../../../../components/ha-switch"; import type { CloudStatusLoggedIn, CloudWebhook } from "../../../../data/cloud"; import { createCloudhook, deleteCloudhook } from "../../../../data/cloud"; @@ -21,8 +21,6 @@ export class CloudWebhooks extends LitElement { @property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn; - @property({ type: Boolean }) public narrow = false; - @state() private _cloudHooks?: Record; @state() private _localHooks?: Webhook[]; @@ -78,23 +76,24 @@ export class CloudWebhooks extends LitElement { ` : this._localHooks.map( (entry) => html` - - - ${entry.name} + + ${entry.name} ${entry.domain !== entry.name.toLowerCase() ? ` (${entry.domain})` - : ""} - - ${entry.webhook_id} + : ""} + ${entry.webhook_id} ${this._progress.includes(entry.webhook_id) ? html` - + ` : this._cloudHooks![entry.webhook_id] ? html` ` - : html` + : html` + @click=${this._enableWebhook} `} - + ` )}