diff --git a/.env b/.env index 1544e99..3736aca 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ # project endpoint (required) [example: http://localhost/v1] -VITE_APPWRITE_ENDPOINT=http://erant-deploy.erant.cz/v1 +VITE_APPWRITE_ENDPOINT=https://erant-deploy.erant.cz/v1 # project id (required) [example: 638871b363904655d784] VITE_APPWRITE_PROJECT_ID=63af924ab3995db64755 diff --git a/src/lib/components/Map/Erantmap.svelte b/src/lib/components/Map/Erantmap.svelte index 30446ef..8d67b73 100644 --- a/src/lib/components/Map/Erantmap.svelte +++ b/src/lib/components/Map/Erantmap.svelte @@ -4,9 +4,9 @@ import { navigate } from 'svelte-routing' export let center - //$: console.log(center) + $: console.log(center) - export let mapComponent + export let mapComponent = null export let user = { lat: null, lng: null } let className = '' diff --git a/src/lib/components/Map/Map.svelte b/src/lib/components/Map/Map.svelte index 29b24e8..f6774f0 100644 --- a/src/lib/components/Map/Map.svelte +++ b/src/lib/components/Map/Map.svelte @@ -1,14 +1,14 @@ -
{ const checkPoints = [] - const game = (await databases.listDocuments('63cef30d6da945dd4250', '63cef4bd210fdf2e5888', [Query.equal('ExpURL', pathName.slice(1, pathName.length))])).documents[0] + const game = (await databases.listDocuments('63cef30d6da945dd4250', '63cef4bd210fdf2e5888', [Query.equal('ExpURL', pathName)])).documents[0] const checkPointsIds = game.ExpCPsID for (const checkPointId of checkPointsIds) { checkPoints.push(await databases.getDocument('63cef30d6da945dd4250', '63cef84d908acf805758', checkPointId)) } + game['checkPoints'] = checkPoints + return game } diff --git a/src/routes/game/Forms/Renderer.svelte b/src/routes/game/Forms/Renderer.svelte index 302af1e..9f5a601 100644 --- a/src/routes/game/Forms/Renderer.svelte +++ b/src/routes/game/Forms/Renderer.svelte @@ -1,6 +1,6 @@ - -{#if page && startQuestion} +{#if page && view === 'map'} - (startQuestion = true)} {lat} {lng} {user} /> + (view = 'question')} {lat} {lng} {user} /> {/if} -{#if !startQuestion} +{#if view === 'question'} {#if clientAnswers.pos !== clientAnswers.end} - + {:else} Získali jste {clientAnswers.points} / {clientAnswers.end * 2} bodů diff --git a/src/routes/game/game.svelte b/src/routes/game/game.svelte index d11c6d2..0b6dc68 100644 --- a/src/routes/game/game.svelte +++ b/src/routes/game/game.svelte @@ -1,4 +1,4 @@ - {#if view === 'game-loading'} - {#if $loading} + {#if loading}

Hra se načítá...

- {:else if $gameData?.success === true} - + {:else if $data} +
- {$gameData.data.name} + {$data.ExpName}
- {'5.0'} + {$data.ExpRating} - {$gameData.data.district} + {'$data.district'}
- {@html $gameData.data.start} + {@html $data.ExpIntroduction}
- +
- - {#each $gameData.data.questions as { lat, lng }} + + {#each $data.checkPoints as { CPLocation: [lat, lng] }} {/each} - { - const { latitude, longitude } = e.detail.coords - const user = { lat: latitude, lng: longitude } - console.log(user) - }} - />
@@ -95,7 +95,9 @@ {/if} {:else if view === 'game-play'} - + {#if !loading} + + {/if} {/if}