Skip to content

Commit

Permalink
perf: Add text filter in active filter tooltip (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsluph authored Jun 28, 2023
1 parent e3e9300 commit b0d7a25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/components/Navbar/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
<v-slide-x-transition>
<v-speed-dial v-if="filterCount > 0" v-model="filters_fab" open-on-hover transition="slide-y-transition" direction="bottom" class="ml-5">
<template #activator>
<v-btn color="primary" rounded small v-model="filters_fab">{{ $t('navbar.active_tooltip.btn_label').replace('$0', filterCount) }}</v-btn>
<v-btn color="primary" rounded small v-model="filters_fab">{{ $t('navbar.active_filter.btn_label').replace('$0', filterCount) }}</v-btn>
</template>
<div class="d-flex flex-column align-start" style="width: 100%; row-gap: 8px">
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="dashboard.searchFilter.length > 0" small class="white--text caption">
{{ $t('navbar.active_filter.search_filter').replace('$0', dashboard.searchFilter) }}
</v-chip>
</template>
<span>{{ $t('status') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="sort_options.filter !== null" small :class="`torrent-${sort_options.filter}`" class="white--text caption">{{
Expand Down Expand Up @@ -105,7 +113,7 @@ export default {
},
computed: {
...mapGetters(['getWebuiSettings', 'getStatus', 'getTorrentCountString']),
...mapState(['sort_options']),
...mapState(['dashboard', 'sort_options']),
webuiSettings() {
return this.getWebuiSettings()
},
Expand All @@ -116,7 +124,7 @@ export default {
return this.getTorrentCountString()
},
filterCount() {
return (this.sort_options.filter !== null) + (this.sort_options.category !== null) + (this.sort_options.tag !== null) + (this.sort_options.tracker !== null)
return (this.dashboard.searchFilter.length > 0) + (this.sort_options.filter !== null) + (this.sort_options.category !== null) + (this.sort_options.tag !== null) + (this.sort_options.tracker !== null)
}
},
created() {
Expand Down
5 changes: 3 additions & 2 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@
"untagged": "(Untagged)",
"not_working": "(Not Working)"
},
"active_tooltip": {
"btn_label": "Filters active: $0"
"active_filter": {
"btn_label": "Filters active: $0",
"search_filter": "Text filter: $0"
},
"action": {
"altSpeed": "Alt Speeds",
Expand Down
2 changes: 1 addition & 1 deletion src/lang/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"untagged": "(未標籤)",
"not_working": "(無追蹤者)"
},
"active_tooltip": {
"active_filter": {
"btn_label": "啟用中的過濾器: $0"
},
"action": {
Expand Down

0 comments on commit b0d7a25

Please sign in to comment.