enh(BookmarksList): Search for folders

fixes #2076

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2024-02-03 18:09:35 +01:00
parent 9db199a989
commit 74d214907e
1 changed files with 12 additions and 0 deletions

View File

@ -125,9 +125,21 @@ export default {
},
subFolders() {
if (this.$route.name === this.routes.SHARED_FOLDERS) {
// Show shared folders
return Object.keys(this.$store.state.sharedFoldersById)
.map(folderId => this.$store.getters.getFolder(folderId)[0])
}
if (this.$route.name === this.routes.SEARCH) {
// Search folders
const searchFolder = (folder) => {
const results = folder.children.flatMap(searchFolder)
if (this.$store.state.fetchState.query.search.some(term => term.trim() && folder.title.toLowerCase().includes(term.toLowerCase()))) {
results.push(folder)
}
return results
}
return this.$store.getters.getFolder(-1)[0].children.flatMap(searchFolder)
}
if (this.$route.name !== this.routes.HOME && this.$route.name !== this.routes.FOLDER) {
return []
}