2025-08-01 21:10:03 +02:00
|
|
|
<script lang="ts">
|
2025-08-01 22:04:55 +02:00
|
|
|
import type { Song } from "$lib/types"
|
|
|
|
let { suggestions }: { suggestions: Song[] } = $props()
|
|
|
|
|
|
|
|
let reactiveSugg = $derived(
|
|
|
|
[...suggestions].sort((a, b) => {
|
|
|
|
return b.points - a.points
|
|
|
|
})
|
|
|
|
)
|
2025-08-01 21:10:03 +02:00
|
|
|
</script>
|
2025-08-01 22:04:55 +02:00
|
|
|
|
|
|
|
<div class="flex h-full w-full flex-col items-center gap-2 overflow-y-auto">
|
|
|
|
{#each reactiveSugg as sug}
|
|
|
|
<div class="flex h-[80px] w-full flex-row gap-2 rounded border-2 border-black p-2">
|
|
|
|
<div class="flex w-3/4 flex-row gap-2">
|
|
|
|
<img class="w-[60px] min-w-[60px] rounded" src={sug.image} alt="Song cover" />
|
|
|
|
<h1>{sug.name}</h1>
|
|
|
|
</div>
|
|
|
|
<div class="flex w-1/4 flex-row items-center justify-center gap-2">
|
|
|
|
<button
|
|
|
|
onclick={() => {
|
|
|
|
sug.points += 1
|
|
|
|
}}>🔥</button
|
|
|
|
>
|
|
|
|
<p>{sug.points}</p>
|
|
|
|
<button
|
|
|
|
onclick={() => {
|
|
|
|
sug.points--
|
|
|
|
}}>💩</button
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|