diff --git a/src/lib/Components/Map/Circle.svelte b/src/lib/Components/Map/Marker.svelte similarity index 98% rename from src/lib/Components/Map/Circle.svelte rename to src/lib/Components/Map/Marker.svelte index 876402d..07404fb 100644 --- a/src/lib/Components/Map/Circle.svelte +++ b/src/lib/Components/Map/Marker.svelte @@ -6,7 +6,6 @@ export let lat = 0 export let lng = 0 export let user = { lat: 0, lng: 0 } - $: console.log({ user, lng, lat }) export let round = (1 / 110.574 / 1000) * 5 //cca 12m nutno pozměnit!!!!!!!!!! tento komentář nemazat let Mlat = [lat - round, lat + round] diff --git a/src/routes/game/Forms/Renderer.svelte b/src/routes/game/Forms/Renderer.svelte index c6d61c7..aef8420 100644 --- a/src/routes/game/Forms/Renderer.svelte +++ b/src/routes/game/Forms/Renderer.svelte @@ -1,6 +1,6 @@ {#if !startQuestion} - (startQuestion = true)} {lat} {lng} {user} /> + (startQuestion = true)} {lat} {lng} {user} /> {/if} diff --git a/src/routes/game/game.svelte b/src/routes/game/game.svelte index fbc5558..354b053 100644 --- a/src/routes/game/game.svelte +++ b/src/routes/game/game.svelte @@ -14,7 +14,7 @@ import Renderer from './Forms/Renderer.svelte' import Redirect from '../../lib/Components/common/Redirect.svelte' import ImageSlider from '../../lib/Components/common/ImageSlider.svelte' - import Circle from '../../lib/Components/Map/Circle.svelte' + import Marker from '../../lib/Components/Map/Marker.svelte' export let gameurl @@ -27,6 +27,10 @@ ?.map((q) => q.thumbnail) let view = 'game-loading' + + //is user already in game + const userInGame = JSON.parse(localStorage.getItem(location.pathname)) + $: if ($gameData && userInGame) view = 'game-play' {#if view === 'game-loading'} @@ -69,7 +73,7 @@
{#each $gameData.data.questions as { lat, lng }} - + {/each} { diff --git a/src/routes/map.svelte b/src/routes/map.svelte index 6a716d9..73da237 100644 --- a/src/routes/map.svelte +++ b/src/routes/map.svelte @@ -3,6 +3,11 @@ import NavigationBarLayout from '$lib/Components/Layouts/NavigationBarLayout.svelte' let user = { lat: 50.073658, lng: 14.41854 } + + const lastGame = localStorage.getItem('lastGame') + if (lastGame) { + location.href = lastGame + }