mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-15 07:25:54 +00:00
Fix custom paths for navigation picker (#29619)
Fix custom paths for navigation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Fuse from "fuse.js";
|
||||
import { mdiDevices, mdiTextureBox } from "@mdi/js";
|
||||
import { mdiDevices, mdiPlus, mdiTextureBox } from "@mdi/js";
|
||||
import { html, LitElement, nothing, type PropertyValues } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@@ -237,6 +237,22 @@ export class HaNavigationPicker extends LitElement {
|
||||
addGroup("views", views);
|
||||
addGroup("other_routes", otherRoutes);
|
||||
|
||||
if (
|
||||
searchString &&
|
||||
!this._navigationItems.some((navItem) => navItem.id === searchString)
|
||||
) {
|
||||
items.push({
|
||||
id: searchString,
|
||||
primary: this.hass.localize(
|
||||
"ui.components.navigation-picker.add_custom_path"
|
||||
),
|
||||
secondary: `"${searchString}"`,
|
||||
icon_path: mdiPlus,
|
||||
sorting_label: searchString,
|
||||
group: "other_routes",
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user