diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index a2339510..1141224a 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -19,7 +19,7 @@

{{ shelf.label }}

- +

{{ shelf.label }}

@@ -175,7 +175,6 @@ export default { } this.shelves = shelves }, - settingsUpdated(settings) {}, scan() { this.$store .dispatch('libraries/requestLibraryScan', { libraryId: this.$store.state.libraries.currentLibraryId }) @@ -192,8 +191,8 @@ export default { this.removeAllSeriesFromContinueSeries(user.seriesHideFromContinueListening) } if (user.mediaProgress.length) { - const libraryItemsToHide = user.mediaProgress.filter((mp) => mp.hideFromContinueListening).map((mp) => mp.libraryItemId) - this.removeAllItemsFromContinueListening(libraryItemsToHide) + const mediaProgressToHide = user.mediaProgress.filter((mp) => mp.hideFromContinueListening) + this.removeItemsFromContinueListening(mediaProgressToHide) } }, libraryItemAdded(libraryItem) { @@ -264,16 +263,33 @@ export default { } }) }, - removeAllItemsFromContinueListening(itemIds) { - this.shelves.forEach((shelf) => { - if (shelf.type == 'book' && shelf.id == 'continue-listening') { - // Filter out books from continue listening shelf - shelf.entities = shelf.entities.filter((ent) => { - if (itemIds.includes(ent.id)) return false + removeItemsFromContinueListening(mediaProgressItems) { + const continueListeningShelf = this.shelves.find((s) => s.id === 'continue-listening') + if (continueListeningShelf) { + if (continueListeningShelf.type === 'book') { + continueListeningShelf.entities = continueListeningShelf.entities.filter((ent) => { + if (mediaProgressItems.some((mp) => mp.libraryItemId === ent.id)) return false + return true + }) + } else if (continueListeningShelf.type === 'episode') { + continueListeningShelf.entities = continueListeningShelf.entities.filter((ent) => { + if (!ent.recentEpisode) return true // Should always have this here + if (mediaProgressItems.some((mp) => mp.libraryItemId === ent.id && mp.episodeId === ent.recentEpisode.id)) return false return true }) } - }) + } + // this.shelves.forEach((shelf) => { + // if (shelf.id == 'continue-listening') { + // if (shelf.type == 'book') { + // // Filter out books from continue listening shelf + // shelf.entities = shelf.entities.filter((ent) => { + // if (mediaProgressItems.some(mp => mp.libraryItemId === ent.id)) return false + // return true + // }) + // } + // } + // }) }, authorUpdated(author) { this.shelves.forEach((shelf) => { @@ -298,8 +314,6 @@ export default { }) }, initListeners() { - this.$store.commit('user/addSettingsListener', { id: 'bookshelf', meth: this.settingsUpdated }) - if (this.$root.socket) { this.$root.socket.on('user_updated', this.userUpdated) this.$root.socket.on('author_updated', this.authorUpdated) diff --git a/client/components/app/BookShelfRow.vue b/client/components/app/BookShelfRow.vue index a054709a..0c41efd7 100644 --- a/client/components/app/BookShelfRow.vue +++ b/client/components/app/BookShelfRow.vue @@ -9,7 +9,21 @@
diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 5231de62..a368707d 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -379,6 +379,12 @@ export default { text: `Mark as ${this.itemIsFinished ? 'Not Finished' : 'Finished'}` } ] + if (this.continueListeningShelf) { + items.push({ + func: 'removeFromContinueListening', + text: 'Remove from Continue Listening' + }) + } return items } @@ -630,7 +636,7 @@ export default { console.log('User updated', data) }) .catch((error) => { - console.error('Failed to hide series from home', error) + console.error('Failed to hide item from home', error) this.$toast.error('Failed to update user') }) .finally(() => { diff --git a/client/components/widgets/EpisodeSlider.vue b/client/components/widgets/EpisodeSlider.vue index 7b906a48..dae87a15 100644 --- a/client/components/widgets/EpisodeSlider.vue +++ b/client/components/widgets/EpisodeSlider.vue @@ -13,7 +13,22 @@
@@ -34,7 +49,8 @@ export default { bookshelfView: { type: Number, default: 1 - } + }, + continueListeningShelf: Boolean }, data() { return { diff --git a/server/utils/libraryHelpers.js b/server/utils/libraryHelpers.js index a7b8a6a4..36e21842 100644 --- a/server/utils/libraryHelpers.js +++ b/server/utils/libraryHelpers.js @@ -378,7 +378,7 @@ module.exports = { } categoryMap.recentlyFinished.biggest = categoryMap.recentlyFinished.items[0].finishedAt } - } else if (mediaProgress.progress > 0) { // Handle most recently listened + } else if (mediaProgress.inProgress && !mediaProgress.hideFromContinueListening) { // Handle most recently listened if (mediaProgress.lastUpdate > categoryMap.recentlyListened.smallest) { // Item belongs on shelf const libraryItemWithEpisode = { ...libraryItem.toJSONMinified(),