mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
New data model fix collections page & table
This commit is contained in:
parent
27f1bd90f9
commit
122f2a2556
@ -6,7 +6,7 @@
|
|||||||
<p class="font-mono text-sm">{{ books.length }}</p>
|
<p class="font-mono text-sm">{{ books.length }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow" />
|
<div class="flex-grow" />
|
||||||
<p v-if="totalDuration">{{ totalDurationPretty }}</p>
|
<!-- <p v-if="totalDuration">{{ totalDurationPretty }}</p> -->
|
||||||
</div>
|
</div>
|
||||||
<draggable v-model="booksCopy" v-bind="dragOptions" class="list-group" handle=".drag-handle" draggable=".item" tag="div" @start="drag = true" @end="drag = false" @update="draggableUpdate">
|
<draggable v-model="booksCopy" v-bind="dragOptions" class="list-group" handle=".drag-handle" draggable=".item" tag="div" @start="drag = true" @end="drag = false" @update="draggableUpdate">
|
||||||
<transition-group type="transition" :name="!drag ? 'collection-book' : null">
|
<transition-group type="transition" :name="!drag ? 'collection-book' : null">
|
||||||
@ -56,16 +56,6 @@ export default {
|
|||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
},
|
|
||||||
totalDuration() {
|
|
||||||
var _total = 0
|
|
||||||
this.books.forEach((book) => {
|
|
||||||
_total += book.duration
|
|
||||||
})
|
|
||||||
return _total
|
|
||||||
},
|
|
||||||
totalDurationPretty() {
|
|
||||||
return this.$elapsedPretty(this.totalDuration)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
<div class="w-80 h-full px-2 flex items-center">
|
<div class="w-80 h-full px-2 flex items-center">
|
||||||
<div>
|
<div>
|
||||||
<nuxt-link :to="`/item/${book.id}`" class="truncate hover:underline">{{ bookTitle }}</nuxt-link>
|
<nuxt-link :to="`/item/${book.id}`" class="truncate hover:underline">{{ bookTitle }}</nuxt-link>
|
||||||
<!-- <nuxt-link :to="`/library/${book.libraryId}/bookshelf?filter=authors.${$encode(bookAuthor)}`" class="truncate block text-gray-400 text-sm hover:underline">{{ bookAuthor }}</nuxt-link> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow flex items-center">
|
<div class="flex-grow flex items-center">
|
||||||
@ -89,8 +88,12 @@ export default {
|
|||||||
bookAuthor() {
|
bookAuthor() {
|
||||||
return (this.mediaMetadata.authors || []).map((au) => au.name).join(', ')
|
return (this.mediaMetadata.authors || []).map((au) => au.name).join(', ')
|
||||||
},
|
},
|
||||||
|
defaultAudiobook() {
|
||||||
|
if (!this.media.audiobooks.length) return null
|
||||||
|
return this.media.audiobooks[0]
|
||||||
|
},
|
||||||
bookDuration() {
|
bookDuration() {
|
||||||
return this.$secondsToTimestamp(this.media.duration)
|
return this.$secondsToTimestamp(this.defaultAudiobook.duration)
|
||||||
},
|
},
|
||||||
isMissing() {
|
isMissing() {
|
||||||
return this.book.isMissing
|
return this.book.isMissing
|
||||||
@ -98,14 +101,11 @@ export default {
|
|||||||
isInvalid() {
|
isInvalid() {
|
||||||
return this.book.isInvalid
|
return this.book.isInvalid
|
||||||
},
|
},
|
||||||
numTracks() {
|
|
||||||
return this.media.tracks.length
|
|
||||||
},
|
|
||||||
isStreaming() {
|
isStreaming() {
|
||||||
return this.$store.getters['getLibraryItemIdStreaming'] === this.book.id
|
return this.$store.getters['getLibraryItemIdStreaming'] === this.book.id
|
||||||
},
|
},
|
||||||
showPlayBtn() {
|
showPlayBtn() {
|
||||||
return !this.isMissing && !this.isInvalid && !this.isStreaming && this.numTracks
|
return !this.isMissing && !this.isInvalid && !this.isStreaming && this.defaultAudiobook
|
||||||
},
|
},
|
||||||
itemProgress() {
|
itemProgress() {
|
||||||
return this.$store.getters['user/getUserLibraryItemProgress'](this.book.id)
|
return this.$store.getters['user/getUserLibraryItemProgress'](this.book.id)
|
||||||
|
@ -83,7 +83,7 @@ export default {
|
|||||||
},
|
},
|
||||||
playableBooks() {
|
playableBooks() {
|
||||||
return this.bookItems.filter((book) => {
|
return this.bookItems.filter((book) => {
|
||||||
return !book.isMissing && !book.isInvalid && book.numTracks
|
return !book.isMissing && !book.isInvalid && book.media.audiobooks.length
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
streaming() {
|
streaming() {
|
||||||
@ -91,9 +91,6 @@ export default {
|
|||||||
},
|
},
|
||||||
showPlayButton() {
|
showPlayButton() {
|
||||||
return this.playableBooks.length
|
return this.playableBooks.length
|
||||||
},
|
|
||||||
userAudiobooks() {
|
|
||||||
return this.$store.state.user.user ? this.$store.state.user.user.audiobooks || {} : {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -118,7 +115,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
clickPlay() {
|
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/getUserLibraryItemProgress'](pb.id)
|
||||||
|
return !prog || !prog.isFinished
|
||||||
|
})
|
||||||
if (nextBookNotRead) {
|
if (nextBookNotRead) {
|
||||||
this.$eventBus.$emit('play-item', nextBookNotRead.id)
|
this.$eventBus.$emit('play-item', nextBookNotRead.id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user