Set generic error image from API

This commit is contained in:
CEC 2022-04-19 11:23:22 +02:00
parent 322f9ca707
commit 891ad2c34a
3 changed files with 3 additions and 7 deletions

View File

@ -7,15 +7,11 @@
import logoImg from "../images/logo-min-white.png"; import logoImg from "../images/logo-min-white.png";
let logo = gameManager?.currentStartedRoom?.loginSceneLogo ?? logoImg; let logo = gameManager?.currentStartedRoom?.loginSceneLogo ?? logoImg;
import error from "../images/error.png";
import cup from "../images/cup.png";
import reload from "../images/reload.png"; import reload from "../images/reload.png";
import external from "../images/external-link.png"; import external from "../images/external-link.png";
let errorScreen = get(errorScreenStore); let errorScreen = get(errorScreenStore);
const image = errorScreen.image ?? (errorScreen.type === "retry" ? cup : error);
function click() { function click() {
if (errorScreen.urlToRedirect) window.location.replace(errorScreen.urlToRedirect); if (errorScreen.urlToRedirect) window.location.replace(errorScreen.urlToRedirect);
else if (errorScreen.type === "redirect" && window.history.length > 2) history.back(); else if (errorScreen.type === "redirect" && window.history.length > 2) history.back();
@ -38,7 +34,7 @@
<main class="errorScreen" transition:fly={{ y: -200, duration: 500 }}> <main class="errorScreen" transition:fly={{ y: -200, duration: 500 }}>
<div style="width: 90%;"> <div style="width: 90%;">
<img src={logo} alt="WorkAdventure" class="logo" /> <img src={logo} alt="WorkAdventure" class="logo" />
<div><img src={image} alt="" class="icon" /></div> <div><img src={$errorScreenStore.image} alt="" class="icon" /></div>
{#if $errorScreenStore.type !== "retry"}<h2>{$errorScreenStore.title}</h2>{/if} {#if $errorScreenStore.type !== "retry"}<h2>{$errorScreenStore.title}</h2>{/if}
<p>{$errorScreenStore.subtitle}</p> <p>{$errorScreenStore.subtitle}</p>
{#if $errorScreenStore.type !== "retry"}<p class="code">Code : {$errorScreenStore.code}</p>{/if} {#if $errorScreenStore.type !== "retry"}<p class="code">Code : {$errorScreenStore.code}</p>{/if}
@ -79,13 +75,13 @@
.logo { .logo {
width: 50%; width: 50%;
margin-bottom: 50px; margin-bottom: 50px;
max-height: 10vh; max-height: 25vh;
max-width: 50vw; max-width: 50vw;
} }
.icon { .icon {
height: 125px; height: 125px;
margin-bottom: 25px; margin-bottom: 25px;
max-height: 10vh; max-height: 25vh;
max-width: 50vw; max-width: 50vw;
} }
h2 { h2 {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB