Merge branch 'master' of https://github.com/Erant-s-r-o/Erant
This commit is contained in:
commit
1d25b6ba5d
|
@ -8,7 +8,7 @@
|
|||
<div class="h-full w-full overflow-auto">
|
||||
<section class="wraper">
|
||||
{#if img}
|
||||
<img src={img} {alt} />
|
||||
<img class="h-auto w-full min-h-[400px]" src={img} {alt} />
|
||||
{/if}
|
||||
{#if shareData !== null && shareData !== false}
|
||||
<div class="shareButton">
|
||||
|
|
|
@ -3,17 +3,21 @@ import { Query } from 'appwrite'
|
|||
import database from 'svelte-appwrite-client/src/lib/database'
|
||||
import { getLocationDataFromLatAndLong } from '../locations'
|
||||
|
||||
export const load = async (pathName: string) => {
|
||||
export const load = async (pathName: string, previewQuestionsCount?: number, preview?: Function) => {
|
||||
const checkPoints = []
|
||||
const game = (await databases.listDocuments('63cef30d6da945dd4250', '63cef4bd210fdf2e5888', [Query.equal('ExpURL', pathName)])).documents[0]
|
||||
|
||||
const checkPointsIds = game.ExpCPsID
|
||||
const rating = await getRating(game.$id)
|
||||
|
||||
for (const checkPointId of checkPointsIds) {
|
||||
checkPoints.push(await databases.getDocument('63cef30d6da945dd4250', '63cef84d908acf805758', checkPointId))
|
||||
if (checkPointsIds.indexOf(checkPointId) === previewQuestionsCount - 1) {
|
||||
game['rating'] = rating
|
||||
game['checkPoints'] = checkPoints
|
||||
preview(game)
|
||||
}
|
||||
}
|
||||
const rating = await getRating(game.$id)
|
||||
console.log(rating)
|
||||
|
||||
game['rating'] = rating
|
||||
game['checkPoints'] = checkPoints
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
let loading: boolean = true
|
||||
|
||||
onMount(async () => {
|
||||
$data = await load(params.gameurl)
|
||||
$data = await load(params.gameurl, 5, (preview) => {
|
||||
$data = preview
|
||||
loading = false
|
||||
})
|
||||
})
|
||||
$: console.log($data)
|
||||
|
||||
$: assets = $data?.questions
|
||||
|
@ -38,6 +40,8 @@
|
|||
|
||||
let view: 'game-play' | 'game-loading' = 'game-loading'
|
||||
|
||||
$: console.log($data?.ExpImage)
|
||||
|
||||
//is user already in game
|
||||
//const userInGame = JSON.parse(localStorage.getItem(location.pathname))
|
||||
//$: if ($data && userInGame) view = 'game-play'
|
||||
|
|
Loading…
Reference in New Issue