diff options
| author | Adam Soltys <[email protected]> | 2022-11-02 19:47:29 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-11-02 19:48:18 -0700 |
| commit | f0d88333750a2865d3016e92620a87269160effa (patch) | |
| tree | 1cc276efeb5287e1fc176ec60d46aed091ab08ca /src/routes/+layout.svelte | |
| parent | b66477f0912349ef91adaff8c57ac787b5a56447 (diff) | |
| download | coinos-ui-f0d88333750a2865d3016e92620a87269160effa.tar.gz coinos-ui-f0d88333750a2865d3016e92620a87269160effa.zip | |
move to app layout
Diffstat (limited to 'src/routes/+layout.svelte')
| -rw-r--r-- | src/routes/+layout.svelte | 75 |
1 files changed, 3 insertions, 72 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d68e837c..769a541b 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,82 +1,13 @@ <script> - import { SvelteToast } from '@zerodevx/svelte-toast'; import '../app.css'; - import { onDestroy, onMount } from 'svelte'; - import { close, connect, send } from '$lib/socket'; - import { last, selectedRate, rate, user } from '$lib/store'; - import { page } from '$app/stores'; - import { browser } from '$app/environment'; - import { goto } from '$app/navigation'; - import { LoadingSplash } from '$comp'; - import { warning, protectedRoutes } from '$lib/utils'; - import { t, locale } from '$lib/translations'; - - const localeLocalStorageKey = 'sveltekit-i18n-locale'; - - export let data; - - let { subject } = $page.data; - let r, u, token, rates; - - $: update(data); - let update = () => { - ({ user: u, rate: r, token, rates } = data); - $rate = r; - $user = u; - }; - - $: $selectedRate = u && r * (rates[u.currency] / rates.USD); - - onMount(() => { - let localStorageLocale = localStorage.getItem(localeLocalStorageKey); - if (localStorageLocale) locale.set(localStorageLocale); - - locale.subscribe((lng) => { - if (lng) localStorage.setItem(localeLocalStorageKey, lng); - }); - - browser && count(); - }); - - $: browser && connect(token); - - let lost, timer; - let count = () => { - lost = Date.now() - $last > 10000; - if (lost) connect(token); - send('heartbeat'); - timer = setTimeout(count, 500); - }; - - onDestroy(() => browser && clearTimeout(timer)); </script> <svelte:head> - {#if subject} - <title>coinos - {subject.username}</title> - <meta name="lightning" content={`lnurlp:${subject.username}@coinos.io`} /> - {:else} - <title>coinos</title> - {/if} - - {#if subject?.profile} - <meta name="og:image" content={`/api/public/${subject.username}-profile.webp`} /> - {:else} - <meta property="og:image" content="/icons/logo.svg" /> - {/if} + <title>coinos</title> + <meta property="og:image" content="/icons/logo.svg" /> </svelte:head> -<SvelteToast options={{ reversed: true, intro: { y: 192 } }} /> - -{#if lost} - <div class="fixed bottom-12 right-12 text-red-600 bg-white z-50 px-4 py-2 rounded-full border"> - Lost connection to server, try refreshing - </div> -{/if} - -<main data-sveltekit-prefetch> - <slot /> -</main> +<slot /> <style global> :root { |
