- Remove redundant Admin Panel link from top navigation bar. The sidebar already has the full admin model tree and the Dashboard shows a Proclamations card for Staff+ users. - Add listOnly: true to users admin config. Users are created via registration, not the admin panel. RUD operations still work.
80 lines
2.4 KiB
Svelte
80 lines
2.4 KiB
Svelte
<script lang="ts">
|
|
import { onMount } from 'svelte';
|
|
import { authClient } from '$lib/auth-client';
|
|
import { canAccessAdmin } from '$lib/svelte-admin/roles';
|
|
import './layout.css';
|
|
import favicon from '$lib/assets/favicon.svg';
|
|
|
|
let { data, children } = $props();
|
|
|
|
const session = authClient.useSession();
|
|
let isAdmin = $derived(canAccessAdmin(data.userRoleId));
|
|
|
|
let dark = $state(false);
|
|
|
|
onMount(() => {
|
|
dark = document.documentElement.classList.contains('dark');
|
|
});
|
|
|
|
function toggleTheme() {
|
|
dark = !dark;
|
|
if (dark) {
|
|
document.documentElement.classList.add('dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.classList.remove('dark');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<link rel="icon" href={favicon} />
|
|
<title>Rhema Wave Technologies</title>
|
|
<meta
|
|
name="description"
|
|
content="Rhema Wave Technologies User Portal — manage proclamations, audio content, and solfeggio frequencies."
|
|
/>
|
|
<meta name="theme-color" content="#6b7280" />
|
|
<meta property="og:title" content="Rhema Wave Technologies" />
|
|
<meta
|
|
property="og:description"
|
|
content="Manage proclamations, audio content, and solfeggio frequencies."
|
|
/>
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:site_name" content="Rhema Wave Technologies" />
|
|
<meta name="twitter:card" content="summary" />
|
|
</svelte:head>
|
|
|
|
<nav
|
|
class="flex w-full items-center justify-between border-b border-gray-200 px-8 py-6 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-100"
|
|
>
|
|
<span><a href="/" class="dark:text-gray-100">Rhema Wave Technologies</a></span>
|
|
<div class="flex items-center gap-4">
|
|
<button
|
|
onclick={toggleTheme}
|
|
class="border border-gray-300 px-3 py-1 text-sm dark:border-gray-600 dark:text-gray-300"
|
|
>
|
|
{dark ? 'Light' : 'Dark'}
|
|
</button>
|
|
{#if $session.data}
|
|
<a href="/dashboard" class="dark:text-gray-300 dark:hover:text-gray-100">Dashboard</a>
|
|
<button
|
|
class="dark:text-gray-300 dark:hover:text-gray-100"
|
|
onclick={async () => {
|
|
await authClient.signOut();
|
|
window.location.href = '/';
|
|
}}>Log Out</button
|
|
>
|
|
{:else}
|
|
<span class="dark:text-gray-300"
|
|
><a href="/login" class="dark:text-gray-300 dark:hover:text-gray-100">Log In</a> |
|
|
<a href="/register" class="dark:text-gray-300 dark:hover:text-gray-100">Register</a></span
|
|
>
|
|
{/if}
|
|
</div>
|
|
</nav>
|
|
<div class="flex min-h-0 flex-1 px-8 dark:bg-gray-950">
|
|
{@render children()}
|
|
</div>
|