Fix analytics switches (#27181)

This commit is contained in:
Paul Bottein
2025-09-25 16:54:11 +02:00
parent 59b8932969
commit b314b3ed2b

View File

@@ -1,5 +1,5 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { CSSResultGroup, TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
import type { LocalizeFunc } from "../common/translations/localize"; import type { LocalizeFunc } from "../common/translations/localize";
@@ -73,14 +73,18 @@ export class HaAnalytics extends LitElement {
.checked=${this.analytics?.preferences[preference]} .checked=${this.analytics?.preferences[preference]}
.preference=${preference} .preference=${preference}
name=${preference} name=${preference}
?disabled=${baseEnabled}
> >
</ha-switch> </ha-switch>
<ha-tooltip .for="switch-${preference}" placement="right"> ${baseEnabled
? nothing
: html`<ha-tooltip
.for="switch-${preference}"
placement="right"
>
${this.localize( ${this.localize(
`ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled` `ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled`
)} )}
</ha-tooltip> </ha-tooltip>`}
</span> </span>
</ha-settings-row> </ha-settings-row>
` `