Skip to content

Commit

Permalink
Enhancements : improve most recent global search UI
Browse files Browse the repository at this point in the history
- Fixes remove person filter/chip when applied
- Close person searchable filter via workaround
- Person filter has no effect fixed, now uses user property instead of id
- Left align filters
- Reduce avatar size in user chip and make photo non-clickable

Resolves : #41381

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
  • Loading branch information
Fenn-CS committed Nov 14, 2023
1 parent 6284009 commit 3d0802f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion core/src/components/GlobalSearch/SearchFilterChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default {
width: 20px;
padding: 2px;
border-radius: 20px;
filter: var(--background-invert-if-bright);
}
}
Expand All @@ -64,7 +65,6 @@ export default {
:hover {
border-radius: 4px;
padding: 1px;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/GlobalSearch/SearchableList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@show="opened = true"
@hide="opened = false">
<template #trigger>
<slot name="trigger" />
<slot ref="popoverTrigger" name="trigger" />
</template>
<div class="searchable-list__wrapper">
<NcTextField :value.sync="searchTerm"
Expand Down
35 changes: 21 additions & 14 deletions core/src/views/GlobalSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@
<template #icon>
<NcAvatar v-if="filter.type === 'person'"
:user="filter.user"
:size="24"
:disable-menu="true"
:show-user-status="false"
:hide-favorite="false" />
<CalendarRangeIcon v-else-if="filter.type === 'date'" />
<img v-else :src="filter.icon" alt="">
</template>
</FilterChip>
</div>
<div v-if="searchQuery.length === 0">
<div v-if="searchQuery.length === 0" class="global-search-modal__no-search">
<NcEmptyContent :name="t('core', 'Start typing in search')">
<template #icon>
<MagnifyIcon />
Expand Down Expand Up @@ -257,7 +259,7 @@ export default {
if (filters.personFilterIsApplied) {
if (provider.filters.person) {
params.person = this.personFilter.id
params.person = this.personFilter.user
} else {
// Person filter is applied but provider does not support it, no need to search provider
return
Expand Down Expand Up @@ -378,7 +380,7 @@ export default {
this.providerActionMenuIsOpen = false
const existingFilter = this.filteredProviders.find(existing => existing.id === providerFilter.id)
if (!existingFilter) {
this.filteredProviders.push({ id: providerFilter.id, name: providerFilter.name, icon: providerFilter.icon, type: 'provider' })
this.filteredProviders.push({ id: providerFilter.id, name: providerFilter.name, icon: providerFilter.icon, type: 'provider', filters: providerFilter.filters })
}
this.filters = this.syncProviderFilters(this.filters, this.filteredProviders)
console.debug('Search filters (newly added)', this.filters)
Expand All @@ -397,9 +399,13 @@ export default {
} else {
for (let i = 0; i < this.filters.length; i++) {
if (this.filters[i].id === 'date') {
// Remove date and person filter
if (this.filters[i].id === 'date' || this.filters[i].id === filter.id) {
this.dateFilterIsApplied = false
this.filters.splice(i, 1)
if (filter.type === 'person') {
this.personFilterIsApplied = false
}
break
}
}
Expand Down Expand Up @@ -520,27 +526,28 @@ $margin: 10px;
&__filters {
display: flex;
padding-top: 5px;
justify-content: space-between;
>*:not(:last-child) {
// flex: 1;
margin-right: 0.5m;
}
padding-top: 4px;
justify-content: left;
>* {
button {
min-width: 160px;
}
margin-right: 4px;
}
}
&__filters-applied {
padding-top: 4px;
display: flex;
flex-wrap: wrap;
}
&__no-search {
display: flex;
align-items: center;
height: 100%;
}
&__results {
padding: 10px;
Expand Down

0 comments on commit 3d0802f

Please sign in to comment.