Include the type of filter being applied in the UI

This commit is contained in:
Selfhost Alt 2022-04-18 21:06:58 -07:00
parent 7ef44eb75b
commit f0615c2971
2 changed files with 17 additions and 11 deletions

View File

@ -91,7 +91,7 @@ export default {
emptyMessage() { emptyMessage() {
if (this.page === 'series') return `You have no series` if (this.page === 'series') return `You have no series`
if (this.page === 'collections') return "You haven't made any collections yet" if (this.page === 'collections') return "You haven't made any collections yet"
if (this.hasFilter) return `No Results for filter "${this.filterValue}"` if (this.hasFilter) return `No Results for filter "${this.filterName}: ${this.filterValue}"`
return 'No results' return 'No results'
}, },
entityName() { entityName() {

View File

@ -161,23 +161,29 @@ export default {
selectedText() { selectedText() {
if (!this.selected) return '' if (!this.selected) return ''
var parts = this.selected.split('.') var parts = this.selected.split('.')
var filterName = this.selectItems.find((i) => i.value === parts[0]);
var filterValue = null;
if (parts.length > 1) { if (parts.length > 1) {
var decoded = this.$decode(parts[1]) var decoded = this.$decode(parts[1])
if (decoded.startsWith('aut_')) { if (decoded.startsWith('aut_')) {
var author = this.authors.find((au) => au.id == decoded) var author = this.authors.find((au) => au.id == decoded)
if (author) return author.name if (author) filterValue = author.name;
return '' } else if (decoded.startsWith('ser_')) {
}
if (decoded.startsWith('ser_')) {
var series = this.series.find((se) => se.id == decoded) var series = this.series.find((se) => se.id == decoded)
if (series) return series.name if (series) filterValue = series.name
return '' } else {
filterValue = decoded;
} }
return decoded
} }
var _sel = this.selectItems.find((i) => i.value === this.selected) if (filterName && filterValue) {
if (!_sel) return '' return `${filterName.text}: ${filterValue}`;
return _sel.text } else if (filterName) {
return filterName.text;
} else if (filterValue) {
return filterValue;
} else {
return ''
}
}, },
genres() { genres() {
return this.filterData.genres || [] return this.filterData.genres || []