import type { ComponentType, ReactNode } from "react"; import { cn } from "../utils/cn.js"; export interface AppShellNavItem { key: string; label: string; href: string; icon?: ReactNode; active?: boolean; } interface NavLinkRenderProps { href: string; className?: string; children: ReactNode; } export interface AppShellProps { /** e.g. "EDEN Core" — shown next to the logo and used as the img alt text. */ appName: string; logoSrc?: string; navItems: AppShellNavItem[]; userName?: string; userRole?: string; onLogout?: () => void; children: ReactNode; /** * Router-agnostic navigation: packages/ui doesn't depend on react-router. * Defaults to a plain `` (full page reload); pass e.g. * `({ href, className, children }) => {children}` * from the consuming app to get client-side routing. */ LinkComponent?: ComponentType; } function DefaultLink({ href, className, children }: NavLinkRenderProps) { return ( {children} ); } /** * Visually inspired by the DreamsERP theme's sidebar/topbar * (react/src/components/common-sidebar, common-header) — sidebar with * logo + dark active nav item, white topbar with a bordered bottom edge — * without importing any of the theme's Redux/routing code. */ export function AppShell({ appName, logoSrc, navItems, userName, userRole, onLogout, children, LinkComponent = DefaultLink, }: AppShellProps) { return (
{logoSrc ? {appName} : null} {appName}
{userName ? (
{userName.charAt(0).toUpperCase()}

{userName}

{userRole ?

{userRole}

: null}
) : null} {onLogout ? ( ) : null}
{children}
); }