feat: refactoring api logic
This commit is contained in:
parent
1383c0fbed
commit
44e0d9f44c
7 changed files with 150 additions and 74 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue