Better reporting

This commit is contained in:
Ludvík Prokopec 2022-10-19 14:52:15 +02:00
parent 6a8168e171
commit a545c37515
9 changed files with 107 additions and 12 deletions

View File

@ -30,8 +30,8 @@ return function($data, $headers, $db) {
$imagesHostName = 'https://geohry.skolazdola.cz/';
if(!isset($data['gameurl']) || empty($data['gameurl'])) return [
"success" => false,
"data" => [
"success" => false,
"message" => "Property 'gameurl' is not set."
]
];
@ -43,8 +43,8 @@ return function($data, $headers, $db) {
]);
if(!$gameDetails) return [
"success" => false,
"data" => [
"success" => false,
"message" => "Invalid 'gameurl'."
]
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 KiB

View File

@ -3,6 +3,7 @@
import './main.scss'
import Game from './routes/game.svelte'
import Index from './routes/index.svelte'
import Play from './routes/play.svelte'
if ('serviceWorker' in window.navigator) {
@ -14,9 +15,7 @@
<main>
<Router>
<Route path="/">
<h1 class="flex items-center justify-center">Nebyla vybrána žádná hra</h1>
</Route>
<Route path="/" component={Index} />
<Route path="/play" component={Play} />
@ -37,7 +36,7 @@
justify-content: center;
justify-self: center;
width: 100%;
max-width: 768px;
max-width: 500px;
/*overflow: hidden;*/
}
</style>

View File

@ -0,0 +1,44 @@
<div class="lds-ring">
<div />
<div />
<div />
<div />
</div>
<style>
.lds-ring {
display: inline-block;
position: relative;
width: 80px;
height: 80px;
}
.lds-ring div {
box-sizing: border-box;
display: block;
position: absolute;
width: 64px;
height: 64px;
margin: 8px;
border: 8px solid #4263eb;
border-radius: 50%;
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-color: #4263eb transparent transparent transparent;
}
.lds-ring div:nth-child(1) {
animation-delay: -0.45s;
}
.lds-ring div:nth-child(2) {
animation-delay: -0.3s;
}
.lds-ring div:nth-child(3) {
animation-delay: -0.15s;
}
@keyframes lds-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>

View File

@ -25,6 +25,7 @@
position: relative;
height: 100%;
width: 100%;
clip-path: inset(0);
.overlay {
min-height: 75vh;
@ -46,7 +47,7 @@
z-index: 4;
width: 100%;
height: auto;
min-height: 25%;
min-height: 35vh;
max-height: 100%;
position: fixed;

View File

@ -0,0 +1,8 @@
<script>
import { onMount } from 'svelte'
import { navigate } from 'svelte-routing'
export let to = '/'
onMount(() => navigate(to))
</script>

18
src/routes/error.svelte Normal file
View File

@ -0,0 +1,18 @@
<script>
import Heading from '../lib/Components/game/Heading.svelte'
import Overlay from '../lib/Components/Overlay.svelte'
import Section from '../lib/Components/Section.svelte'
import Button from '../lib/Components/Button.svelte'
</script>
<Overlay img="/assets/images/main.jpg">
<Heading>
<span>Erant</span>
</Heading>
<Section title="Nastala chyba">
<p>Je nám líto ale tato hra nebyla nalezena.</p>
</Section>
<Button href="/" primary>Hlavní menu</Button>
</Overlay>

View File

@ -9,6 +9,8 @@
import IconPoint from '../lib/Components/Icons/Point.svelte'
import Map from '../lib/Components/game/Map/Map.svelte'
import ImageSlider from '$lib/Components/ImageSlider.svelte'
import Redirect from '$lib/Components/Redirect.svelte'
import Loading from '../lib/Components/Loading.svelte'
import * as api from '$lib/utils/api'
import { data } from '$lib/stores/game'
@ -31,8 +33,11 @@
</script>
{#if loading}
<h1 class="flex items-center justify-center">Hra se načítá</h1>
{:else if !('success' in $data)}
<h1 class="flex items-center justify-center flex-col">
<span>Hra se načítá...</span>
<Loading />
</h1>
{:else if $data?.success === true}
<Overlay shareData={{ url: window.location.href }} img={$data?.thumbnail}>
{#if $data}
<Heading>
@ -52,8 +57,9 @@
<Section title="Popis">
<span>
{@html $data.start}
</span></Section
>
</span>
</Section>
<Section title="Fotky">
<ImageSlider images={assets} />
</Section>
@ -68,7 +74,7 @@
{/if}
</Overlay>
{:else}
<h1 class="flex items-center justify-center">Tato hra neexistuje</h1>
<Redirect to="/error" />
{/if}
<style>

19
src/routes/index.svelte Normal file
View File

@ -0,0 +1,19 @@
<script>
import Heading from '../lib/Components/game/Heading.svelte'
import Overlay from '../lib/Components/Overlay.svelte'
import Section from '../lib/Components/Section.svelte'
</script>
<Overlay img="/assets/images/main.jpg">
<Heading>
<span>Erant</span>
</Heading>
<Section title="Spuštění hry">
<p>Pro spuštění hry najděte QR kód hry.</p>
</Section>
<Section>
<p>Nechť dobrodružství započne.</p>
</Section>
</Overlay>