karl/view/src/App.svelte

30 lines
798 B
Svelte
Raw Normal View History

2021-03-09 01:13:42 +01:00
<script lang="ts">
2021-03-26 16:51:23 +01:00
import { fade } from "svelte/transition";
2021-03-10 01:20:22 +01:00
import Editor from "./routes/editor.svelte";
2021-03-09 01:13:42 +01:00
import * as routes from "./routes";
import ToastWrapper from "./components/Toast/ToastWrapper.svelte";
2021-03-26 16:51:23 +01:00
import ModalWrapper from "./components/Modals/ModalWrapper.svelte";
import { route as currentRoute, images } from "./stores";
const imageStore = images.store;
2021-03-13 01:30:45 +01:00
import Changelog from "components/Changelog";
2021-03-26 16:51:23 +01:00
import { onMount } from "svelte";
onMount(() => {
setTimeout(() => {
if ($imageStore.length > 0 && $currentRoute === "main") {
$currentRoute = "list";
}
}, 100);
});
2021-03-09 01:13:42 +01:00
</script>
2021-03-26 16:51:23 +01:00
<ModalWrapper />
2021-03-10 01:20:22 +01:00
{#if $currentRoute.startsWith("editor")}
<Editor />
{:else if $currentRoute in routes}
<svelte:component this={routes[$currentRoute]} />
{/if}
2021-03-09 01:13:42 +01:00
2021-03-10 01:20:22 +01:00
<ToastWrapper />