<script lang="ts">
	import { fade } from "svelte/transition";
	import Editor from "./routes/editor.svelte";
	import * as routes from "./routes";
	import ToastWrapper from "./components/Toast/ToastWrapper.svelte";
	import ModalWrapper from "./components/Modals/ModalWrapper.svelte";
	import { route as currentRoute, images } from "./stores";
	const imageStore = images.store;
	import Changelog from "components/Changelog";
	import { onMount } from "svelte";

	onMount(() => {
		setTimeout(() => {
			if ($imageStore.length > 0 && $currentRoute === "main") {
				$currentRoute = "list";
			}
		}, 100);
	});
</script>

<ModalWrapper />

{#if $currentRoute.startsWith("editor")}
	<Editor />
{:else if $currentRoute in routes}
	<svelte:component this={routes[$currentRoute]} />
{/if}

<ToastWrapper />
