feat: implemented gps location check
This commit is contained in:
parent
6bdbae1881
commit
2c1928822b
6 changed files with 42 additions and 25 deletions
|
@ -8,6 +8,8 @@
|
|||
import { getQueueSongs, getSuggestions, joinRoom } from "$lib/utils.js"
|
||||
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()
|
||||
|
||||
|
@ -23,8 +25,14 @@
|
|||
onMount(async () => {
|
||||
// Join the room
|
||||
|
||||
let { coords, error } = await get_coords()
|
||||
if (error || coords == null) {
|
||||
// Default to Lido
|
||||
coords = { latitude: 46.6769043, longitude: 11.1851585 }
|
||||
}
|
||||
|
||||
let sugg, queue, index
|
||||
;[returnError] = await joinRoom(data.roomId)
|
||||
;[returnError] = await joinRoom(data.roomId, coords.latitude, coords.longitude)
|
||||
if (returnError) {
|
||||
return
|
||||
}
|
||||
|
@ -69,7 +77,7 @@
|
|||
{#if returnError}
|
||||
<Error {returnError} />
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-4 px-2 lg:p-10">
|
||||
<div class="flex w-full flex-col items-center justify-center px-2 py-4 lg:p-10">
|
||||
<QueueSlider {queueSongs} {playingIndex} />
|
||||
<div class="w-full py-6 lg:w-[30vw]">
|
||||
<SuggestionInput roomId={data.roomId} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue