offline warning
This commit is contained in:
parent
ec693b9c3f
commit
e2c5eab08b
3 changed files with 99 additions and 1 deletions
72
src/lib/components/Offline.svelte
Normal file
72
src/lib/components/Offline.svelte
Normal file
|
@ -0,0 +1,72 @@
|
|||
<div class="offline-container">
|
||||
<div class="flicker">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M2.28 3L1 4.27l1.47 1.47c-.43.26-.86.55-1.27.86L3 9c.53-.4 1.08-.75 1.66-1.07l2.23 2.23c-.74.34-1.45.75-2.09 1.24l1.8 2.4c.78-.58 1.66-1.03 2.6-1.33L11.75 15c-1.25.07-2.41.5-3.35 1.2L12 21l2.46-3.27L17.74 21L19 19.72M12 3c-2.15 0-4.2.38-6.1 1.07l2.39 2.4C9.5 6.16 10.72 6 12 6c3.38 0 6.5 1.11 9 3l1.8-2.4C19.79 4.34 16.06 3 12 3m0 6c-.38 0-.75 0-1.12.05l3.19 3.2c1.22.28 2.36.82 3.33 1.55l1.8-2.4C17.2 9.89 14.7 9 12 9"
|
||||
></path>
|
||||
</svg>
|
||||
<h1>YOU ARE OFFLINE</h1>
|
||||
</div>
|
||||
<p>Please check your internet connection.</p>
|
||||
<p class="explanation">
|
||||
An internet connection is required to sync your wallet and make
|
||||
transactions.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.offline-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
text-align: center;
|
||||
color: var(--text-color);
|
||||
font-family: "Press Start 2P", "VT323", monospace, sans-serif;
|
||||
text-shadow: 1px 1px 0 #000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
margin-top: 1rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1rem;
|
||||
margin-top: 1rem;
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
.explanation {
|
||||
margin-top: 2rem;
|
||||
max-width: 40ch;
|
||||
line-height: 1.5;
|
||||
color: var(--text-color);
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.flicker {
|
||||
animation: flicker 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes flicker {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
</style>
|
24
src/lib/online.svelte.ts
Normal file
24
src/lib/online.svelte.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { writable } from "svelte/store";
|
||||
|
||||
function createOnline() {
|
||||
const { subscribe, set } = writable(navigator.onLine);
|
||||
|
||||
function handleOnline() {
|
||||
set(true);
|
||||
}
|
||||
|
||||
function handleOffline() {
|
||||
set(false);
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("online", handleOnline);
|
||||
window.addEventListener("offline", handleOffline);
|
||||
}
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
};
|
||||
}
|
||||
|
||||
export const online = createOnline();
|
|
@ -94,7 +94,9 @@
|
|||
</svelte:head>
|
||||
|
||||
<div class="retro-shader">
|
||||
{#if showInstallPrompt && deferredPrompt}
|
||||
{#if !$online}
|
||||
<Offline />
|
||||
{:else if showInstallPrompt && deferredPrompt}
|
||||
<InstallPrompt onInstall={handleInstallClick} />
|
||||
{:else if showSplash}
|
||||
<SplashScreen closing={closingSplash} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue