<script>
	import '../app.postcss';
	import Sidebar from '$lib/Sidebar.svelte';
	import UserStore from '$lib/UserStore';
	import { onMount } from 'svelte';
	import * as localForage from 'localforage';

	/**
	 * Master init for all things userstore, b/c async stuff somethimes does weired shit.
	 * Yes i know this isn't the best way to implement this, but linkylinky dashboard is just a oneshot sideproject r/n.
	*/	
	onMount(() => {
		UserStore.init();
		localForage.getItem('userdata', (err, value) => {
			if (value) {
				if (value.token) {
					UserStore.login(value);
				}
			}
		});
	});

</script>

<div style="min-height: 640px;" class="bg-white dark:bg-gray-800">
	<div class="h-screen flex overflow-hidden">
		<Sidebar />
		<div class="px-4 py-8 flex flex-col w-0 flex-1 overflow-y-scroll">
			<slot />
		</div>
	</div>
</div>
