From 9e686190f6e1d6b3088102e89b5ffb9e9c0ab681 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 28 Mar 2025 15:26:09 +0100 Subject: [PATCH] More info breadcrumb clickable (#24830) * Make more info breadcrum clickable * css adjustements --- src/components/ha-related-items.ts | 57 ++++++++++---------- src/dialogs/more-info/ha-more-info-dialog.ts | 38 +++++++++---- 2 files changed, 56 insertions(+), 39 deletions(-) diff --git a/src/components/ha-related-items.ts b/src/components/ha-related-items.ts index cce81fba76..63c2cf1882 100644 --- a/src/components/ha-related-items.ts +++ b/src/components/ha-related-items.ts @@ -211,36 +211,12 @@ export class HaRelatedItems extends LitElement { )} ` : nothing} - ${this._related.device - ? html`

- ${this.hass.localize("ui.components.related-items.device")} -

- ${this._related.device.map((relatedDeviceId) => { - const device = this.hass.devices[relatedDeviceId]; - if (!device) { - return nothing; - } - return html` - - - - ${device.name_by_user || device.name} - - - - `; - })} - ` - : nothing} ${this._related.area ? html`

${this.hass.localize("ui.components.related-items.area")}

- ${this._related.area.map((relatedAreaId) => { + + ${this._related.area.map((relatedAreaId) => { const area = this.hass.areas[relatedAreaId]; if (!area) { return nothing; @@ -268,8 +244,33 @@ export class HaRelatedItems extends LitElement { `; - })}` + })} + ` + : nothing} + ${this._related.device + ? html`

+ ${this.hass.localize("ui.components.related-items.device")} +

+ + ${this._related.device.map((relatedDeviceId) => { + const device = this.hass.devices[relatedDeviceId]; + if (!device) { + return nothing; + } + return html` + + + + ${device.name_by_user || device.name} + + + + `; + })} + ` : nothing} ${this._related.entity ? html` diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index fd605e983b..57c415f3b9 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -276,6 +276,11 @@ export class MoreInfoDialog extends LitElement { this._setView("related"); } + private _breadcrumbClick(ev: Event) { + ev.stopPropagation(); + this._setView("related"); + } + private async _loadNumericDeviceClasses() { const deviceClasses = await getSensorNumericDeviceClasses(this.hass); this._sensorNumericDeviceClasses = deviceClasses.numeric_device_classes; @@ -350,17 +355,16 @@ export class MoreInfoDialog extends LitElement { )} > `} - + ${breadcrumb.length > 0 ? html` -

${title}

@@ -656,6 +660,7 @@ export class MoreInfoDialog extends LitElement { .title { display: flex; flex-direction: column; + align-items: flex-start; } .title p { @@ -676,11 +681,22 @@ export class MoreInfoDialog extends LitElement { color: var(--secondary-text-color); font-size: 14px; line-height: 16px; - margin-top: -6px; + --mdc-icon-size: 16px; + padding: 4px; + margin: -4px; + margin-top: -10px; + background: none; + border: none; + cursor: pointer; + outline: none; + display: inline-flex; + border-radius: 6px; + transition: background-color 180ms ease-in-out; } - .title .breadcrumb { - --mdc-icon-size: 16px; + .title .breadcrumb:focus-visible, + .title .breadcrumb:hover { + background-color: rgba(var(--rgb-secondary-text-color), 0.08); } `, ];