2026-08-18 12:52:40 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
const { initTheme, toggle, isDark } = useTheme()
|
2026-08-20 06:20:16 +07:00
|
|
|
const { ready, isAuthenticated, username, login, logout } = useAuth()
|
2026-08-18 12:52:40 +07:00
|
|
|
|
|
|
|
|
onMounted(() => initTheme())
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-08-20 21:34:45 +07:00
|
|
|
<div class="min-h-screen">
|
|
|
|
|
<a
|
|
|
|
|
href="#main"
|
|
|
|
|
class="sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 focus:z-50 focus:rounded-pill focus:bg-primary focus:px-4 focus:py-2 focus:text-on-primary"
|
|
|
|
|
>
|
|
|
|
|
ข้ามไปยังเนื้อหา
|
|
|
|
|
</a>
|
2026-08-20 06:20:16 +07:00
|
|
|
|
2026-08-20 21:34:45 +07:00
|
|
|
<header class="sticky top-0 z-20 border-b border-line bg-elevated/95 backdrop-blur">
|
|
|
|
|
<div class="mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-3 sm:px-6">
|
|
|
|
|
<div class="flex min-w-0 items-baseline gap-3">
|
|
|
|
|
<NuxtLink to="/" class="min-w-0 truncate text-lg font-semibold hover:text-primary">
|
|
|
|
|
e-Court Documents Versioning
|
2026-08-20 06:20:16 +07:00
|
|
|
</NuxtLink>
|
2026-08-20 21:34:45 +07:00
|
|
|
<span class="badge badge-accent hidden sm:inline-flex">web portal</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<nav class="flex flex-wrap items-center gap-2 text-sm">
|
|
|
|
|
<NuxtLink to="/" class="nav-link">สร้างเอกสาร</NuxtLink>
|
|
|
|
|
<NuxtLink to="/templates" class="nav-link">จัดการ template</NuxtLink>
|
2026-08-20 06:20:16 +07:00
|
|
|
|
2026-08-20 21:34:45 +07:00
|
|
|
<button type="button" class="btn btn-secondary btn-sm" @click="toggle">
|
2026-08-20 06:20:16 +07:00
|
|
|
{{ isDark ? '☀️ Light' : '🌙 Dark' }}
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<!-- สถานะ login รู้ผลหลัง restore session (client) — จึงต้อง ClientOnly กัน hydration mismatch -->
|
|
|
|
|
<ClientOnly>
|
|
|
|
|
<template #fallback>
|
2026-08-20 21:34:45 +07:00
|
|
|
<span class="inline-block w-24 text-right text-xs text-muted">…</span>
|
2026-08-20 06:20:16 +07:00
|
|
|
</template>
|
|
|
|
|
<template v-if="ready">
|
2026-08-20 21:34:45 +07:00
|
|
|
<span v-if="isAuthenticated" class="max-w-40 truncate text-xs text-muted">
|
2026-08-20 06:20:16 +07:00
|
|
|
{{ username }}
|
|
|
|
|
</span>
|
2026-08-20 21:34:45 +07:00
|
|
|
<button v-if="isAuthenticated" type="button" class="btn btn-secondary btn-sm" @click="logout">
|
2026-08-20 06:20:16 +07:00
|
|
|
ออกจากระบบ
|
|
|
|
|
</button>
|
2026-08-20 21:34:45 +07:00
|
|
|
<button v-else type="button" class="btn btn-primary btn-sm" @click="login()">
|
2026-08-20 06:20:16 +07:00
|
|
|
เข้าสู่ระบบ
|
|
|
|
|
</button>
|
|
|
|
|
</template>
|
|
|
|
|
</ClientOnly>
|
|
|
|
|
</nav>
|
|
|
|
|
</div>
|
2026-08-18 12:52:40 +07:00
|
|
|
</header>
|
2026-08-20 06:20:16 +07:00
|
|
|
|
2026-08-20 21:34:45 +07:00
|
|
|
<main id="main" class="mx-auto max-w-6xl px-4 py-6 sm:px-6 sm:py-8">
|
2026-08-18 12:52:40 +07:00
|
|
|
<NuxtPage />
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|