Fix playlist cover for single item playlsit

This commit is contained in:
advplyr 2022-11-27 14:35:55 -06:00
parent 083f8faa46
commit 232a80a848

View File

@ -2,7 +2,7 @@
<div class="relative rounded-sm overflow-hidden" :style="{ width: width + 'px', height: height + 'px' }"> <div class="relative rounded-sm overflow-hidden" :style="{ width: width + 'px', height: height + 'px' }">
<div v-if="items.length" class="flex flex-wrap justify-center h-full relative bg-primary bg-opacity-95 rounded-sm"> <div v-if="items.length" class="flex flex-wrap justify-center h-full relative bg-primary bg-opacity-95 rounded-sm">
<div class="absolute top-0 left-0 w-full h-full bg-gray-400 bg-opacity-5" /> <div class="absolute top-0 left-0 w-full h-full bg-gray-400 bg-opacity-5" />
<covers-book-cover v-for="li in libraryItemCovers" :key="li.id" :library-item="li" :width="width / 2" :book-cover-aspect-ratio="1" /> <covers-book-cover v-for="li in libraryItemCovers" :key="li.id" :library-item="li" :width="itemCoverWidth" :book-cover-aspect-ratio="1" />
</div> </div>
<div v-else class="relative w-full h-full flex items-center justify-center p-2 bg-primary rounded-sm"> <div v-else class="relative w-full h-full flex items-center justify-center p-2 bg-primary rounded-sm">
<div class="absolute top-0 left-0 w-full h-full bg-gray-400 bg-opacity-5" /> <div class="absolute top-0 left-0 w-full h-full bg-gray-400 bg-opacity-5" />
@ -28,6 +28,10 @@ export default {
sizeMultiplier() { sizeMultiplier() {
return this.width / (120 * 1.6 * 2) return this.width / (120 * 1.6 * 2)
}, },
itemCoverWidth() {
if (this.libraryItemCovers.length === 1) return this.width
return this.width / 2
},
libraryItemCovers() { libraryItemCovers() {
if (!this.items.length) return [] if (!this.items.length) return []
if (this.items.length === 1) return [this.items[0].libraryItem] if (this.items.length === 1) return [this.items[0].libraryItem]