2025-12-04 22:43:01 +01:00
|
|
|
<script setup lang="ts">
|
2026-01-24 18:35:40 +01:00
|
|
|
import { computed } from "vue";
|
2026-01-17 21:06:03 +01:00
|
|
|
import { Music, Play } from "lucide-vue-next";
|
|
|
|
|
import type { QueueItem } from "@/services/pmocontrol/types";
|
2026-01-24 18:35:40 +01:00
|
|
|
import { useCoverImage } from "@/composables/useCoverImage";
|
2025-12-04 22:43:01 +01:00
|
|
|
|
2026-01-17 21:06:03 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
|
item: QueueItem;
|
|
|
|
|
isCurrent: boolean;
|
|
|
|
|
}>();
|
2025-12-27 14:56:45 +01:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2026-01-17 21:06:03 +01:00
|
|
|
click: [item: QueueItem];
|
|
|
|
|
}>();
|
|
|
|
|
|
2026-01-24 18:35:40 +01:00
|
|
|
// Use the new cover image composable
|
|
|
|
|
const albumArtUri = computed(() => props.item.album_art_uri);
|
|
|
|
|
const {
|
|
|
|
|
imageLoaded,
|
|
|
|
|
imageError,
|
|
|
|
|
coverImageRef,
|
|
|
|
|
cacheBustedUrl,
|
|
|
|
|
handleImageLoad,
|
|
|
|
|
handleImageError,
|
|
|
|
|
} = useCoverImage(albumArtUri);
|
2025-12-27 14:56:45 +01:00
|
|
|
|
|
|
|
|
function handleClick(item: QueueItem) {
|
2026-01-17 21:06:03 +01:00
|
|
|
console.log("[QueueItem] Click detected on item:", item.index, item.title);
|
|
|
|
|
emit("click", item);
|
2025-12-27 14:56:45 +01:00
|
|
|
}
|
2025-12-04 22:43:01 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-01-17 21:06:03 +01:00
|
|
|
<div
|
|
|
|
|
:class="['queue-item', { current: isCurrent }]"
|
|
|
|
|
@click="handleClick(item)"
|
|
|
|
|
>
|
|
|
|
|
<!-- Indicateur piste en cours -->
|
|
|
|
|
<div class="current-indicator" v-if="isCurrent">
|
|
|
|
|
<Play :size="16" fill="currentColor" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Index (1-based pour l'affichage) -->
|
|
|
|
|
<span class="item-index">{{ item.index + 1 }}</span>
|
|
|
|
|
|
|
|
|
|
<!-- Cover miniature -->
|
|
|
|
|
<div class="item-cover">
|
|
|
|
|
<img
|
2026-01-21 20:01:42 +01:00
|
|
|
ref="coverImageRef"
|
2026-01-24 18:35:40 +01:00
|
|
|
:style="{
|
|
|
|
|
opacity:
|
|
|
|
|
cacheBustedUrl && imageLoaded && !imageError ? 1 : 0,
|
|
|
|
|
visibility:
|
|
|
|
|
cacheBustedUrl && imageLoaded && !imageError
|
|
|
|
|
? 'visible'
|
|
|
|
|
: 'hidden',
|
|
|
|
|
position:
|
|
|
|
|
cacheBustedUrl && imageLoaded && !imageError
|
|
|
|
|
? 'relative'
|
|
|
|
|
: 'absolute',
|
|
|
|
|
}"
|
|
|
|
|
:src="cacheBustedUrl || ''"
|
2026-01-17 21:06:03 +01:00
|
|
|
:alt="item.album || 'Album cover'"
|
|
|
|
|
class="cover-image"
|
|
|
|
|
@load="handleImageLoad"
|
|
|
|
|
@error="handleImageError"
|
|
|
|
|
/>
|
|
|
|
|
<Music
|
2026-01-24 18:35:40 +01:00
|
|
|
v-show="!cacheBustedUrl || imageError || !imageLoaded"
|
2026-01-17 21:06:03 +01:00
|
|
|
:size="20"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Métadonnées -->
|
|
|
|
|
<div class="item-metadata">
|
|
|
|
|
<div class="item-title">{{ item.title || "Sans titre" }}</div>
|
|
|
|
|
<div class="item-artist">
|
|
|
|
|
{{ item.artist || "Artiste inconnu" }}
|
|
|
|
|
<span v-if="item.album"> • {{ item.album }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-04 22:43:01 +01:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.queue-item {
|
2026-01-17 21:06:03 +01:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--spacing-md);
|
|
|
|
|
padding: var(--spacing-sm);
|
|
|
|
|
border-radius: var(--radius-md);
|
|
|
|
|
transition: background-color var(--transition-fast);
|
|
|
|
|
position: relative;
|
|
|
|
|
cursor: pointer;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.queue-item:hover {
|
2026-01-17 21:06:03 +01:00
|
|
|
background-color: var(--color-bg-secondary);
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.queue-item.current {
|
2026-01-17 21:06:03 +01:00
|
|
|
background-color: var(--status-playing-bg);
|
|
|
|
|
border: 1px solid var(--status-playing);
|
|
|
|
|
font-weight: 600;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.current-indicator {
|
2026-01-17 21:06:03 +01:00
|
|
|
position: absolute;
|
|
|
|
|
left: var(--spacing-xs);
|
|
|
|
|
color: var(--status-playing);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item-index {
|
2026-01-17 21:06:03 +01:00
|
|
|
font-size: var(--text-sm);
|
|
|
|
|
color: var(--color-text-secondary);
|
|
|
|
|
min-width: 2rem;
|
|
|
|
|
text-align: right;
|
|
|
|
|
font-variant-numeric: tabular-nums;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.queue-item.current .item-index {
|
2026-01-17 21:06:03 +01:00
|
|
|
margin-left: var(--spacing-lg);
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item-cover {
|
2026-01-17 21:06:03 +01:00
|
|
|
width: 48px;
|
|
|
|
|
height: 48px;
|
|
|
|
|
background-color: var(--color-bg-tertiary);
|
|
|
|
|
border-radius: var(--radius-sm);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
color: var(--color-text-tertiary);
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
overflow: hidden;
|
2025-12-05 22:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cover-image {
|
2026-01-17 21:06:03 +01:00
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
object-fit: cover;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item-metadata {
|
2026-01-17 21:06:03 +01:00
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item-title {
|
2026-01-17 21:06:03 +01:00
|
|
|
font-size: var(--text-base);
|
|
|
|
|
color: var(--color-text);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.queue-item.current .item-title {
|
2026-01-17 21:06:03 +01:00
|
|
|
color: var(--status-playing);
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item-artist {
|
2026-01-17 21:06:03 +01:00
|
|
|
font-size: var(--text-sm);
|
|
|
|
|
color: var(--color-text-secondary);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2025-12-04 22:43:01 +01:00
|
|
|
}
|
|
|
|
|
</style>
|