import { Link, usePage } from "@inertiajs/react"; import { cn } from "@/lib/utils"; import { Building2, LayoutDashboard, LogOut, User, Menu, X, Settings, } from "lucide-react"; import { Toaster } from "sonner"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/Components/ui/dropdown-menu"; import { useState } from "react"; interface LandlordLayoutProps { children: React.ReactNode; title?: string; } export default function LandlordLayout({ children, title }: LandlordLayoutProps) { const { url, props } = usePage(); // @ts-ignore const user = props.auth?.user || { name: 'Admin', username: 'admin' }; const menuItems = [ { label: "儀表板", href: "/landlord", icon: LayoutDashboard, active: url === "/landlord" || url === "/landlord/", }, { label: "客戶管理", href: "/landlord/tenants", icon: Building2, active: url.startsWith("/landlord/tenants"), }, ]; const [isSidebarOpen, setIsSidebarOpen] = useState(false); return (
{/* Sidebar Overlay for mobile */} {isSidebarOpen && (
setIsSidebarOpen(false)} /> )} {/* Sidebar */} {/* Main Content */}
{/* Header */}

{title || "中央管理後台"}

{user.name} ({user.username}) {user.role_labels?.[0] || user.roles?.[0] || '系統管理員'}
{user.name} ({user.username}) 使用者設定 登出系統
{/* Content */}
{children}
); }