This commit is contained in:
Ota Prokopec 2023-03-28 22:21:16 +02:00
parent ed5a2222d6
commit 4054b66aa3
3 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,6 @@
export const getLocationDataFromLatAndLong = async (latitude: number, longitude: number) => { export const getLocationDataFromLatAndLong = async (latitude: number, longitude: number) => {
const response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`) const response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`)
const data = await response.json() const data = await response.json()
console.log(data);
return { return {
city: data?.address?.town || data?.address?.city || data?.address?.village, city: data?.address?.town || data?.address?.city || data?.address?.village,
state: data?.address?.country, state: data?.address?.country,

View File

@ -7,16 +7,19 @@
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null export let control: 'wrong-firstTime' | 'wrong-secondTime' | 'correct' | 'not-control' | null
export let imgSrc export let imgSrc: string = ''
export let loading: boolean export let loading: boolean
//
</script> </script>
<div> <div>
<div class="wrap"> <div class="wrap mt-2">
<div class="h-[var(--quizHeader)] w-full flex relative top-0 justify-center items-center"> <div class="w-full flex relative top-0 justify-center items-center">
<div class="flex justify-center items-center flex-col flex-wrap gap-3"> <div class="flex w-full justify-center items-center flex-col flex-wrap gap-3">
<span class="title"><slot name="title" /></span> <span class="title h-min"><slot name="title" /></span>
<span style="width: 100%"><Image class="w-full h-[200px]" src={imgSrc} /></span> {#if imgSrc}
<span style="width: 100%"><Image class="w-full h-[200px]" src={imgSrc} /></span>
{/if}
</div> </div>
</div> </div>
<Section style="height: calc(100% - var(--quizHeader)); position: relative"> <Section style="height: calc(100% - var(--quizHeader)); position: relative">

View File

@ -122,7 +122,7 @@
{#if view === 'question'} {#if view === 'question'}
<Layout <Layout
loading={answerLoading} loading={answerLoading}
imgSrc={'gameData.question.thumbnail'} imgSrc={checkPoint.CPImage}
on:submit={() => checkAnswer()} on:submit={() => checkAnswer()}
on:nextQuestion={() => { on:nextQuestion={() => {
if (checkPointType === 'INFO') checkAnswer() if (checkPointType === 'INFO') checkAnswer()