From 2ce56267880a8d63f5624e3e4053cc7a130ec38d Mon Sep 17 00:00:00 2001 From: ota-prokopec Date: Sat, 10 Sep 2022 17:47:57 +0200 Subject: [PATCH] database connection init --- src/App.svelte | 7 ++++--- src/lib/Components/Forms/Renderer.svelte | 5 +++-- src/lib/Components/Overlay.svelte | 2 +- src/routes/game.svelte | 25 ++++++++++++++++-------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 8274e27..c38d55f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -5,15 +5,16 @@ import Game from './routes/game.svelte' import Renderer from './lib/Components/Forms/Renderer.svelte' //import Try from './routes/try.svelte' + let gameData
- + - - + +
diff --git a/src/lib/Components/Forms/Renderer.svelte b/src/lib/Components/Forms/Renderer.svelte index f78af4c..52fcbed 100644 --- a/src/lib/Components/Forms/Renderer.svelte +++ b/src/lib/Components/Forms/Renderer.svelte @@ -31,12 +31,13 @@ clientAnswers.pos++ } - let questions = [ + /*let questions = [ { type: 'singlechoice', correct: 'banan', quesion: 'text otazky', description: '', options: ['banan', 'cokolada', 'mleko'] }, { type: 'interval', correct: [0, 3], quesion: 'text otazky', description: '', options: null }, { type: 'text', correct: 'jablko', quesion: 'text otazky', description: '', options: null }, { type: 'multichoice', correct: ['banan', 'cokolada'], quesion: 'text otazky', description: '', options: ['banan', 'cokolada', 'mleko'] }, - ] + ]*/ + export let gameData let page $: page = components[questions[clientAnswers.pos].type] diff --git a/src/lib/Components/Overlay.svelte b/src/lib/Components/Overlay.svelte index ad613f6..4a64976 100644 --- a/src/lib/Components/Overlay.svelte +++ b/src/lib/Components/Overlay.svelte @@ -36,7 +36,7 @@ display: flex; flex-direction: column; row-gap: 35px; - z-index: 5; + z-index: 7; background-color: white; } diff --git a/src/routes/game.svelte b/src/routes/game.svelte index 14f5d2f..b7a5840 100644 --- a/src/routes/game.svelte +++ b/src/routes/game.svelte @@ -21,22 +21,27 @@ url: location.origin, } + export let gameData = {} + + const readUrlHash = () => { + return location.pathname.slice(6, location.pathname.length) + } + ;(async () => { - const gameData = await api.post(`${api.hostName}/game/details`, { - gameurl: 'pisek-mesto-kralovske', + gameData = await api.post(`${api.hostName}/game/details`, { + gameurl: 'pisek-mesto-kralovske', //readUrlHash(), }) const questions = yallist(gameData.questions) - - console.log(questions) + console.log(gameData) console.log(parseQuestion(gameData.questions[0].answer, gameData.questions[0].type)) })() - + - Tůra po Karláku + {gameData.name}
@@ -44,12 +49,16 @@ - Praha + {gameData.district}
-
{'text'}
+
+ + {@html gameData.start} +