Merge pull request #67 from Erant-s-r-o/master

MVP #4.1
This commit is contained in:
Matthieu Morin 2023-03-07 01:52:53 +01:00 committed by GitHub
commit 8426bcac9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<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" />
<title>Erant</title>

View File

@ -2,10 +2,10 @@
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";
const offlineFallbackPage = "ToDo-replace-this-name.html";
const offlineFallbackPage = "offline.html";
self.addEventListener("message", (event) => {
if (event.data && event.data.type === "SKIP_WAITING") {

View File

@ -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">

View File

@ -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

View File

@ -26,8 +26,10 @@
let loading: boolean = true
onMount(async () => {
$data = await load(params.gameurl)
loading = false
$data = await load(params.gameurl, 5, (preview) => {
$data = preview
loading = false
})
})
$: console.log($data)
@ -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'