Adding a global error message

This error message should be used for non fatal errors (otherwise, use the ErrorScene).
It is implemented using Svelte and the new "$errorStore".

Use `errorStore.addErrorMessage` to display the error popup with the message.

This PR uses this error message to display a popup explaining the browser is too old for WebRTC.
This commit is contained in:
David Négrier 2021-06-03 14:10:31 +02:00
parent a8b91561dc
commit f4ed527fe8
5 changed files with 93 additions and 1 deletions

View file

@ -0,0 +1,44 @@
<script lang="ts">
import {errorStore} from "../../Stores/ErrorStore";
function close(): boolean {
errorStore.clearMessages();
return false;
}
</script>
<dialog class="error-dialog nes-dialog is-dark is-rounded" id="dialog-dark-rounded" open>
<p class="nes-text is-error title">Error</p>
<div class="body">
{#each $errorStore as error}
<p>{error}</p>
{/each}
</div>
<div class="button-bar">
<button class="nes-btn is-error" on:click={close}>Close</button>
</div>
</dialog>
<style lang="scss">
dialog.error-dialog {
pointer-events: auto;
top: 10%;
.button-bar {
text-align: center;
}
.body {
max-height: 50vh;
}
p {
font-family: "Press Start 2P";
&.title {
text-align: center;
}
}
}
</style>