1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-19 18:28:42 +00:00

Automation add TCA: fix narrow subtitles & icons (#28291)

This commit is contained in:
Wendelin
2025-12-02 15:17:55 +01:00
committed by GitHub
parent 7f885010de
commit c5642c15b8
2 changed files with 24 additions and 13 deletions

View File

@@ -726,15 +726,26 @@ class DialogAddAutomationElement
);
if (targetId) {
if (targetType === "area" && this.hass.areas[targetId]?.floor_id) {
const floorId = this.hass.areas[targetId].floor_id;
if (targetType === "area") {
const floorId = this.hass.areas[targetId]?.floor_id;
if (floorId) {
subtitle = computeFloorName(this.hass.floors[floorId]) || floorId;
} else {
subtitle = this.hass.localize(
"ui.panel.config.automation.editor.other_areas"
);
}
if (targetType === "device" && this.hass.devices[targetId]?.area_id) {
const areaId = this.hass.devices[targetId].area_id;
} else if (targetType === "device") {
const areaId = this.hass.devices[targetId]?.area_id;
if (areaId) {
subtitle = computeAreaName(this.hass.areas[areaId]) || areaId;
} else {
const device = this.hass.devices[targetId];
subtitle = this.hass.localize(
`ui.panel.config.automation.editor.${device?.entry_type === "service" ? "services" : "unassigned_devices"}`
);
}
if (targetType === "entity" && this.hass.states[targetId]) {
} else if (targetType === "entity" && this.hass.states[targetId]) {
const entity = this.hass.entities[targetId];
if (entity && !entity.device_id && !entity.area_id) {
const domain = targetId.split(".", 2)[0];
@@ -759,12 +770,12 @@ class DialogAddAutomationElement
.join(computeRTL(this.hass) ? " ◂ " : " ▸ ");
}
}
}
if (subtitle) {
return html`<span slot="subtitle">${subtitle}</span>`;
}
}
}
return nothing;
}

View File

@@ -372,7 +372,7 @@ export class HaAutomationAddItems extends LitElement {
.selected-target ha-floor-icon {
display: flex;
height: 32px;
width: 24px;
width: 32px;
align-items: center;
}
.selected-target ha-domain-icon {