Skip to content

Commit b500b95

Browse files
committed
[native] enh(search): Show search results from other folders
fixes #1296 Signed-off-by: Marcel Klehr <[email protected]>
1 parent a4c2206 commit b500b95

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

_locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,5 +797,8 @@
797797
},
798798
"LabelLinkwardenconnectionerror": {
799799
"message": "Failed to connect to your Linkwarden server"
800+
},
801+
"LabelSearchresultsotherfolders": {
802+
"message": "Results from other folders"
800803
}
801804
}

src/ui/views/native/Tree.vue

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
:disabled="!currentAccount"
3939
:color="syncing || scheduled? 'primary' : ''"
4040
v-bind="attrs"
41+
:class="{'sync-dropdown-hint': !Boolean(syncing)}"
4142
v-on="on"
42-
@click="onTriggerSync" :class="{'sync-dropdown-hint': !Boolean(syncing)}">
43+
@click="onTriggerSync">
4344
<v-icon
4445
:class="{'sync--active': Boolean(syncing)}">
4546
{{ scheduled ? 'mdi-timer-sync-outline' : 'mdi-sync' }}
@@ -157,9 +158,8 @@
157158
class="loading" />
158159
<v-list
159160
v-else-if="currentFolder && items && items.length"
160-
style="min-height: 95vh"
161161
two-line
162-
class="pb-10">
162+
:class="{'pb-10': true, 'list-full-height': !(searchQuery && otherSearchItems && otherSearchItems.length)}">
163163
<template v-for="item in items">
164164
<v-list-item
165165
:key="item.type+item.id"
@@ -246,6 +246,90 @@
246246
{{ t('LabelNobookmarks') }}
247247
</h3>
248248
</v-card>
249+
<v-card class="pt-5">
250+
<v-list-item
251+
v-if="searchQuery && otherSearchItems && otherSearchItems.length">
252+
<v-list-item-avatar><v-icon>mdi-select-search</v-icon></v-list-item-avatar> {{ t('LabelSearchresultsotherfolders') }}
253+
</v-list-item>
254+
</v-card>
255+
<v-list
256+
v-if="searchQuery && otherSearchItems && otherSearchItems.length"
257+
two-line
258+
class="list-full-height">
259+
<template v-for="item in otherSearchItems">
260+
<v-list-item
261+
:key="item.type+item.id"
262+
class="pl-3"
263+
dense
264+
@click="clickItem(item)">
265+
<v-list-item-avatar>
266+
<v-icon
267+
v-if="item.type === 'folder'"
268+
color="blue darken-1"
269+
large>
270+
mdi-folder
271+
</v-icon>
272+
<FaviconImage
273+
v-else
274+
:url="item.url"
275+
:use-network="useNetwork" />
276+
</v-list-item-avatar>
277+
278+
<v-list-item-content>
279+
<v-list-item-title>{{ item.title }}</v-list-item-title>
280+
<v-list-item-subtitle v-if="item.type === 'bookmark'">
281+
{{ item.url | hostname }}
282+
</v-list-item-subtitle>
283+
</v-list-item-content>
284+
285+
<v-list-item-action>
286+
<v-menu
287+
bottom
288+
left>
289+
<template #activator="{ on, attrs }">
290+
<v-btn
291+
icon
292+
v-bind="attrs"
293+
v-on="on">
294+
<v-icon>mdi-dots-vertical</v-icon>
295+
</v-btn>
296+
</template>
297+
298+
<v-list>
299+
<v-list-item @click="editItem(item)">
300+
<v-list-item-avatar>
301+
<v-icon>mdi-pencil</v-icon>
302+
</v-list-item-avatar>
303+
<v-list-item-title>
304+
{{ t('LabelEdititem') }}
305+
</v-list-item-title>
306+
</v-list-item>
307+
<v-list-item
308+
v-if="item.type === 'bookmark'"
309+
@click="shareBookmark(item)">
310+
<v-list-item-avatar>
311+
<v-icon>mdi-share</v-icon>
312+
</v-list-item-avatar>
313+
<v-list-item-title>
314+
{{ t('LabelShareitem') }}
315+
</v-list-item-title>
316+
</v-list-item>
317+
<v-list-item @click="deleteItem(item)">
318+
<v-list-item-avatar>
319+
<v-icon>mdi-delete</v-icon>
320+
</v-list-item-avatar>
321+
<v-list-item-title>
322+
{{ t('LabelDeleteitem') }}
323+
</v-list-item-title>
324+
</v-list-item>
325+
</v-list>
326+
</v-menu>
327+
</v-list-item-action>
328+
</v-list-item>
329+
<v-divider
330+
:key="String(item.id)+item.type+'divider'" />
331+
</template>
332+
</v-list>
249333
<v-speed-dial
250334
v-model="fab"
251335
fixed
@@ -430,6 +514,12 @@ export default {
430514
return items
431515
}
432516
},
517+
otherSearchItems() {
518+
if (!this.currentFolder && (!this.searchQuery || this.searchQuery.length < 2)) {
519+
return []
520+
}
521+
return this.search(this.searchQuery.toLowerCase().trim(), this.tree).filter(item => !this.items.includes(item))
522+
},
433523
routes() {
434524
return routes
435525
},
@@ -646,4 +736,8 @@ export default {
646736
top: 30px;
647737
left: 30px;
648738
}
739+
740+
.list-full-height {
741+
min-height: 95vh;
742+
}
649743
</style>

0 commit comments

Comments
 (0)