bucket + card sharer
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<button
|
||||
class="play-button rounded-full size-24 flex items-center justify-center text-esyellow backdrop-blur-sm bg-black/25 transition-all duration-200 ease-in-out transform active:scale-90 scale-110 text-4xl font-bold"
|
||||
<button tabindex="-1"
|
||||
class="play-button pointer-events-none rounded-full size-24 flex items-center justify-center text-esyellow backdrop-blur-sm bg-black/25 transition-all duration-200 ease-in-out transform active:scale-90 scale-110 text-4xl font-bold"
|
||||
:class="{ loading: isLoading }" :disabled="isLoading">
|
||||
<template v-if="isLoading">
|
||||
<img src="/loader.svg" alt="Chargement" class="size-16" />
|
||||
@@ -12,40 +12,25 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { usePlayerStore } from '~/store/player'
|
||||
import { usePlatineStore } from '~/store/platine'
|
||||
import type { Box, Track } from '~/../types/types'
|
||||
|
||||
const playerStore = usePlayerStore()
|
||||
const platineStore = usePlatineStore()
|
||||
const props = defineProps<{ objectToPlay: Box | Track }>()
|
||||
|
||||
const isCurrentBox = computed(() => {
|
||||
if ('activeSide' in props.objectToPlay) {
|
||||
// Vérifier si la piste courante appartient à cette box
|
||||
if (playerStore.currentTrack?.boxId === props.objectToPlay.id) {
|
||||
// Si c'est une compilation, on vérifie le side actif
|
||||
if (props.objectToPlay.type === 'compilation') {
|
||||
return playerStore.currentTrack.side === props.objectToPlay.activeSide
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
const isCurrentTrack = computed(() => {
|
||||
if (!('activeSide' in props.objectToPlay)) {
|
||||
return playerStore.currentTrack?.id === props.objectToPlay.id
|
||||
return platineStore.currentTrack?.id === props.objectToPlay.id
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
const isPlaying = computed(() => {
|
||||
return playerStore.isPlaying && (isCurrentTrack.value || isCurrentBox.value)
|
||||
return platineStore.isPlaying && isCurrentTrack.value
|
||||
})
|
||||
|
||||
const isLoading = computed(() => {
|
||||
return playerStore.isLoading && (isCurrentTrack.value || isCurrentBox.value)
|
||||
return platineStore.isLoadingTrack && isCurrentTrack.value
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user