commit
8426bcac9a
|
@ -4,7 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<link rel="manifest" href="/webmanifest.json" />
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Erant</title>
|
<title>Erant</title>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const CACHE = "pwabuilder-offline-page";
|
const CACHE = "pwabuilder-offline-page";
|
||||||
|
|
||||||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');
|
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.4/workbox-sw.js');
|
||||||
|
|
||||||
// TODO: replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
|
// TODO: replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
|
||||||
const offlineFallbackPage = "ToDo-replace-this-name.html";
|
const offlineFallbackPage = "offline.html";
|
||||||
|
|
||||||
self.addEventListener("message", (event) => {
|
self.addEventListener("message", (event) => {
|
||||||
if (event.data && event.data.type === "SKIP_WAITING") {
|
if (event.data && event.data.type === "SKIP_WAITING") {
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="h-full w-full overflow-auto">
|
<div class="h-full w-full overflow-auto">
|
||||||
<section class="wraper">
|
<section class="wraper">
|
||||||
{#if img}
|
{#if img}
|
||||||
<img src={img} {alt} />
|
<img class="h-auto w-full min-h-[400px]" src={img} {alt} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if shareData !== null && shareData !== false}
|
{#if shareData !== null && shareData !== false}
|
||||||
<div class="shareButton">
|
<div class="shareButton">
|
||||||
|
|
|
@ -3,17 +3,21 @@ import { Query } from 'appwrite'
|
||||||
import database from 'svelte-appwrite-client/src/lib/database'
|
import database from 'svelte-appwrite-client/src/lib/database'
|
||||||
import { getLocationDataFromLatAndLong } from '../locations'
|
import { getLocationDataFromLatAndLong } from '../locations'
|
||||||
|
|
||||||
export const load = async (pathName: string) => {
|
export const load = async (pathName: string, previewQuestionsCount?: number, preview?: Function) => {
|
||||||
const checkPoints = []
|
const checkPoints = []
|
||||||
const game = (await databases.listDocuments('63cef30d6da945dd4250', '63cef4bd210fdf2e5888', [Query.equal('ExpURL', pathName)])).documents[0]
|
const game = (await databases.listDocuments('63cef30d6da945dd4250', '63cef4bd210fdf2e5888', [Query.equal('ExpURL', pathName)])).documents[0]
|
||||||
|
|
||||||
const checkPointsIds = game.ExpCPsID
|
const checkPointsIds = game.ExpCPsID
|
||||||
|
const rating = await getRating(game.$id)
|
||||||
|
|
||||||
for (const checkPointId of checkPointsIds) {
|
for (const checkPointId of checkPointsIds) {
|
||||||
checkPoints.push(await databases.getDocument('63cef30d6da945dd4250', '63cef84d908acf805758', checkPointId))
|
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['rating'] = rating
|
||||||
game['checkPoints'] = checkPoints
|
game['checkPoints'] = checkPoints
|
||||||
|
|
|
@ -26,8 +26,10 @@
|
||||||
let loading: boolean = true
|
let loading: boolean = true
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$data = await load(params.gameurl)
|
$data = await load(params.gameurl, 5, (preview) => {
|
||||||
loading = false
|
$data = preview
|
||||||
|
loading = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
$: console.log($data)
|
$: console.log($data)
|
||||||
|
|
||||||
|
@ -38,6 +40,8 @@
|
||||||
|
|
||||||
let view: 'game-play' | 'game-loading' = 'game-loading'
|
let view: 'game-play' | 'game-loading' = 'game-loading'
|
||||||
|
|
||||||
|
$: console.log($data?.ExpImage)
|
||||||
|
|
||||||
//is user already in game
|
//is user already in game
|
||||||
//const userInGame = JSON.parse(localStorage.getItem(location.pathname))
|
//const userInGame = JSON.parse(localStorage.getItem(location.pathname))
|
||||||
//$: if ($data && userInGame) view = 'game-play'
|
//$: if ($data && userInGame) view = 'game-play'
|
||||||
|
|
Loading…
Reference in New Issue