2026-07-31 18:26:08 +02:00
|
|
|
<script>
|
|
|
|
|
import { Tooltip } from 'bits-ui';
|
|
|
|
|
import Header from '$lib/components/Header.svelte';
|
2026-08-01 12:51:02 +02:00
|
|
|
import AuthPage from '$lib/features/auth/AuthPage.svelte';
|
|
|
|
|
import { createAuthStore } from '$lib/features/auth/auth.svelte.js';
|
2026-07-31 18:26:08 +02:00
|
|
|
|
|
|
|
|
let { children } = $props();
|
2026-08-01 12:51:02 +02:00
|
|
|
|
|
|
|
|
const auth = createAuthStore();
|
2026-07-31 18:26:08 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<Tooltip.Provider delayDuration={300}>
|
2026-08-01 12:51:02 +02:00
|
|
|
{#if auth.loading}
|
|
|
|
|
<div class="flex min-h-screen items-center justify-center text-sm text-muted-fg">Loading…</div>
|
|
|
|
|
{:else if auth.error}
|
|
|
|
|
<div class="flex min-h-screen items-center justify-center px-4 text-sm text-danger">
|
|
|
|
|
{auth.error instanceof Error ? auth.error.message : 'Request failed.'}
|
|
|
|
|
</div>
|
|
|
|
|
{:else if !auth.status || auth.status.setupRequired || !auth.status.authenticated}
|
|
|
|
|
<AuthPage setupRequired={auth.status?.setupRequired ?? true} />
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="flex min-h-screen flex-col">
|
|
|
|
|
<Header />
|
|
|
|
|
<main class="flex min-w-0 flex-1 flex-col">
|
|
|
|
|
{@render children?.()}
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2026-07-31 18:26:08 +02:00
|
|
|
</Tooltip.Provider>
|