Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ› Workspace search only shows matching sub-items

Alicia Sykese46ab90bb487
diff --git a/src/components/Workspace/SideBar.vue b/src/components/Workspace/SideBar.vue
index bb956cfc..126f6a04 100644
--- a/src/components/Workspace/SideBar.vue
+++ b/src/components/Workspace/SideBar.vue
@@ -137,7 +137,7 @@ export default {
visibleSections() {
if (!this.search) return this.workspaceSections;
return this.workspaceSections
- .map((section) => ({ ...section, items: searchTiles(section.items, this.search, section.name) }))
+ .map((section) => ({ ...section, items: this.matchingItems(section) }))
.filter((section) => section.items.length);
},
/* Open apps, with title and icon from their item, if there is one */
@@ -167,6 +167,14 @@ export default {
sectionHasActive(section) {
return !!section && section.items.some((item) => [item, ...(item.subItems || [])].some(this.isActive));
},
+ /* Items matching the search, with groups trimmed to their matching sub-items */
+ matchingItems(section) {
+ return searchTiles(section.items, this.search, section.name).map((item) => {
+ if (!item.subItems) return item;
+ const subItems = searchTiles(item.subItems, this.search, `${section.name} ${item.title || ''}`);
+ return { ...item, subItems: subItems.length ? subItems : item.subItems };
+ });
+ },
isOpen(section) {
return !!this.search || this.visibleSections.length === 1 || this.openSection === section.name;
},