2024-04-04 22:20:42 +00:00
|
|
|
<template>
|
2024-06-03 05:22:16 +00:00
|
|
|
<footer class="h-[18vh] w-screen flex justify-around items-center border-t border-solid border-t-white/10 py-4">
|
|
|
|
<button
|
|
|
|
class="text-[5vmin] has-[.yep]:text-k-love"
|
2024-06-03 06:13:55 +00:00
|
|
|
data-testid="btn-toggle-favorite"
|
2024-06-03 05:22:16 +00:00
|
|
|
@click.prevent="toggleFavorite"
|
|
|
|
>
|
|
|
|
<Icon :class="playable.liked && 'yep'" :icon="playable.liked ? faHeart : faEmptyHeart" />
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button class="text-[6vmin]" data-testid="btn-play-prev" @click.prevent="playPrev">
|
2024-04-04 22:20:42 +00:00
|
|
|
<Icon :icon="faStepBackward" />
|
2024-06-03 05:22:16 +00:00
|
|
|
</button>
|
2024-04-04 22:20:42 +00:00
|
|
|
|
2024-06-03 05:22:16 +00:00
|
|
|
<button
|
2024-04-04 22:20:42 +00:00
|
|
|
class="text-[7vmin] w-[16vmin] aspect-square border border-solid border-k-text-primary rounded-full flex
|
|
|
|
items-center justify-center has-[.paused]:pl-[4px]"
|
2024-06-03 05:22:16 +00:00
|
|
|
data-testid="btn-toggle-playback"
|
2024-04-04 22:20:42 +00:00
|
|
|
@click.prevent="togglePlayback"
|
|
|
|
>
|
2024-04-23 21:01:27 +00:00
|
|
|
<Icon :class="playing || 'paused'" :icon="playing ? faPause : faPlay" />
|
2024-06-03 05:22:16 +00:00
|
|
|
</button>
|
2024-04-04 22:20:42 +00:00
|
|
|
|
2024-06-03 05:22:16 +00:00
|
|
|
<button class="text-[6vmin]" data-testid="btn-play-next" @click.prevent="playNext">
|
2024-04-04 22:20:42 +00:00
|
|
|
<Icon :icon="faStepForward" />
|
2024-06-03 05:22:16 +00:00
|
|
|
</button>
|
2024-04-04 22:20:42 +00:00
|
|
|
|
2024-06-03 05:22:16 +00:00
|
|
|
<VolumeControl class="text-[5vmin]" />
|
2024-04-04 22:20:42 +00:00
|
|
|
</footer>
|
|
|
|
</template>
|
|
|
|
|
2024-04-23 21:01:27 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { faHeart, faPause, faPlay, faStepBackward, faStepForward, } from '@fortawesome/free-solid-svg-icons'
|
2024-04-04 22:20:42 +00:00
|
|
|
import { faHeart as faEmptyHeart } from '@fortawesome/free-regular-svg-icons'
|
|
|
|
import { computed, toRefs } from 'vue'
|
|
|
|
import { socketService } from '@/services'
|
|
|
|
|
|
|
|
import VolumeControl from '@/remote/components/VolumeControl.vue'
|
|
|
|
|
2024-06-03 05:22:16 +00:00
|
|
|
const props = defineProps<{ playable: Playable }>()
|
|
|
|
const { playable } = toRefs(props)
|
2024-04-04 22:20:42 +00:00
|
|
|
|
|
|
|
const toggleFavorite = () => {
|
2024-06-03 05:22:16 +00:00
|
|
|
playable.value.liked = !playable.value.liked
|
2024-04-04 22:20:42 +00:00
|
|
|
socketService.broadcast('SOCKET_TOGGLE_FAVORITE')
|
|
|
|
}
|
|
|
|
|
2024-06-03 05:22:16 +00:00
|
|
|
const playing = computed(() => playable.value.playback_state === 'Playing')
|
2024-04-04 22:20:42 +00:00
|
|
|
|
|
|
|
const togglePlayback = () => {
|
2024-06-03 05:22:16 +00:00
|
|
|
playable.value.playback_state = playable.value.playback_state === 'Playing' ? 'Paused' : 'Playing'
|
2024-04-04 22:20:42 +00:00
|
|
|
socketService.broadcast('SOCKET_TOGGLE_PLAYBACK')
|
|
|
|
}
|
|
|
|
|
|
|
|
const playNext = () => socketService.broadcast('SOCKET_PLAY_NEXT')
|
|
|
|
const playPrev = () => socketService.broadcast('SOCKET_PLAY_PREV')
|
|
|
|
</script>
|
|
|
|
|
2024-04-23 21:01:27 +00:00
|
|
|
<style lang="postcss" scoped>
|
2024-04-04 22:20:42 +00:00
|
|
|
a {
|
|
|
|
@apply text-k-text-primary active:opacity-80;
|
|
|
|
}
|
|
|
|
</style>
|