Fix icons in entity settings (#20405)

This commit is contained in:
Bram Kragten 2024-04-04 13:00:14 +02:00 committed by GitHub
parent 08b25f9c2a
commit 61c9072a08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 17 deletions

View File

@ -27,7 +27,6 @@ import {
import { customElement, property, query, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
import { styleMap } from "lit/directives/style-map";
import { until } from "lit/directives/until";
import memoize from "memoize-one";
import { computeCssColor } from "../../../common/color/compute-color";
import type { HASSDomEvent } from "../../../common/dom/fire_event";
@ -67,7 +66,6 @@ import {
removeEntityRegistryEntry,
updateEntityRegistryEntry,
} from "../../../data/entity_registry";
import { entryIcon } from "../../../data/icons";
import {
LabelRegistryEntry,
createLabelRegistryEntry,
@ -207,21 +205,19 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
type: "icon",
template: (entry) =>
entry.icon
? html`
<ha-state-icon
title=${ifDefined(entry.entity?.state)}
slot="item-icon"
.hass=${this.hass}
.stateObj=${entry.entity}
></ha-state-icon>
`
: html`
<ha-icon
icon=${until(
entryIcon(this.hass, entry as EntityRegistryEntry)
)}
></ha-icon>
`,
? html`<ha-icon .icon=${entry.icon}></ha-icon>`
: entry.entity
? html`
<ha-state-icon
title=${ifDefined(entry.entity?.state)}
slot="item-icon"
.hass=${this.hass}
.stateObj=${entry.entity}
></ha-state-icon>
`
: html`<ha-domain-icon
.domain=${computeDomain(entry.entity_id)}
></ha-domain-icon>`,
},
name: {
main: true,