From 350f44b19485e1ac660024dc87ab2078ea64d92e Mon Sep 17 00:00:00 2001 From: Mat12143 Date: Sat, 2 Aug 2025 11:49:49 +0200 Subject: [PATCH] feat: stop on next song + start on empty queue --- frontend/src/routes/admin/[id]/+page.svelte | 9 +++++++++ frontend/src/routes/room/[id]/+page.svelte | 1 - frontend/src/routes/room/[id]/+page.ts | 12 +++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/routes/admin/[id]/+page.svelte b/frontend/src/routes/admin/[id]/+page.svelte index 959e1be..07d6f0e 100644 --- a/frontend/src/routes/admin/[id]/+page.svelte +++ b/frontend/src/routes/admin/[id]/+page.svelte @@ -52,6 +52,10 @@ queueSongs = songs playingIndex = index + + if (queueSongs.length == 0) { + playNext() + } }) $effect(() => { @@ -72,6 +76,11 @@ queueSongs = songs playingIndex = index + + if (audioController) { + audioController.pause() + audioController.currentTime = 0 + } } function seek(e: Event) { diff --git a/frontend/src/routes/room/[id]/+page.svelte b/frontend/src/routes/room/[id]/+page.svelte index 839d5a7..76984f3 100644 --- a/frontend/src/routes/room/[id]/+page.svelte +++ b/frontend/src/routes/room/[id]/+page.svelte @@ -9,7 +9,6 @@ import type { FetchError } from "$lib/types.js" import { io, Socket } from "socket.io-client" import { get_coords } from "$lib/gps.js" - import type { Coordinates } from "$lib/gps.js" let { data } = $props() diff --git a/frontend/src/routes/room/[id]/+page.ts b/frontend/src/routes/room/[id]/+page.ts index 969ffc5..1f9f77d 100644 --- a/frontend/src/routes/room/[id]/+page.ts +++ b/frontend/src/routes/room/[id]/+page.ts @@ -1,13 +1,7 @@ -import { error, type Load, type ServerLoad } from "@sveltejs/kit" import type { PageLoad } from "./$types" -import type { FetchError } from "$lib/util" -import { parseSuggestion, type Suggestion } from "$lib/types" -export const load: PageLoad = async ({ params }) => { - if (params.id) { - return { - roomId: params.id, - } +export const load: PageLoad = ({ params, url }) => { + return { + roomId: params.id || "", } - error(400, "Please provide a room id") }