Fix prettier for the front
This commit is contained in:
parent
074f43d16c
commit
d972b3a2e6
@ -16,7 +16,6 @@
|
||||
import ErrorDialog from "./UI/ErrorDialog.svelte";
|
||||
import ErrorScreen from "./UI/ErrorScreen.svelte";
|
||||
|
||||
|
||||
export let game: Game;
|
||||
</script>
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
|
||||
function click() {
|
||||
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();
|
||||
else window.location.reload();
|
||||
}
|
||||
let details = errorScreen.details;
|
||||
let timeVar = errorScreen.timeToRetry ?? 0;
|
||||
if(errorScreen.type === 'retry') {
|
||||
if (errorScreen.type === "retry") {
|
||||
setInterval(() => {
|
||||
if (timeVar <= 1000) click();
|
||||
timeVar -= 1000;
|
||||
@ -26,25 +26,25 @@
|
||||
}
|
||||
|
||||
$: detailsStylized = details.replace("{time}", `${timeVar / 1000}`);
|
||||
|
||||
</script>
|
||||
|
||||
<main class="errorScreen" transition:fly={{ y: -200, duration: 500 }}>
|
||||
<div style="width: 90%;">
|
||||
<img src={logo} alt="WorkAdventure" class="logo" />
|
||||
<div><img src={$errorScreenStore.type === 'retry'?cup:error} alt="" class="icon"/></div>
|
||||
{#if $errorScreenStore.type !== 'retry'}<h2>{$errorScreenStore.title}</h2>{/if}
|
||||
<div><img src={$errorScreenStore.type === "retry" ? cup : error} alt="" class="icon" /></div>
|
||||
{#if $errorScreenStore.type !== "retry"}<h2>{$errorScreenStore.title}</h2>{/if}
|
||||
<p>{$errorScreenStore.subtitle}</p>
|
||||
{#if $errorScreenStore.type !== 'retry'}<p class="code">Code : {$errorScreenStore.code}</p>{/if}
|
||||
<p class="details">{detailsStylized}{#if $errorScreenStore.type === 'retry'}<div class="loading"></div>{/if}</p>
|
||||
{#if ($errorScreenStore.type === 'retry' && $errorScreenStore.canRetryManual) || ($errorScreenStore.type === 'redirect' && (window.history.length > 2 || $errorScreenStore.urlToRedirect))}
|
||||
{#if $errorScreenStore.type !== "retry"}<p class="code">Code : {$errorScreenStore.code}</p>{/if}
|
||||
<p class="details">
|
||||
{detailsStylized}{#if $errorScreenStore.type === "retry"}<div class="loading" />{/if}
|
||||
</p>
|
||||
{#if ($errorScreenStore.type === "retry" && $errorScreenStore.canRetryManual) || ($errorScreenStore.type === "redirect" && (window.history.length > 2 || $errorScreenStore.urlToRedirect))}
|
||||
<div class="button" on:click={click}>
|
||||
<img src={$errorScreenStore.type === 'retry'?reload:external} alt="" class="reload"/>
|
||||
<img src={$errorScreenStore.type === "retry" ? reload : external} alt="" class="reload" />
|
||||
{$errorScreenStore.buttonTitle}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<style lang="scss">
|
||||
@ -52,7 +52,7 @@
|
||||
pointer-events: auto;
|
||||
width: 100%;
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
@ -87,7 +87,7 @@
|
||||
}
|
||||
p.code {
|
||||
font-size: 12px;
|
||||
opacity: .6;
|
||||
opacity: 0.6;
|
||||
user-select: text;
|
||||
}
|
||||
p.details {
|
||||
@ -130,7 +130,7 @@
|
||||
|
||||
.button {
|
||||
cursor: pointer;
|
||||
background-image: url('../images/button-large.png');
|
||||
background-image: url("../images/button-large.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
@ -153,6 +153,5 @@
|
||||
width: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
@ -483,7 +483,7 @@ export class RoomConnection implements RoomConnection {
|
||||
}
|
||||
case "errorV2Message": {
|
||||
this._errorV2MessageStream.next(message.errorV2Message);
|
||||
if(message.errorV2Message.code !== 'retry') this.closed = true;
|
||||
if (message.errorV2Message.code !== "retry") this.closed = true;
|
||||
console.error("An error occurred server side: " + message.errorV2Message.code);
|
||||
errorScreenStore.setError(message.errorV2Message as unknown as WAError);
|
||||
break;
|
||||
|
@ -47,7 +47,8 @@ export class EntryScene extends Scene {
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.response.data?.code) {
|
||||
errorScreenStore.setError(new WAError(
|
||||
errorScreenStore.setError(
|
||||
new WAError(
|
||||
err.response.data.type,
|
||||
err.response.data.code,
|
||||
err.response.data.title,
|
||||
@ -57,7 +58,8 @@ export class EntryScene extends Scene {
|
||||
err.response.data.canRetryManual,
|
||||
err.response.data.urlToRedirect,
|
||||
err.response.data.buttonTitle
|
||||
));
|
||||
)
|
||||
);
|
||||
} else {
|
||||
ErrorScene.showError(err, this.scene);
|
||||
}
|
||||
|
@ -9,7 +9,17 @@ export class WAError extends Error {
|
||||
private _urlToRedirect: string;
|
||||
private _buttonTitle: string;
|
||||
|
||||
constructor(type: string, code: string, title: string, subtitle: string, details: string, timeToRetry: number, canRetryManual: boolean, urlToRedirect: string, buttonTitle: string) {
|
||||
constructor(
|
||||
type: string,
|
||||
code: string,
|
||||
title: string,
|
||||
subtitle: string,
|
||||
details: string,
|
||||
timeToRetry: number,
|
||||
canRetryManual: boolean,
|
||||
urlToRedirect: string,
|
||||
buttonTitle: string
|
||||
) {
|
||||
super(title + " - " + subtitle + " - " + details);
|
||||
|
||||
this._type = type;
|
||||
|
@ -9,9 +9,7 @@ function createErrorScreenStore() {
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
setError: (
|
||||
e: WAError
|
||||
): void => set(e),
|
||||
setError: (e: WAError): void => set(e),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user