Merge branch 'main' of https://repos.hackathon.bz.it/2025-summer/team-1 into scanner_page
This commit is contained in:
commit
7170c7b663
13 changed files with 99 additions and 79 deletions
|
@ -3,21 +3,37 @@
|
|||
import { type Song } from "$lib/types"
|
||||
import { onMount } from "svelte"
|
||||
import type { FetchError } from "$lib/types"
|
||||
import { getQueueSongs, triggerPlayNext } from "$lib/utils.js"
|
||||
import { getQueueSongs, getStreamingUrl, triggerPlayNext } from "$lib/utils.js"
|
||||
import Error from "$lib/components/Error.svelte"
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
let queueSongs = $state<Song[]>([])
|
||||
let playingIndex = $state<number>()
|
||||
let playingIndex = $state<number>(0)
|
||||
let returnError = $state<FetchError | null>()
|
||||
|
||||
let currentPlaying = $derived<Song>(queueSongs[playingIndex])
|
||||
let audioController = $state<HTMLAudioElement>()
|
||||
|
||||
async function playOnEnd() {
|
||||
let url = await getStreamingUrl(currentPlaying.uuid)
|
||||
if (audioController) {
|
||||
audioController.src = url
|
||||
audioController.play()
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
let songs, index
|
||||
;[returnError, songs, index] = await getQueueSongs(data.roomId)
|
||||
|
||||
queueSongs = songs
|
||||
playingIndex = index
|
||||
|
||||
if (audioController) {
|
||||
audioController.src = await getStreamingUrl(currentPlaying.uuid)
|
||||
audioController.play()
|
||||
}
|
||||
})
|
||||
|
||||
async function playNext() {
|
||||
|
@ -37,5 +53,6 @@
|
|||
<div class="flex w-full flex-col items-center justify-center p-4 lg:p-10">
|
||||
<QueueSlider {queueSongs} {playingIndex} />
|
||||
<button onclick={playNext}>Next</button>
|
||||
<audio controls autoplay bind:this={audioController} onended={playOnEnd}></audio>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { onMount } from "svelte"
|
||||
import { get_coords, is_within_range, type Coordinates } from "$lib/gps"
|
||||
import { get_coords, type Coordinates } from "$lib/gps"
|
||||
|
||||
let lido_schenna_coords: Coordinates = { latitude: 46.6769043, longitude: 11.1851585 }
|
||||
|
||||
|
@ -12,6 +12,6 @@
|
|||
}
|
||||
if (coords == null) return
|
||||
|
||||
console.log(is_within_range(coords, lido_schenna_coords, 103))
|
||||
// console.log(is_within_range(coords, lido_schenna_coords, 103))
|
||||
})
|
||||
</script>
|
||||
|
|
7
frontend/src/routes/zesty/icons/+page.svelte
Normal file
7
frontend/src/routes/zesty/icons/+page.svelte
Normal file
|
@ -0,0 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { Skull, Accessibility, Anvil } from "@lucide/svelte"
|
||||
</script>
|
||||
|
||||
<Skull />
|
||||
<Accessibility />
|
||||
<Anvil />
|
Loading…
Add table
Add a link
Reference in a new issue