Initial commit
This commit is contained in:
53
frontend-internal/src/routes/+layout.svelte
Normal file
53
frontend-internal/src/routes/+layout.svelte
Normal file
@@ -0,0 +1,53 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/Header.svelte';
|
||||
import Sidebar from '$lib/components/Sidebar.svelte';
|
||||
import Toast from '$lib/components/Toast.svelte';
|
||||
import { toast } from '$lib/stores/toast.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { auth } from '$lib/stores/auth.js';
|
||||
import '../app.css';
|
||||
|
||||
let sidebarOpen = false;
|
||||
|
||||
onMount(() => {
|
||||
auth.init();
|
||||
});
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarOpen = !sidebarOpen;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="min-h-screen bg-gray-50">
|
||||
{#if $auth.isAuthenticated}
|
||||
<!-- Internal Layout with Sidebar -->
|
||||
<div class="flex h-screen overflow-hidden">
|
||||
<!-- Sidebar -->
|
||||
<Sidebar bind:open={sidebarOpen} />
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="flex-1 flex flex-col overflow-hidden">
|
||||
<Header {toggleSidebar} />
|
||||
|
||||
<main class="flex-1 overflow-auto">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Login Layout -->
|
||||
<main class="flex-1">
|
||||
<slot />
|
||||
</main>
|
||||
{/if}
|
||||
|
||||
<!-- Toast notifications -->
|
||||
{#each $toast.toasts as toastMessage (toastMessage.id)}
|
||||
<Toast
|
||||
type={toastMessage.type}
|
||||
message={toastMessage.message}
|
||||
duration={toastMessage.duration}
|
||||
on:dismiss={() => toast.dismiss(toastMessage.id)}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
Reference in New Issue
Block a user