diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 0bd4ba9c..c4625253 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -15,7 +15,14 @@ settings - + + + {{ username }} + + + person + +
@@ -35,17 +42,6 @@ export default { data() { return { - menuItems: [ - { - value: 'account', - text: 'Account', - to: '/account' - }, - { - value: 'logout', - text: 'Logout' - } - ], processingBatchDelete: false } }, @@ -83,20 +79,6 @@ export default { this.$router.push('/') } }, - logout() { - this.$axios.$post('/logout').catch((error) => { - console.error(error) - }) - if (localStorage.getItem('token')) { - localStorage.removeItem('token') - } - this.$router.push('/login') - }, - menuAction(action) { - if (action === 'logout') { - this.logout() - } - }, cancelSelectionMode() { if (this.processingBatchDelete) return this.$store.commit('setSelectedAudiobooks', []) diff --git a/client/components/app/BookShelf.vue b/client/components/app/BookShelf.vue index 6a7a96a6..7337f040 100644 --- a/client/components/app/BookShelf.vue +++ b/client/components/app/BookShelf.vue @@ -24,6 +24,10 @@
+
+
No Audiobooks
+ Clear Filter +
@@ -38,10 +42,19 @@ export default { currFilterOrderKey: null, availableSizes: [60, 80, 100, 120, 140, 160, 180, 200, 220], selectedSizeIndex: 3, - rowPaddingX: 40 + rowPaddingX: 40, + keywordFilterTimeout: null + } + }, + watch: { + keywordFilter() { + this.checkKeywordFilter() } }, computed: { + keywordFilter() { + return this.$store.state.audiobooks.keywordFilter + }, userAudiobooks() { return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {} }, @@ -65,9 +78,28 @@ export default { }, isSelectionMode() { return this.$store.getters['getNumAudiobooksSelected'] + }, + filterBy() { + return this.$store.getters['user/getUserSetting']('filterBy') } }, methods: { + clearFilter() { + this.$store.commit('audiobooks/setKeywordFilter', null) + if (this.filterBy !== 'all') { + this.$store.dispatch('user/updateUserSettings', { + filterBy: 'all' + }) + } else { + this.setGroupedBooks() + } + }, + checkKeywordFilter() { + clearTimeout(this.keywordFilterTimeout) + this.keywordFilterTimeout = setTimeout(() => { + this.setGroupedBooks() + }, 500) + }, increaseSize() { this.selectedSizeIndex = Math.min(this.availableSizes.length - 1, this.selectedSizeIndex + 1) this.resize() diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index 4024cf57..52ee09f8 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -3,9 +3,12 @@

{{ numShowing }} Audiobooks

- - by - + + + + + +
@@ -21,6 +24,14 @@ export default { computed: { numShowing() { return this.$store.getters['audiobooks/getFiltered']().length + }, + _keywordFilter: { + get() { + return this.$store.state.audiobooks.keywordFilter + }, + set(val) { + this.$store.commit('audiobooks/setKeywordFilter', val) + } } }, methods: { diff --git a/client/components/controls/FilterSelect.vue b/client/components/controls/FilterSelect.vue index a87fb3d8..1ffcdf34 100644 --- a/client/components/controls/FilterSelect.vue +++ b/client/components/controls/FilterSelect.vue @@ -42,9 +42,9 @@ @@ -81,6 +81,11 @@ export default { text: 'Series', value: 'series', sublist: true + }, + { + text: 'Authors', + value: 'authors', + sublist: true } ] } @@ -109,14 +114,15 @@ export default { if (!this.selected) return '' var parts = this.selected.split('.') if (parts.length > 1) { - return this.snakeToNormal(parts[1]) + return this.$decode(parts[1]) } var _sel = this.items.find((i) => i.value === this.selected) if (!_sel) return '' return _sel.text }, genres() { - return this.$store.state.audiobooks.genres + // return this.$store.state.audiobooks.genres + return this.$store.getters['audiobooks/getGenresUsed'] }, tags() { return this.$store.state.audiobooks.tags @@ -124,8 +130,16 @@ export default { series() { return this.$store.state.audiobooks.series }, + authors() { + return this.$store.getters['audiobooks/getUniqueAuthors'] + }, sublistItems() { - return this[this.sublist] || [] + return (this[this.sublist] || []).map((item) => { + return { + text: item, + value: this.$encode(item) + } + }) } }, methods: { @@ -134,15 +148,6 @@ export default { this.showMenu = false this.$nextTick(() => this.$emit('change', 'all')) }, - snakeToNormal(kebab) { - if (!kebab) { - return 'err' - } - return String(kebab) - .split('_') - .map((t) => t.slice(0, 1).toUpperCase() + t.slice(1)) - .join(' ') - }, clickOutside() { if (!this.selectedItemSublist) this.sublist = null this.showMenu = false diff --git a/client/components/ui/MultiSelect.vue b/client/components/ui/MultiSelect.vue index 1b7ccc75..0b2c6855 100644 --- a/client/components/ui/MultiSelect.vue +++ b/client/components/ui/MultiSelect.vue @@ -8,7 +8,7 @@
close
- {{ $snakeToNormal(item) }} + {{ item }} @@ -18,7 +18,7 @@