import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { featureRoutes } from './routes.registry'; import { AuthMiddleware } from './middlewares'; import { Layouts } from '@/shared/constants'; import { memo } from '@/shared/utils'; import { ComponentType, ReactNode } from 'react'; const layoutMap: Record | null> = { dashboard: null, // Placeholder, should be DashboardLayout none: ({ children }) => <>{children}, }; export const Router = memo(() => { return ( {featureRoutes.map((route, index) => { const Layout = layoutMap[route.layout ?? Layouts.None]; const Page = route.element as ComponentType; if (!Layout) { return } />; } let element = ( ); if (route.protected) { element = ( ); } return ; })} } /> ); });