blackbirdchess-client-web/src/routes/+layout.svelte

56 lines
1.6 KiB
Svelte
Raw Normal View History

2023-03-18 18:07:38 +01:00
<script lang="ts">
2023-08-17 01:01:32 +02:00
import '$lib/scss/icons.scss'
2023-08-17 00:22:44 +02:00
// Most of your app wide CSS should be put in this file
import '../app.postcss';
2023-08-16 20:42:54 +02:00
2023-08-30 17:23:31 +02:00
import {alerts, sessionstore} from '$lib/stores';
2023-08-17 00:22:55 +02:00
import { autoModeWatcher } from '@skeletonlabs/skeleton';
2023-08-30 17:23:31 +02:00
import { AppShell } from '@skeletonlabs/skeleton';
import Header from '$lib/components/Header.svelte';
import Sidebar from '$lib/components/Sidebar.svelte';
2023-08-16 20:42:54 +02:00
let alertsvar;
2023-08-30 17:23:31 +02:00
let sessionvars;
2023-08-16 20:42:54 +02:00
function closeWarning(e) {
let index = e.target.dataset.index;
alerts.update(function (data) {
data.splice(index, 1)
return data;
})
}
alerts.subscribe((value) => {
alertsvar = value;
});
2023-08-30 17:23:31 +02:00
sessionstore.subscribe(value => {
sessionvars = value;
2023-08-16 20:42:54 +02:00
});
2023-03-18 18:07:38 +01:00
</script>
<style lang="scss">
.alert {
&.error {
@apply variant-filled-error;
}
&.warning {
@apply variant-filled-warning;
}
&.success {
@apply variant-filled-success;
}
}
</style>
2023-08-17 00:22:55 +02:00
<svelte:head>{@html `<script>${autoModeWatcher.toString()} autoModeWatcher();</script>`}</svelte:head>
2023-08-16 20:42:54 +02:00
2023-08-30 17:23:31 +02:00
{#if typeof sessionvars.authorization === 'undefined'}
<slot />
{:else}
<AppShell slotSidebarLeft="bg-surface-200 dark:bg-surface-800 w-1/6 ml-4 mb-4 p-4 rounded-l-xl" regionPage="bg-surface-100 dark:bg-surface-900 mr-4 mb-4 p-4 rounded-r-xl">
<svelte:fragment slot="header">
<Header/>
</svelte:fragment>
<svelte:fragment slot="sidebarLeft">
<Sidebar/>
</svelte:fragment>
<slot />
</AppShell>
{/if}