mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
disabled microphone button when not supported
This commit is contained in:
parent
15eab18e07
commit
0e071a8b7e
@ -1,3 +1,4 @@
|
|||||||
|
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import {
|
import {
|
||||||
mdiChevronDown,
|
mdiChevronDown,
|
||||||
@ -109,7 +110,6 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
if (!this._opened) {
|
if (!this._opened) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const supportsSTT = this._pipeline?.stt_engine && AudioRecorder.isSupported;
|
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@ -202,11 +202,12 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
iconTrailing
|
iconTrailing
|
||||||
>
|
>
|
||||||
<span slot="trailingIcon">
|
<div slot="trailingIcon">
|
||||||
${this._showSendButton
|
${this._showSendButton
|
||||||
? html`
|
? html`
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
class="listening-icon"
|
id="microphone-button"
|
||||||
|
class="move-end"
|
||||||
.path=${mdiSend}
|
.path=${mdiSend}
|
||||||
@click=${this._handleSendMessage}
|
@click=${this._handleSendMessage}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
@ -215,8 +216,8 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
>
|
>
|
||||||
</ha-icon-button>
|
</ha-icon-button>
|
||||||
`
|
`
|
||||||
: supportsSTT
|
: this._pipeline?.stt_engine
|
||||||
? html`
|
? html` <div class="move-end">
|
||||||
${this._audioRecorder?.active
|
${this._audioRecorder?.active
|
||||||
? html`
|
? html`
|
||||||
<div class="bouncer">
|
<div class="bouncer">
|
||||||
@ -226,17 +227,28 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
class="listening-icon"
|
id="microphone-button"
|
||||||
.path=${mdiMicrophone}
|
|
||||||
@click=${this._toggleListening}
|
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.dialogs.voice_command.start_listening"
|
"ui.dialogs.voice_command.start_listening"
|
||||||
)}
|
)}
|
||||||
|
.path=${mdiMicrophone}
|
||||||
|
.disabled=${!AudioRecorder.isSupported}
|
||||||
|
@click=${this._toggleListening}
|
||||||
>
|
>
|
||||||
</ha-icon-button>
|
</ha-icon-button>
|
||||||
`
|
${!AudioRecorder.isSupported
|
||||||
|
? html`<simple-tooltip
|
||||||
|
animation-delay="0"
|
||||||
|
position="top"
|
||||||
|
offset="1"
|
||||||
|
>${this.hass.localize(
|
||||||
|
"ui.dialogs.voice_command.stt_not_supported"
|
||||||
|
)}</simple-tooltip
|
||||||
|
>`
|
||||||
|
: ""}
|
||||||
|
</div>`
|
||||||
: ""}
|
: ""}
|
||||||
</span>
|
</div>
|
||||||
</ha-textfield>
|
</ha-textfield>
|
||||||
${this._agentInfo && this._agentInfo.attribution
|
${this._agentInfo && this._agentInfo.attribution
|
||||||
? html`
|
? html`
|
||||||
@ -561,18 +573,20 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
return [
|
return [
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
css`
|
css`
|
||||||
ha-icon-button.listening-icon {
|
#microphone-button {
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
margin-right: -24px;
|
|
||||||
margin-inline-end: -24px;
|
|
||||||
margin-inline-start: initial;
|
|
||||||
direction: var(--direction);
|
direction: var(--direction);
|
||||||
}
|
}
|
||||||
|
#microphone-button[active] {
|
||||||
ha-icon-button.listening-icon[active] {
|
|
||||||
color: var(--primary-color);
|
color: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
.move-end {
|
||||||
|
position: relative;
|
||||||
|
right: -24px;
|
||||||
|
}
|
||||||
|
simple-tooltip {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--primary-action-button-flex: 1;
|
--primary-action-button-flex: 1;
|
||||||
--secondary-action-button-flex: 0;
|
--secondary-action-button-flex: 0;
|
||||||
@ -622,7 +636,6 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
ha-textfield {
|
ha-textfield {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
a.button {
|
a.button {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -838,6 +838,7 @@
|
|||||||
"input_label": "Enter a request",
|
"input_label": "Enter a request",
|
||||||
"send_text": "Send text",
|
"send_text": "Send text",
|
||||||
"start_listening": "Start listening",
|
"start_listening": "Start listening",
|
||||||
|
"stt_not_supported": "You can only use speech-to-text when using HTTPS.",
|
||||||
"manage_assistants": "Manage assistants"
|
"manage_assistants": "Manage assistants"
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user