From 021538820ac7d468cc99bc6d9e3db9ed646cddab Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 12 Apr 2022 18:40:35 -0500 Subject: [PATCH] Update sorting/filtering for podcasts, show sort line on bookshelf list view, update podcast episode UI --- components/cards/LazyListBookCard.vue | 9 +++--- components/home/BookshelfToolbar.vue | 4 +++ components/modals/FilterModal.vue | 25 ++++++++++++++- components/modals/OrderModal.vue | 35 ++++++++++++++++++++- components/tables/podcast/EpisodeRow.vue | 12 +++---- components/tables/podcast/EpisodesTable.vue | 2 ++ mixins/bookshelfCardsHelpers.js | 5 +++ pages/item/_id.vue | 5 +-- 8 files changed, 81 insertions(+), 16 deletions(-) diff --git a/components/cards/LazyListBookCard.vue b/components/cards/LazyListBookCard.vue index 6ffbc7ec..5fca7b73 100644 --- a/components/cards/LazyListBookCard.vue +++ b/components/cards/LazyListBookCard.vue @@ -22,7 +22,7 @@

{{ displayTitle }} #{{ seriesSequence }}

-

{{ displayAuthor }}

+

by {{ displayAuthor }}

{{ displaySortLine }}

@@ -150,10 +150,11 @@ export default { return Math.max(2, 3 * this.sizeMultiplier) }, author() { - return this.mediaMetadata.authorName || '' + if (this.isPodcast) return this.mediaMetadata.author || 'Unknown' + return this.mediaMetadata.authorName || 'Unknown' }, authorLF() { - return this.mediaMetadata.authorNameLF || '' + return this.mediaMetadata.authorNameLF || 'Unknown' }, series() { // Only included when filtering by series or collapse series @@ -177,6 +178,7 @@ export default { return this.title }, displayAuthor() { + if (this.isPodcast) return this.author if (this.orderBy === 'media.metadata.authorNameLF') return this.authorLF return this.author }, @@ -184,7 +186,6 @@ export default { if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs) if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs) if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt) - if (this.orderBy === 'duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false) if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size) return null }, diff --git a/components/home/BookshelfToolbar.vue b/components/home/BookshelfToolbar.vue index cffa007a..6bcb8940 100644 --- a/components/home/BookshelfToolbar.vue +++ b/components/home/BookshelfToolbar.vue @@ -58,6 +58,7 @@ export default { return this.$route.query || {} }, entityTitle() { + if (this.isPodcast) return 'Podcasts' if (this.page === 'library') return 'Books' else if (this.page === 'series') { return 'Series' @@ -71,6 +72,9 @@ export default { return this.$store.state.globals.series.name } return null + }, + isPodcast() { + return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast' } }, methods: { diff --git a/components/modals/FilterModal.vue b/components/modals/FilterModal.vue index 83e95619..36b0e922 100644 --- a/components/modals/FilterModal.vue +++ b/components/modals/FilterModal.vue @@ -56,7 +56,7 @@ export default { data() { return { sublist: null, - items: [ + bookItems: [ { text: 'All', value: 'all' @@ -96,6 +96,22 @@ export default { value: 'issues', sublist: false } + ], + podcastItems: [ + { + text: 'All', + value: 'all' + }, + { + text: 'Genre', + value: 'genres', + sublist: true + }, + { + text: 'Tag', + value: 'tags', + sublist: true + } ] } }, @@ -124,6 +140,13 @@ export default { this.$emit('update:filterBy', val) } }, + isPodcast() { + return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast' + }, + items() { + if (this.isPodcast) return this.podcastItems + return this.bookItems + }, selectedItemSublist() { return this.selected && this.selected.includes('.') ? this.selected.split('.')[0] : false }, diff --git a/components/modals/OrderModal.vue b/components/modals/OrderModal.vue index 06f5bfc9..125f75bd 100644 --- a/components/modals/OrderModal.vue +++ b/components/modals/OrderModal.vue @@ -26,7 +26,7 @@ export default { }, data() { return { - items: [ + bookItems: [ { text: 'Title', value: 'media.metadata.title' @@ -47,6 +47,32 @@ export default { text: 'Size', value: 'size' } + ], + podcastItems: [ + { + text: 'Title', + value: 'media.metadata.title' + }, + { + text: 'Author', + value: 'media.metadata.author' + }, + { + text: 'Added At', + value: 'addedAt' + }, + { + text: 'Size', + value: 'size' + }, + { + text: 'File Birthtime', + value: 'birthtimeMs' + }, + { + text: 'File Modified', + value: 'mtimeMs' + } ] } }, @@ -74,6 +100,13 @@ export default { set(val) { this.$emit('update:descending', val) } + }, + isPodcast() { + return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast' + }, + items() { + if (this.isPodcast) return this.podcastItems + return this.bookItems } }, methods: { diff --git a/components/tables/podcast/EpisodeRow.vue b/components/tables/podcast/EpisodeRow.vue index 5f43b19c..24c8e0c9 100644 --- a/components/tables/podcast/EpisodeRow.vue +++ b/components/tables/podcast/EpisodeRow.vue @@ -1,12 +1,14 @@