2022-08-28 20:12:38 +02:00
|
|
|
<template>
|
|
|
|
<div v-if="item" class="w-full flex items-center px-4 py-2" :class="wrapperClass" @mouseover="mouseover" @mouseleave="mouseleave">
|
|
|
|
<covers-preview-cover :src="coverUrl" :width="48" :book-cover-aspect-ratio="bookCoverAspectRatio" :show-resolution="false" />
|
|
|
|
<div class="flex-grow px-2 py-1 queue-item-row-content truncate">
|
|
|
|
<p class="text-gray-200 text-sm truncate">{{ title }}</p>
|
2022-09-02 00:11:57 +02:00
|
|
|
<p class="text-gray-300 text-sm">{{ subtitle }}</p>
|
|
|
|
<p v-if="caption" class="text-gray-400 text-xs">{{ caption }}</p>
|
2022-08-28 20:12:38 +02:00
|
|
|
</div>
|
|
|
|
<div class="w-28">
|
2022-11-12 23:48:35 +01:00
|
|
|
<p v-if="isOpenInPlayer" class="text-sm text-right text-gray-400">{{ $strings.ButtonPlaying }}</p>
|
2022-08-28 20:12:38 +02:00
|
|
|
<div v-else-if="isHovering" class="flex items-center justify-end -mx-1">
|
|
|
|
<button class="outline-none mx-1 flex items-center" @click.stop="playClick">
|
2024-07-09 00:00:16 +02:00
|
|
|
<span class="material-symbols fill text-2xl text-success">play_arrow</span>
|
2022-08-28 20:12:38 +02:00
|
|
|
</button>
|
|
|
|
<button class="outline-none mx-1 flex items-center" @click.stop="removeClick">
|
2024-07-08 18:36:37 +02:00
|
|
|
<span class="material-symbols text-2xl text-error">close</span>
|
2022-08-28 20:12:38 +02:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<p v-else class="text-gray-400 text-sm text-right">{{ durationPretty }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
|
|
|
},
|
|
|
|
index: Number
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isHovering: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
title() {
|
|
|
|
return this.item.title || ''
|
|
|
|
},
|
|
|
|
subtitle() {
|
|
|
|
return this.item.subtitle || ''
|
|
|
|
},
|
2022-09-02 00:11:57 +02:00
|
|
|
caption() {
|
|
|
|
return this.item.caption
|
|
|
|
},
|
2022-08-28 20:12:38 +02:00
|
|
|
libraryItemId() {
|
|
|
|
return this.item.libraryItemId
|
|
|
|
},
|
|
|
|
episodeId() {
|
|
|
|
return this.item.episodeId
|
|
|
|
},
|
|
|
|
coverPath() {
|
|
|
|
return this.item.coverPath
|
|
|
|
},
|
|
|
|
coverUrl() {
|
2022-10-01 23:07:30 +02:00
|
|
|
if (!this.coverPath) return `${this.$config.routerBasePath}/book_placeholder.jpg`
|
2022-08-28 20:12:38 +02:00
|
|
|
return this.$store.getters['globals/getLibraryItemCoverSrcById'](this.libraryItemId)
|
|
|
|
},
|
|
|
|
bookCoverAspectRatio() {
|
|
|
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
|
|
|
},
|
|
|
|
duration() {
|
|
|
|
return this.item.duration
|
|
|
|
},
|
|
|
|
durationPretty() {
|
|
|
|
if (!this.duration) return 'N/A'
|
|
|
|
return this.$elapsedPretty(this.duration)
|
|
|
|
},
|
|
|
|
isOpenInPlayer() {
|
|
|
|
return this.$store.getters['getIsMediaStreaming'](this.libraryItemId, this.episodeId)
|
|
|
|
},
|
|
|
|
wrapperClass() {
|
|
|
|
if (this.isOpenInPlayer) return 'bg-yellow-400 bg-opacity-10'
|
|
|
|
if (this.index % 2 === 0) return 'bg-gray-300 bg-opacity-5 hover:bg-opacity-10'
|
|
|
|
return 'bg-bg hover:bg-gray-300 hover:bg-opacity-10'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
mouseover() {
|
|
|
|
this.isHovering = true
|
|
|
|
},
|
|
|
|
mouseleave() {
|
|
|
|
this.isHovering = false
|
|
|
|
},
|
|
|
|
playClick() {
|
|
|
|
this.$emit('play', this.item)
|
|
|
|
},
|
|
|
|
removeClick() {
|
|
|
|
this.$emit('remove', this.item)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.queue-item-row-content {
|
|
|
|
max-width: calc(100% - 48px - 128px);
|
|
|
|
}
|
|
|
|
</style>
|