feat: refactoring api logic

This commit is contained in:
Mat12143 2025-08-02 03:54:26 +02:00
parent 1383c0fbed
commit 44e0d9f44c
7 changed files with 150 additions and 74 deletions

View file

@ -1,12 +1,12 @@
<script lang="ts">
import { type Song, createEmptySong } from "$lib/types"
let { songs, playing } = $props()
let { queueSongs, playingIndex } = $props()
let displaySongs = $derived<Song[]>([
playing > 0 && playing < songs.length ? songs[playing - 1] : createEmptySong(),
songs[playing],
playing == songs.length - 1 ? createEmptySong() : songs[playing + 1],
playingIndex > 0 ? queueSongs[playingIndex - 1] : createEmptySong(),
queueSongs[playingIndex],
playingIndex == queueSongs.length - 1 ? createEmptySong() : queueSongs[playingIndex + 1],
])
</script>