Don't display keyboard shortcut hints if keyboard shortcuts are disabled (#20456)

* Shortcut hints

* Prettier
This commit is contained in:
Simon Lamon 2024-04-09 14:10:59 +02:00 committed by GitHub
parent e8a140af44
commit 1e0f7d9629
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 6 deletions

View File

@ -93,10 +93,19 @@ const randomTip = (hass: HomeAssistant, narrow: boolean) => {
weight: 2,
narrow: true,
},
{ content: hass.localize("ui.tips.key_c_hint"), weight: 1, narrow: false },
{ content: hass.localize("ui.tips.key_m_hint"), weight: 1, narrow: false },
];
if (hass?.enableShortcuts) {
tips.push(
{
content: hass.localize("ui.tips.key_c_hint"),
weight: 1,
narrow: false,
},
{ content: hass.localize("ui.tips.key_m_hint"), weight: 1, narrow: false }
);
}
if (narrow) {
tips = tips.filter((tip) => tip.narrow);
}
@ -310,7 +319,9 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) {
private _showQuickBar(): void {
showQuickBar(this, {
commandMode: true,
hint: this.hass.localize("ui.dialogs.quick-bar.key_c_hint"),
hint: this.hass.enableShortcuts
? this.hass.localize("ui.dialogs.quick-bar.key_c_hint")
: undefined,
});
}

View File

@ -128,9 +128,11 @@ class HaPanelDevState extends LitElement {
allow-custom-entity
item-label-path="entity_id"
></ha-entity-picker>
<ha-tip .hass=${this.hass}
>${this.hass.localize("ui.tips.key_e_hint")}</ha-tip
>
${this.hass.enableShortcuts
? html`<ha-tip .hass=${this.hass}
>${this.hass.localize("ui.tips.key_e_hint")}</ha-tip
>`
: nothing}
<ha-textfield
.label=${this.hass.localize(
"ui.panel.developer-tools.tabs.states.state"