import { useMemo, useState } from 'react' import { Dialog, DialogBackdrop, DialogPanel, TransitionChild } from '@headlessui/react' import classNames from '~/lib/classNames' import { IconArrowLeft, IconBug } from '@tabler/icons-react' import { Link, usePage } from '@inertiajs/react' import { UsePageProps } from '../../types/system' import { IconMenu2, IconX } from '@tabler/icons-react' import ThemeToggle from '~/components/ThemeToggle' import DebugInfoModal from './DebugInfoModal' type SidebarItem = { name: string href: string icon?: React.ElementType current: boolean target?: string } interface StyledSidebarProps { title: string items: SidebarItem[] } const StyledSidebar: React.FC = ({ title, items }) => { const [sidebarOpen, setSidebarOpen] = useState(false) const [debugModalOpen, setDebugModalOpen] = useState(false) const { appVersion } = usePage().props as unknown as UsePageProps const currentPath = useMemo(() => { if (typeof window === 'undefined') return '' return window.location.pathname }, []) const ListItem = (item: SidebarItem) => { const className = classNames( item.current ? 'bg-desert-green text-white' : 'text-text-primary hover:bg-desert-green-light hover:text-white', 'group flex gap-x-3 rounded-md p-2 text-sm/6 font-semibold' ) const content = ( <> {item.icon &&