mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-15 07:25:54 +00:00
voice-assistants-expose-assistant-icon: fix tooltip (#29469)
* fix tooltip * provide id for tooltip for assistant icon
This commit is contained in:
@@ -32,6 +32,7 @@ export function getAssistantsTableColumn<T>(
|
||||
supportedEntities[vaId].includes(entry.entity_id);
|
||||
const manual = entry.manAssistants?.includes(vaId);
|
||||
return getAssistantsTableColumnIcon(
|
||||
entry.entity_id,
|
||||
entry.assistants.includes(vaId),
|
||||
vaId,
|
||||
hass,
|
||||
@@ -45,6 +46,7 @@ export function getAssistantsTableColumn<T>(
|
||||
}
|
||||
|
||||
export const getAssistantsTableColumnIcon = (
|
||||
id: string,
|
||||
show: boolean,
|
||||
vaId: string,
|
||||
hass: HomeAssistant,
|
||||
@@ -57,6 +59,7 @@ export const getAssistantsTableColumnIcon = (
|
||||
);
|
||||
return show
|
||||
? html`<voice-assistants-expose-assistant-icon
|
||||
.id=${id}
|
||||
.assistant=${vaId}
|
||||
.hass=${hass}
|
||||
.manual=${manual ?? false}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { mdiAlertCircle } from "@mdi/js";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { styleMap } from "lit/directives/style-map";
|
||||
import { slugify } from "../../../../common/string/slugify";
|
||||
import { voiceAssistants } from "../../../../data/expose";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
import "../../../../components/ha-svg-icon";
|
||||
@@ -23,8 +24,9 @@ export class VoiceAssistantExposeAssistantIcon extends LitElement {
|
||||
|
||||
render() {
|
||||
if (!this.assistant || !voiceAssistants[this.assistant]) return nothing;
|
||||
const id = slugify(this.id) + "-" + this.assistant;
|
||||
return html`
|
||||
<div class="container" id="container">
|
||||
<div class="container" id=${id}>
|
||||
<voice-assistant-brand-icon
|
||||
style=${styleMap({
|
||||
filter: this.manual ? "grayscale(100%)" : undefined,
|
||||
@@ -43,7 +45,7 @@ export class VoiceAssistantExposeAssistantIcon extends LitElement {
|
||||
: nothing}
|
||||
</div>
|
||||
<ha-tooltip
|
||||
for="container"
|
||||
for=${id}
|
||||
placement="left"
|
||||
.disabled=${!this.unsupported && !this.manual}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user