This commit is contained in:
Simone Tesini 2025-08-02 13:45:32 +02:00
commit 7443d600e7
2 changed files with 15 additions and 4 deletions

View file

@ -29,9 +29,9 @@ init_db(state.db)
state.rooms[1000] = Room(
id=1000,
coord=Coordinates(46.6769043, 11.1851585),
name="Test Room",
pin=None,
tags=set(),
name="Lido Scena",
pin=1234,
tags=set(["chill", "raggaetton", "spanish", "latino", "mexican", "rock"]),
range_size=150,
songs={},
history=[],

View file

@ -7,6 +7,7 @@
let input = $state("")
let loading: boolean = $state(false)
let cooldowned: boolean = $state(false)
let errorMsg: string = $state()
$effect(() => {
console.log("cooldowned is now", cooldowned)
@ -14,10 +15,15 @@
async function sendSong() {
loading = true
await fetch(`/api/addsong?room=${roomId}&query=${input}`, { method: "POST" })
const res = await fetch(`/api/addsong?room=${roomId}&query=${input}`, { method: "POST" })
const json = await res.json()
input = ""
loading = false
if (!json.success) {
errorMsg = json.error
}
cooldowned = true
setTimeout(() => {
cooldowned = false
@ -35,6 +41,7 @@
class="h-[50px] w-3/4 rounded px-4 font-bold text-white outline-none"
bind:value={input}
onkeydown={(e) => {
errorMsg = null
if (e.key == "Enter") {
sendSong()
}
@ -56,3 +63,7 @@
>
<span class="i-lucide-chevrons-left"></span>
</div>
<p class="text-red-500 font-semibold">
{errorMsg}
</p>