2021-11-14 19:59:34 -06:00
|
|
|
<template>
|
|
|
|
<div class="w-full px-2 py-2 overflow-hidden relative">
|
2022-08-27 15:54:13 -05:00
|
|
|
<nuxt-link v-if="book" :to="`/item/${book.id}`" class="flex w-full">
|
2021-12-05 18:31:47 -06:00
|
|
|
<div class="h-full relative" :style="{ width: bookWidth + 'px' }">
|
2022-04-08 19:05:32 -05:00
|
|
|
<covers-book-cover :library-item="book" :width="bookWidth" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
2021-11-14 19:59:34 -06:00
|
|
|
</div>
|
2022-07-04 14:59:56 -05:00
|
|
|
<div class="flex-grow book-table-content h-full px-2 flex items-center">
|
|
|
|
<div class="max-w-full">
|
2022-08-27 15:54:13 -05:00
|
|
|
<p class="truncate block text-sm">{{ bookTitle }}</p>
|
2022-04-08 19:05:32 -05:00
|
|
|
<p class="truncate block text-gray-400 text-xs">{{ bookAuthor }}</p>
|
2022-07-04 14:59:56 -05:00
|
|
|
<p class="text-xxs text-gray-500">{{ bookDuration }}</p>
|
2021-11-14 19:59:34 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-27 15:54:13 -05:00
|
|
|
</nuxt-link>
|
2021-11-14 19:59:34 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
collectionId: String,
|
|
|
|
book: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isProcessingReadUpdate: false,
|
|
|
|
processingRemove: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2022-04-08 19:05:32 -05:00
|
|
|
media() {
|
|
|
|
return this.book.media || {}
|
2021-12-05 18:31:47 -06:00
|
|
|
},
|
2022-04-08 19:05:32 -05:00
|
|
|
mediaMetadata() {
|
|
|
|
return this.media.metadata || {}
|
2021-12-05 18:31:47 -06:00
|
|
|
},
|
2022-04-08 19:05:32 -05:00
|
|
|
tracks() {
|
|
|
|
return this.media.tracks || []
|
2021-11-14 19:59:34 -06:00
|
|
|
},
|
|
|
|
bookTitle() {
|
2022-04-08 19:05:32 -05:00
|
|
|
return this.mediaMetadata.title || ''
|
2021-11-14 19:59:34 -06:00
|
|
|
},
|
|
|
|
bookAuthor() {
|
2022-04-08 19:05:32 -05:00
|
|
|
return this.mediaMetadata.authorName || ''
|
2021-11-14 19:59:34 -06:00
|
|
|
},
|
|
|
|
bookDuration() {
|
2022-07-04 14:59:56 -05:00
|
|
|
return this.$elapsedPretty(this.media.duration)
|
2022-04-08 19:05:32 -05:00
|
|
|
},
|
|
|
|
bookCoverAspectRatio() {
|
|
|
|
return this.$store.getters['getBookCoverAspectRatio']
|
|
|
|
},
|
|
|
|
bookWidth() {
|
2022-07-04 14:59:56 -05:00
|
|
|
if (this.bookCoverAspectRatio === 1) return 50
|
2022-04-08 19:05:32 -05:00
|
|
|
return 50
|
2021-11-14 19:59:34 -06:00
|
|
|
},
|
|
|
|
isMissing() {
|
|
|
|
return this.book.isMissing
|
|
|
|
},
|
|
|
|
isIncomplete() {
|
|
|
|
return this.book.isIncomplete
|
|
|
|
},
|
|
|
|
numTracks() {
|
|
|
|
return this.book.numTracks
|
|
|
|
},
|
|
|
|
isStreaming() {
|
2022-04-10 20:31:47 -05:00
|
|
|
return this.$store.getters['getIsItemStreaming'](this.book.id)
|
2021-11-14 19:59:34 -06:00
|
|
|
},
|
|
|
|
showPlayBtn() {
|
|
|
|
return !this.isMissing && !this.isIncomplete && !this.isStreaming && this.numTracks
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
clickEdit() {
|
|
|
|
this.$emit('edit', this.book)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
2022-07-04 14:59:56 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.book-table-content {
|
|
|
|
width: calc(100% - 50px);
|
|
|
|
max-width: calc(100% - 50px);
|
|
|
|
}
|
|
|
|
</style>
|