diff --git a/components/bookshelf/LazyBookshelf.vue b/components/bookshelf/LazyBookshelf.vue index 2eede182..70905d53 100644 --- a/components/bookshelf/LazyBookshelf.vue +++ b/components/bookshelf/LazyBookshelf.vue @@ -85,6 +85,12 @@ export default { filterBy() { return this.$store.getters['user/getUserSetting']('mobileFilterBy') }, + collapseSeries() { + return this.$store.getters['user/getUserSetting']('collapseSeries') + }, + collapseBookSeries() { + return this.$store.getters['user/getUserSetting']('collapseBookSeries') + }, isCoverSquareAspectRatio() { return this.bookCoverAspectRatio === 1 }, @@ -356,6 +362,9 @@ export default { let searchParams = new URLSearchParams() if (this.page === 'series-books') { searchParams.set('filter', `series.${this.$encode(this.seriesId)}`) + if (this.collapseBookSeries) { + searchParams.set('collapseseries', 1) + } } else { if (this.filterBy && this.filterBy !== 'all') { searchParams.set('filter', this.filterBy) diff --git a/components/cards/LazyBookCard.vue b/components/cards/LazyBookCard.vue index 606d45d1..4e96c4f4 100644 --- a/components/cards/LazyBookCard.vue +++ b/components/cards/LazyBookCard.vue @@ -10,11 +10,16 @@

{{ displayTitle }}

-

{{ displayAuthor || ' ' }}

+

{{ displayLineTwo || ' ' }}

{{ displaySortLine }}

-
{{ booksInSeries }}
+
+

#{{ seriesSequenceList }}

+
+
+

{{ booksInSeries }}

+
@@ -226,6 +231,13 @@ export default { // Only added to item object when collapseSeries is enabled return this.collapsedSeries ? this.collapsedSeries.numBooks : 0 }, + seriesSequenceList() { + return this.collapsedSeries ? this.collapsedSeries.seriesSequenceList : null + }, + libraryItemIdsInSeries() { + // Only added to item object when collapseSeries is enabled + return this.collapsedSeries ? this.collapsedSeries.libraryItemIds || [] : [] + }, displayTitle() { if (this.recentEpisode) return this.recentEpisode.title if (this.orderBy === 'media.metadata.title' && this.sortingIgnorePrefix && this.title.toLowerCase().startsWith('the ')) { @@ -233,16 +245,22 @@ export default { } return this.title }, - displayAuthor() { + displayLineTwo() { + if (this.recentEpisode) return this.title + if (this.collapsedSeries) return '' + if (this.isPodcast) return this.author + if (this.orderBy === 'media.metadata.authorNameLF') return this.authorLF return this.author }, displaySortLine() { + if (this.collapsedSeries) return null 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 === 'media.duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false) if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size) + if (this.orderBy === 'media.numTracks') return `${this.numEpisodes} Episodes` return null }, episodeProgress() { @@ -435,7 +453,7 @@ export default { const router = this.$router || this.$nuxt.$router if (router) { if (this.recentEpisode) router.push(`/item/${this.libraryItemId}/${this.recentEpisode.id}`) - else if (this.collapsedSeries) router.push(`/library/${this.libraryId}/series/${this.collapsedSeries.id}`) + else if (this.collapsedSeries) router.push(`/bookshelf/series/${this.collapsedSeries.id}`) else router.push(`/item/${this.libraryItemId}`) } } diff --git a/components/home/BookshelfToolbar.vue b/components/home/BookshelfToolbar.vue index 2def7d40..c6b09b4e 100644 --- a/components/home/BookshelfToolbar.vue +++ b/components/home/BookshelfToolbar.vue @@ -2,11 +2,8 @@
- - arrow_back -

{{ totalEntities }} {{ entityTitle }}

-

{{ selectedSeriesName }} ({{ totalEntities }})

+

{{ selectedSeriesName }} ({{ totalEntities }})

{{ !bookshelfListView ? 'view_list' : 'grid_view' }} + more_vert
+
@@ -31,7 +30,8 @@ export default { showSortModal: false, showFilterModal: false, settings: {}, - totalEntities: 0 + totalEntities: 0, + showMoreMenuDialog: false } }, computed: { @@ -44,6 +44,12 @@ export default { this.$store.commit('globals/setBookshelfListView', val) } }, + currentLibraryMediaType() { + return this.$store.getters['libraries/getCurrentLibraryMediaType'] + }, + isBookLibrary() { + return this.currentLibraryMediaType === 'book' + }, hasFilters() { return this.$store.getters['user/getUserSetting']('mobileFilterBy') !== 'all' }, @@ -79,9 +85,40 @@ export default { }, isPodcast() { return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast' + }, + menuItems() { + if (!this.isBookLibrary) return [] + + if (this.seriesBookPage) { + return [ + { + text: 'Collapse Sub-Series', + value: 'collapse_subseries', + icon: this.settings.collapseBookSeries ? 'check_box' : 'check_box_outline_blank' + } + ] + } else { + return [ + { + text: 'Collapse Series', + value: 'collapse_series', + icon: this.settings.collapseSeries ? 'check_box' : 'check_box_outline_blank' + } + ] + } } }, methods: { + clickMenuAction(action) { + this.showMoreMenuDialog = false + if (action === 'collapse_series') { + this.settings.collapseSeries = !this.settings.collapseSeries + this.saveSettings() + } else if (action === 'collapse_subseries') { + this.settings.collapseBookSeries = !this.settings.collapseBookSeries + this.saveSettings() + } + }, updateOrder() { this.saveSettings() }, diff --git a/store/user.js b/store/user.js index 6caa35ab..952fe450 100644 --- a/store/user.js +++ b/store/user.js @@ -5,7 +5,9 @@ export const state = () => ({ mobileOrderBy: 'addedAt', mobileOrderDesc: true, mobileFilterBy: 'all', - playbackRate: 1 + playbackRate: 1, + collapseSeries: false, + collapseBookSeries: false } })