nox/src/App.svelte

44 lines
1.2 KiB
Svelte
Raw Normal View History

2023-08-11 18:06:00 +02:00
<script lang="ts">
2023-08-13 03:11:28 +02:00
import style from './App.module.scss';
2023-08-11 18:06:00 +02:00
import Load from './page/Load/Load.svelte';
2023-08-13 13:08:29 +02:00
import Greet from './page/Greet/Greet.svelte';
2023-08-13 03:09:34 +02:00
2023-08-11 18:06:00 +02:00
import Titlebar from './widget/Titlebar/Titlebar.svelte';
2023-08-13 03:09:34 +02:00
import { Router, Link, Route, navigate } from "svelte-routing";
import RouteStore from './store/RouteStore';
2023-08-13 03:30:08 +02:00
import Background from './widget/Background/Background.svelte';
2023-08-13 03:09:34 +02:00
export let url = "/load";
2023-08-13 03:34:56 +02:00
let page_faded = false;
2023-08-13 03:09:34 +02:00
RouteStore.subscribe(() => {
2023-08-13 03:34:56 +02:00
let new_url = RouteStore.getState().path;
if (url == new_url) return;
2023-08-13 03:09:34 +02:00
url = RouteStore.getState().path;
2023-08-13 03:34:56 +02:00
page_faded = true;
setTimeout(() => {
navigate(url);
page_faded = false;
}, 550);
2023-08-13 03:09:34 +02:00
});
RouteStore.dispatch({ type: 'setPath', path: '/load' })
setTimeout(() => { RouteStore.dispatch({ type: 'setPath', path: '/' }) }, 3000)
2023-08-11 18:06:00 +02:00
</script>
<Titlebar />
2023-08-13 03:30:08 +02:00
<Background />
2023-08-13 03:34:56 +02:00
<div class={style.backdrop} style={`opacity:${page_faded ? 0 : 1}`}>
2023-08-13 03:11:28 +02:00
<div class={style['delay-show']}>
2023-08-13 03:09:34 +02:00
<Router {url}>
2023-08-13 13:08:29 +02:00
<Route path='/' component={Greet} />
2023-08-13 03:09:34 +02:00
<Route path='/load' component={Load} />
</Router>
2023-08-12 09:11:19 +02:00
</div>
2023-08-11 18:20:15 +02:00
</div>