Add shortcuts item to command quick bar (#24952)

* Add shortcuts item to command quick bar

* Remove
This commit is contained in:
Jan-Philipp Benecke 2025-04-09 16:46:08 +02:00 committed by GitHub
parent 74acd7ec38
commit 228acf1fae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ import {
mdiConsoleLine,
mdiDevices,
mdiEarth,
mdiKeyboard,
mdiMagnify,
mdiReload,
mdiServerNetwork,
@ -42,6 +43,7 @@ import { loadVirtualizer } from "../../resources/virtualizer";
import type { HomeAssistant } from "../../types";
import { showConfirmationDialog } from "../generic/show-dialog-box";
import { QuickBarMode, type QuickBarParams } from "./show-dialog-quick-bar";
import { showShortcutsDialog } from "../shortcuts/show-shortcuts-dialog";
interface QuickBarItem extends ScorableTextItem {
primaryText: string;
@ -736,10 +738,20 @@ export class QuickBar extends LitElement {
}
}
const additionalItems = [
{
path: "",
primaryText: this.hass.localize("ui.panel.config.info.shortcuts"),
action: () => showShortcutsDialog(this),
iconPath: mdiKeyboard,
},
];
return this._finalizeNavigationCommands([
...panelItems,
...sectionItems,
...supervisorItems,
...additionalItems,
]);
}
@ -816,12 +828,12 @@ export class QuickBar extends LitElement {
const categoryKey: CommandItem["categoryKey"] = "navigation";
const navItem = {
...item,
iconPath: mdiEarth,
categoryText: this.hass.localize(
`ui.dialogs.quick-bar.commands.types.${categoryKey}`
),
action: () => navigate(item.path),
...item,
};
return {