diff --git a/frontend/src/lib/components/SuggestionInput.svelte b/frontend/src/lib/components/SuggestionInput.svelte
index 8cc5a9a..d23b878 100644
--- a/frontend/src/lib/components/SuggestionInput.svelte
+++ b/frontend/src/lib/components/SuggestionInput.svelte
@@ -1,20 +1,33 @@
- {#if disabled}
+ {#if loading}
{/if}
- Add
diff --git a/frontend/src/lib/components/SuggestionList.svelte b/frontend/src/lib/components/SuggestionList.svelte
index 6f5d649..193b33c 100644
--- a/frontend/src/lib/components/SuggestionList.svelte
+++ b/frontend/src/lib/components/SuggestionList.svelte
@@ -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 @@
No suggestions yet! Try to add a new one using the Add button
{/if}
- {#each suggestions as sug, idx}
+ {#each suggestions as sug}
@@ -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)
}}>
{sug.upvote}
@@ -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)
}}>