This commit is contained in:
Simone Tesini 2025-08-02 12:52:02 +02:00
commit 6a50dc4c86
9 changed files with 27 additions and 26 deletions

View file

@ -3,10 +3,10 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<link rel="manifest" href="manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" class="h-max">
<div style="display: contents">%sveltekit.body%</div>
</body>

View file

@ -7,9 +7,8 @@
let picked_suggestions: string[] = $state([])
async function vote(idx: number, amount: number, songId: string) {
async function vote(amount: number, songId: string) {
if (picked_suggestions.includes(songId)) return console.log("rejecting vote")
suggestions[idx].upvote += amount
await fetch(`/api/song/voting?room=${roomId}&song=${songId}&increment=${amount}`, { method: "POST" })
picked_suggestions.push(songId)
console.log("accepted vote")
@ -26,7 +25,7 @@
<p>No suggestions yet! Try to add a new one using the Add button</p>
{/if}
{#each suggestions as sug, idx}
{#each suggestions as sug}
<div
class="flex h-[80px] w-full flex-row gap-2 rounded-md border-dark-pine-muted bg-light-pine-overlay p-2 shadow-md duration-100 hover:bg-dark-pine-base/20 dark:bg-dark-pine-overlay hover:dark:bg-light-pine-base/20"
>
@ -48,7 +47,8 @@
class={!picked_suggestions.includes(sug.uuid) ? "text-light-pine-green duration-100 hover:scale-150 dark:text-dark-pine-green" : "text-light-pine-muted dark:text-dark-pine-muted"}
disabled={!!picked_suggestions.includes(sug.uuid)}
onclick={async () => {
await vote(idx, 1, sug.uuid)
sug.upvode += 1
await vote(1, sug.uuid)
}}><ThumbsUp /></button
>
<p class="font-semibold text-light-pine-text dark:text-dark-pine-text">{sug.upvote}</p>
@ -56,7 +56,8 @@
class={!picked_suggestions.includes(sug.uuid) ? "text-light-pine-red duration-100 hover:scale-150 dark:text-dark-pine-red" : "text-light-pine-muted dark:text-dark-pine-muted"}
disabled={!!picked_suggestions.includes(sug.uuid)}
onclick={async () => {
await vote(idx, -1, sug.uuid)
sug.upvode += 1
await vote(-1, sug.uuid)
}}><ThumbsDown /></button
>
</div>

View file

@ -28,7 +28,7 @@
<button
onclick={() => {
window.location.href = "/room/new"
window.location.href = "/room/create"
}}
class="fixed right-4 bottom-4 flex flex-row gap-1 rounded-xl bg-light-pine-blue p-2 text-dark-pine-text sm:right-20 md:right-40 lg:right-80 dark:bg-dark-pine-blue"
>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -1,21 +1,21 @@
{
"name": "Chillbox Music Player",
"short_name": "Chillbox",
"start_url": "/",
"display": "standalone",
"background_color": "#334155",
"theme_color": "#334155",
"orientation": "portrait-primary",
"icons": [
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
}
]
"name": "Chillbox Music Player",
"short_name": "Chillbox",
"start_url": "/",
"display": "standalone",
"background_color": "#334155",
"theme_color": "#334155",
"orientation": "portrait-primary",
"icons": [
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}