From abf140bd21c72dd2e5df118ab0488556a0b68c15 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 9 Apr 2022 20:29:59 -0500 Subject: [PATCH] UI updates --- components/cards/LazyBookCard.vue | 68 +++++++++++++++------------ components/cards/LazyListBookCard.vue | 32 ++++++++++--- components/home/BookshelfNavBar.vue | 57 +++++++++++++++++----- components/home/BookshelfToolbar.vue | 5 +- layouts/default.vue | 8 ++++ mixins/bookshelfCardsHelpers.js | 2 +- pages/bookshelf/index.vue | 8 +++- pages/item/_id.vue | 3 ++ plugins/server.js | 6 +++ store/user.js | 4 ++ 10 files changed, 142 insertions(+), 51 deletions(-) diff --git a/components/cards/LazyBookCard.vue b/components/cards/LazyBookCard.vue index 44fbda38..2f8d98bf 100644 --- a/components/cards/LazyBookCard.vue +++ b/components/cards/LazyBookCard.vue @@ -6,13 +6,13 @@ -
+
{{ booksInSeries }}
@@ -35,7 +35,7 @@
-
+
{{ isLocalOnly ? 'task' : 'download_done' }} @@ -49,8 +49,13 @@ -
-

#{{ volumeNumber }}

+
+

#{{ seriesSequence }}

+
+ + +
+

{{ numEpisodes }}

@@ -70,7 +75,7 @@ export default { default: 192 }, bookCoverAspectRatio: Number, - showVolumeNumber: Boolean, + showSequence: Boolean, bookshelfView: Number, bookMount: { // Book can be passed as prop or set with setEntity() @@ -122,6 +127,12 @@ export default { mediaMetadata() { return this.media.metadata || {} }, + mediaType() { + return this._libraryItem.mediaType + }, + isPodcast() { + return this.mediaType === 'podcast' + }, placeholderUrl() { return '/book_placeholder.jpg' }, @@ -135,9 +146,6 @@ export default { libraryItemId() { return this._libraryItem.id }, - series() { - return this.mediaMetadata.series - }, libraryId() { return this._libraryItem.libraryId }, @@ -147,6 +155,9 @@ export default { numTracks() { return this.media.numTracks }, + numEpisodes() { + return this.media.numEpisodes + }, processingBatch() { return this.store.state.processingBatch }, @@ -174,19 +185,26 @@ export default { return this.mediaMetadata.authors || [] }, author() { - return this.authors.map((au) => au.name).join(', ') + if (this.isPodcast) return this.mediaMetadata.author + return this.mediaMetadata.authorName }, authorLF() { - return this.authors - .map((au) => { - var parts = au.name.split(' ') - if (parts.length === 1) return parts[0] - return `${parts[1]}, ${parts[0]}` - }) - .join(', ') + return this.mediaMetadata.authorNameLF }, - volumeNumber() { - return this.mediaMetadata.volumeNumber || null + series() { + // Only included when filtering by series or collapse series + return this.mediaMetadata.series + }, + seriesSequence() { + return this.series ? this.series.sequence : null + }, + collapsedSeries() { + // Only added to item object when collapseSeries is enabled + return this._libraryItem.collapsedSeries + }, + booksInSeries() { + // Only added to item object when collapseSeries is enabled + return this.collapsedSeries ? this.collapsedSeries.numBooks : 0 }, displayTitle() { if (this.orderBy === 'media.metadata.title' && this.sortingIgnorePrefix && this.title.toLowerCase().startsWith('the ')) { @@ -308,16 +326,6 @@ export default { return this.author.slice(0, 27) + '...' } return this.author - }, - isAlternativeBookshelfView() { - return false - // var constants = this.$constants || this.$nuxt.$constants - // return this.bookshelfView === constants.BookshelfView.TITLES - }, - titleDisplayBottomOffset() { - if (!this.isAlternativeBookshelfView) return 0 - else if (!this.displaySortLine) return 3 * this.sizeMultiplier - return 4.25 * this.sizeMultiplier } }, methods: { @@ -340,7 +348,7 @@ export default { } else { var router = this.$router || this.$nuxt.$router if (router) { - if (this.booksInSeries) router.push(`/library/${this.libraryId}/series/${this.$encode(this.series)}`) + if (this.collapsedSeries) router.push(`/library/${this.libraryId}/series/${this.collapsedSeries.id}`) else router.push(`/item/${this.libraryItemId}`) } } diff --git a/components/cards/LazyListBookCard.vue b/components/cards/LazyListBookCard.vue index 09784df3..c9ad30d9 100644 --- a/components/cards/LazyListBookCard.vue +++ b/components/cards/LazyListBookCard.vue @@ -11,8 +11,8 @@
- -
+ +
{{ isLocalOnly ? 'task' : 'download_done' }} @@ -20,7 +20,7 @@

- {{ displayTitle }} + {{ displayTitle }} #{{ seriesSequence }}

{{ displayAuthor }}

{{ displaySortLine }}

@@ -44,7 +44,7 @@ export default { default: 192 }, bookCoverAspectRatio: Number, - showVolumeNumber: Boolean, + showSequence: Boolean, bookshelfView: Number, bookMount: { // Book can be passed as prop or set with setEntity() @@ -96,6 +96,12 @@ export default { mediaMetadata() { return this.media.metadata || {} }, + mediaType() { + return this._libraryItem.mediaType + }, + isPodcast() { + return this.mediaType === 'podcast' + }, placeholderUrl() { return '/book_placeholder.jpg' }, @@ -149,8 +155,20 @@ export default { authorLF() { return this.mediaMetadata.authorNameLF || '' }, - volumeNumber() { - return this.mediaMetadata.volumeNumber || null + series() { + // Only included when filtering by series or collapse series + return this.mediaMetadata.series + }, + seriesSequence() { + return this.series ? this.series.sequence : null + }, + collapsedSeries() { + // Only added to item object when collapseSeries is enabled + return this._libraryItem.collapsedSeries + }, + booksInSeries() { + // Only added to item object when collapseSeries is enabled + return this.collapsedSeries ? this.collapsedSeries.numBooks : 0 }, displayTitle() { if (this.orderBy === 'media.metadata.title' && this.sortingIgnorePrefix && this.title.toLowerCase().startsWith('the ')) { @@ -303,7 +321,7 @@ export default { } else { var router = this.$router || this.$nuxt.$router if (router) { - if (this.booksInSeries) router.push(`/library/${this.libraryId}/series/${this.$encode(this.series)}`) + if (this.collapsedSeries) router.push(`/library/${this.libraryId}/series/${this.collapsedSeries.id}`) else router.push(`/item/${this.libraryItemId}`) } } diff --git a/components/home/BookshelfNavBar.vue b/components/home/BookshelfNavBar.vue index 54e1f94c..fe6fc5e8 100644 --- a/components/home/BookshelfNavBar.vue +++ b/components/home/BookshelfNavBar.vue @@ -1,17 +1,8 @@