Skip to content

Commit 230b1e3

Browse files
authored
Merge pull request #41384 from nextcloud/41381-global-search-follow-up
Enhancements : improve most recent global search UI
2 parents 7791b48 + 987ac1e commit 230b1e3

File tree

5 files changed

+46
-26
lines changed

5 files changed

+46
-26
lines changed

core/src/components/GlobalSearch/SearchFilterChip.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default {
5252
width: 20px;
5353
padding: 2px;
5454
border-radius: 20px;
55+
filter: var(--background-invert-if-bright);
5556
}
5657
}
5758
@@ -63,8 +64,7 @@ export default {
6364
cursor: pointer;
6465
6566
:hover {
66-
border-radius: 4px;
67-
padding: 1px;
67+
filter: invert(20%);
6868
}
6969
}
7070
}

core/src/components/GlobalSearch/SearchableList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@show="opened = true"
2626
@hide="opened = false">
2727
<template #trigger>
28-
<slot name="trigger" />
28+
<slot ref="popoverTrigger" name="trigger" />
2929
</template>
3030
<div class="searchable-list__wrapper">
3131
<NcTextField :value.sync="searchTerm"

core/src/views/GlobalSearchModal.vue

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,19 @@
7575
<template #icon>
7676
<NcAvatar v-if="filter.type === 'person'"
7777
:user="filter.user"
78+
:size="24"
79+
:disable-menu="true"
7880
:show-user-status="false"
7981
:hide-favorite="false" />
8082
<CalendarRangeIcon v-else-if="filter.type === 'date'" />
8183
<img v-else :src="filter.icon" alt="">
8284
</template>
8385
</FilterChip>
8486
</div>
85-
<div v-if="searchQuery.length === 0">
86-
<NcEmptyContent :name="t('core', 'Start typing in search')">
87+
<div v-if="noContentInfo.show" class="global-search-modal__no-content">
88+
<NcEmptyContent :name="noContentInfo.text">
8789
<template #icon>
88-
<MagnifyIcon />
90+
<component :is="noContentInfo.icon" />
8991
</template>
9092
</NcEmptyContent>
9193
</div>
@@ -122,13 +124,13 @@
122124
</ul>
123125
<div class="result-footer">
124126
<NcButton type="tertiary-no-background" @click="loadMoreResultsForProvider(providerResult.id)">
125-
Load more results
127+
{{ t('core', 'Load more results') }}
126128
<template #icon>
127129
<DotsHorizontalIcon :size="20" />
128130
</template>
129131
</NcButton>
130-
<NcButton alignment="end-reverse" type="tertiary-no-background">
131-
Search in {{ providerResult.provider }}
132+
<NcButton v-if="providerResult.inAppSearch" alignment="end-reverse" type="tertiary-no-background">
133+
{{ t('core', 'Search in') }} {{ providerResult.provider }}
132134
<template #icon>
133135
<ArrowRight :size="20" />
134136
</template>
@@ -147,6 +149,7 @@ import CalendarRangeIcon from 'vue-material-design-icons/CalendarRange.vue'
147149
import CustomDateRangeModal from '../components/GlobalSearch/CustomDateRangeModal.vue'
148150
import DotsHorizontalIcon from 'vue-material-design-icons/DotsHorizontal.vue'
149151
import FilterChip from '../components/GlobalSearch/SearchFilterChip.vue'
152+
import FlaskEmpty from 'vue-material-design-icons/FlaskEmpty.vue'
150153
import ListBox from 'vue-material-design-icons/ListBox.vue'
151154
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
152155
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
@@ -171,6 +174,7 @@ export default {
171174
CustomDateRangeModal,
172175
DotsHorizontalIcon,
173176
FilterChip,
177+
FlaskEmpty,
174178
ListBox,
175179
NcActions,
176180
NcActionButton,
@@ -216,9 +220,19 @@ export default {
216220
get() {
217221
return this.contacts
218222
},
219-
220223
},
224+
noContentInfo: {
225+
get() {
226+
const isEmptySearch = this.searchQuery.length === 0
227+
const hasNoResults = this.searchQuery.length > 0 && this.results.length === 0
221228
229+
return {
230+
show: isEmptySearch || hasNoResults,
231+
text: isEmptySearch ? t('core', 'Start typing in search') : t('core', 'No matching results'),
232+
icon: isEmptySearch ? MagnifyIcon : FlaskEmpty,
233+
}
234+
},
235+
},
222236
},
223237
mounted() {
224238
getProviders().then((providers) => {
@@ -257,7 +271,7 @@ export default {
257271
258272
if (filters.personFilterIsApplied) {
259273
if (provider.filters.person) {
260-
params.person = this.personFilter.id
274+
params.person = this.personFilter.user
261275
} else {
262276
// Person filter is applied but provider does not support it, no need to search provider
263277
return
@@ -274,6 +288,7 @@ export default {
274288
newResults.push({
275289
id: provider.id,
276290
provider: provider.name,
291+
inAppSearch: provider.inAppSearch,
277292
results: response.data.ocs.data.entries,
278293
})
279294
@@ -378,7 +393,7 @@ export default {
378393
this.providerActionMenuIsOpen = false
379394
const existingFilter = this.filteredProviders.find(existing => existing.id === providerFilter.id)
380395
if (!existingFilter) {
381-
this.filteredProviders.push({ id: providerFilter.id, name: providerFilter.name, icon: providerFilter.icon, type: 'provider' })
396+
this.filteredProviders.push({ id: providerFilter.id, name: providerFilter.name, icon: providerFilter.icon, type: 'provider', filters: providerFilter.filters })
382397
}
383398
this.filters = this.syncProviderFilters(this.filters, this.filteredProviders)
384399
console.debug('Search filters (newly added)', this.filters)
@@ -397,9 +412,13 @@ export default {
397412
398413
} else {
399414
for (let i = 0; i < this.filters.length; i++) {
400-
if (this.filters[i].id === 'date') {
415+
// Remove date and person filter
416+
if (this.filters[i].id === 'date' || this.filters[i].id === filter.id) {
401417
this.dateFilterIsApplied = false
402418
this.filters.splice(i, 1)
419+
if (filter.type === 'person') {
420+
this.personFilterIsApplied = false
421+
}
403422
break
404423
}
405424
}
@@ -520,27 +539,28 @@ $margin: 10px;
520539
521540
&__filters {
522541
display: flex;
523-
padding-top: 5px;
524-
justify-content: space-between;
525-
526-
>*:not(:last-child) {
527-
// flex: 1;
528-
margin-right: 0.5m;
529-
}
542+
padding-top: 4px;
543+
justify-content: left;
530544
531545
>* {
532-
button {
533-
min-width: 160px;
534-
}
546+
margin-right: 4px;
547+
535548
}
536549
537550
}
538551
539552
&__filters-applied {
553+
padding-top: 4px;
540554
display: flex;
541555
flex-wrap: wrap;
542556
}
543557
558+
&__no-content {
559+
display: flex;
560+
align-items: center;
561+
height: 100%;
562+
}
563+
544564
&__results {
545565
padding: 10px;
546566

dist/core-global-search.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-global-search.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)