Persist bookshelf list view setting, fix collections for new data model, add authors cards, update filters

This commit is contained in:
advplyr
2022-04-08 19:05:32 -05:00
parent f309e1fcf2
commit 9ad351f0d7
18 changed files with 296 additions and 67 deletions
+3 -2
View File
@@ -4,10 +4,11 @@
<script>
export default {
asyncData({ store, params, query }) {
async asyncData({ store, params, query }) {
// Set filter by
if (query.filter) {
store.dispatch('user/updateUserSettings', { mobileFilterBy: query.filter })
store.commit('user/setSettings', { mobileFilterBy: query.filter })
await store.dispatch('user/updateUserSettings', { mobileFilterBy: query.filter })
}
}
}
+10 -1
View File
@@ -4,8 +4,17 @@
<script>
export default {
asyncData({ params }) {
async asyncData({ params, app, store }) {
var series = await app.$axios.$get(`/api/series/${params.id}`).catch((error) => {
console.error('Failed', error)
return false
})
if (!series) {
return redirect('/oops?message=Series not found')
}
store.commit('globals/setSeries', series)
return {
series,
seriesId: params.id
}
},
+6 -22
View File
@@ -18,10 +18,6 @@
</ui-btn>
</div>
<!-- <ui-icon-btn icon="edit" class="mx-0.5" @click="editClick" />
<ui-icon-btn icon="delete" class="mx-0.5" @click="removeClick" /> -->
<div class="my-8 max-w-2xl">
<p class="text-base text-gray-100">{{ description }}</p>
</div>
@@ -75,7 +71,7 @@ export default {
},
playableBooks() {
return this.bookItems.filter((book) => {
return !book.isMissing && !book.isIncomplete && book.numTracks
return !book.isMissing && !book.isInvalid && book.media.tracks.length
})
},
streaming() {
@@ -83,28 +79,16 @@ export default {
},
showPlayButton() {
return this.playableBooks.length
},
userAudiobooks() {
return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {}
}
},
methods: {
clickPlay() {
var nextBookNotRead = this.playableBooks.find((pb) => !this.userAudiobooks[pb.id] || !this.userAudiobooks[pb.id].isRead)
var nextBookNotRead = this.playableBooks.find((pb) => {
var prog = this.$store.getters['user/getUserMediaProgress'](pb.id)
return !prog || !prog.isFinished
})
if (nextBookNotRead) {
var dlObj = this.$store.getters['downloads/getDownload'](nextBookNotRead.id)
this.$store.commit('setPlayOnLoad', true)
if (dlObj && !dlObj.isDownloading && !dlObj.isPreparing) {
// Local
console.log('[PLAYCLICK] Set Playing Local Download ' + nextBookNotRead.book.title)
this.$store.commit('setPlayingDownload', dlObj)
} else {
// Stream
console.log('[PLAYCLICK] Set Playing STREAM ' + nextBookNotRead.book.title)
this.$store.commit('setStreamAudiobook', nextBookNotRead)
this.$server.socket.emit('open_stream', nextBookNotRead.id)
}
this.$eventBus.$emit('play-item', nextBookNotRead.id)
}
}
},
+1 -1
View File
@@ -164,7 +164,7 @@ export default {
return this.$store.getters['user/getToken']
},
userItemProgress() {
return this.$store.getters['user/getUserLibraryItemProgress'](this.libraryItemId)
return this.$store.getters['user/getUserMediaProgress'](this.libraryItemId)
},
userIsFinished() {
return this.userItemProgress ? !!this.userItemProgress.isFinished : false