User management is now centralized in AuthGuard's webui, so the per-project Admin dialog (user CRUD + require-login toggle) is redundant. The require-login toggle will move to ProjectConfigurator in the future. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
89 lines
2.2 KiB
Svelte
89 lines
2.2 KiB
Svelte
<script lang="ts">
|
|
import type { Snippet } from 'svelte';
|
|
import type { NavItem } from '../types';
|
|
import Header from './Header.svelte';
|
|
import NotificationStack from './NotificationStack.svelte';
|
|
import PageHeader from './PageHeader.svelte';
|
|
|
|
let {
|
|
aboutHref,
|
|
brand = 'Application',
|
|
brandHref = '/',
|
|
children,
|
|
class: className = '',
|
|
currentPath = '',
|
|
faviconHref = '/favicon.svg',
|
|
headerActions,
|
|
navItems = [],
|
|
onAbout,
|
|
onLogout,
|
|
onNavigate,
|
|
onProfile,
|
|
onSettings,
|
|
pageHeaderActions,
|
|
showPageHeader = true,
|
|
showSettings = true,
|
|
theme = 'dark',
|
|
username = '',
|
|
}: {
|
|
aboutHref?: string;
|
|
brand?: string;
|
|
brandHref?: string;
|
|
children?: Snippet;
|
|
class?: string;
|
|
currentPath?: string;
|
|
faviconHref?: string;
|
|
headerActions?: Snippet;
|
|
navItems?: NavItem[];
|
|
onAbout?: () => void | Promise<void>;
|
|
onLogout?: () => void | Promise<void>;
|
|
onNavigate?: (item: NavItem) => void;
|
|
onProfile?: () => void;
|
|
onSettings?: () => void;
|
|
pageHeaderActions?: Snippet;
|
|
showPageHeader?: boolean;
|
|
showSettings?: boolean;
|
|
theme?: 'dark' | 'light' | 'system';
|
|
username?: string;
|
|
} = $props();
|
|
|
|
const activeNavItem = $derived(
|
|
navItems.find((item) =>
|
|
item.href === '/' ? currentPath === '/' : currentPath === item.href || currentPath.startsWith(`${item.href}/`),
|
|
),
|
|
);
|
|
</script>
|
|
|
|
<div class={`sc-root sc-app-shell ${className}`} data-theme={theme === 'system' ? undefined : theme}>
|
|
<NotificationStack />
|
|
|
|
<Header
|
|
aboutHref={aboutHref ?? navItems.find((item) => item.label.toLowerCase() === 'about')?.href ?? '/about'}
|
|
{brand}
|
|
{brandHref}
|
|
{currentPath}
|
|
{faviconHref}
|
|
actions={headerActions}
|
|
{navItems}
|
|
{onAbout}
|
|
{onLogout}
|
|
{onNavigate}
|
|
{onProfile}
|
|
{onSettings}
|
|
{showSettings}
|
|
{username}
|
|
/>
|
|
|
|
<main class="sc-main">
|
|
{#if showPageHeader && activeNavItem?.href !== '/about'}
|
|
<PageHeader
|
|
title={activeNavItem?.label ?? brand}
|
|
description={activeNavItem?.description ??
|
|
`Explore the ${activeNavItem?.label?.toLowerCase() ?? 'application'} section.`}
|
|
actions={pageHeaderActions}
|
|
/>
|
|
{/if}
|
|
{@render children?.()}
|
|
</main>
|
|
</div>
|