2021-08-21 23:23:35 +02:00
|
|
|
<template>
|
2022-01-04 14:36:52 +01:00
|
|
|
<div class="flex items-center h-full px-1 overflow-hidden">
|
2022-03-13 18:39:12 +01:00
|
|
|
<covers-book-cover :library-item="libraryItem" :width="coverWidth" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
2021-10-17 18:29:52 +02:00
|
|
|
<div class="flex-grow px-2 audiobookSearchCardContent">
|
2024-07-25 08:40:18 +02:00
|
|
|
<p class="truncate text-sm">{{ title }}</p>
|
|
|
|
<p v-if="subtitle" class="truncate text-xs text-gray-300">{{ subtitle }}</p>
|
|
|
|
<p class="text-xs text-gray-200 truncate">{{ $getString('LabelByAuthor', [authorName]) }}</p>
|
2021-08-21 23:23:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2022-03-13 18:39:12 +01:00
|
|
|
libraryItem: {
|
2021-08-21 23:23:35 +02:00
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
2024-07-25 08:40:18 +02:00
|
|
|
}
|
2021-08-21 23:23:35 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-12-03 02:02:38 +01:00
|
|
|
bookCoverAspectRatio() {
|
2022-08-13 20:56:37 +02:00
|
|
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
2021-12-03 02:02:38 +01:00
|
|
|
},
|
|
|
|
coverWidth() {
|
|
|
|
if (this.bookCoverAspectRatio === 1) return 50 * 1.2
|
|
|
|
return 50
|
|
|
|
},
|
2022-03-13 18:39:12 +01:00
|
|
|
media() {
|
|
|
|
return this.libraryItem ? this.libraryItem.media || {} : {}
|
|
|
|
},
|
2022-04-12 23:54:52 +02:00
|
|
|
mediaType() {
|
|
|
|
return this.libraryItem ? this.libraryItem.mediaType : null
|
|
|
|
},
|
|
|
|
isPodcast() {
|
|
|
|
return this.mediaType == 'podcast'
|
|
|
|
},
|
2022-03-13 18:39:12 +01:00
|
|
|
mediaMetadata() {
|
|
|
|
return this.media.metadata || {}
|
2021-08-21 23:23:35 +02:00
|
|
|
},
|
|
|
|
title() {
|
2022-03-13 18:39:12 +01:00
|
|
|
return this.mediaMetadata.title || 'No Title'
|
2021-08-21 23:23:35 +02:00
|
|
|
},
|
2021-10-17 18:29:52 +02:00
|
|
|
subtitle() {
|
2022-03-13 18:39:12 +01:00
|
|
|
return this.mediaMetadata.subtitle || ''
|
|
|
|
},
|
|
|
|
authorName() {
|
2022-04-12 23:54:52 +02:00
|
|
|
if (this.isPodcast) return this.mediaMetadata.author || 'Unknown'
|
|
|
|
return this.mediaMetadata.authorName || 'Unknown'
|
2021-08-21 23:23:35 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2021-10-17 18:29:52 +02:00
|
|
|
.audiobookSearchCardContent {
|
2021-08-21 23:23:35 +02:00
|
|
|
width: calc(100% - 80px);
|
2021-10-17 18:29:52 +02:00
|
|
|
height: 75px;
|
2021-08-21 23:23:35 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
2024-05-14 00:25:01 +02:00
|
|
|
</style>
|