import { Outlet, Link, useLocation } from 'react-router'; import { getAllRoutes } from './router-utils'; import { useState } from 'react'; export default function AppLayout() { const [isOpen, setIsOpen] = useState(false); const location = useLocation(); const isActive = (path: string) => location.pathname === path; const toggleMenu = () => setIsOpen(!isOpen); const navigationRoutes: { path: string; label: string }[] = getAllRoutes() .filter( route => route.handle?.showInNavigation === true && route.fullPath !== undefined && route.handle?.label !== undefined ) .map( route => ({ path: route.fullPath, label: route.handle?.label, }) as { path: string; label: string } ); return ( <> React App {isOpen && ( {navigationRoutes.map(item => ( setIsOpen(false)} className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${ isActive(item.path) ? 'bg-blue-100 text-blue-700' : 'text-gray-700 hover:bg-gray-100' }`} > {item.label} ))} )} > ); }