import { lazy, Suspense } from 'react'; import { createBrowserRouter, Navigate } from 'react-router-dom'; import { ProtectedRoute } from './ProtectedRoute'; import { DashboardLayout } from '@app/layouts/DashboardLayout'; import { FullPageSpinner } from '@components/atoms/Spinner'; // Lazy load pages const LoginPage = lazy(() => import('@pages/auth/LoginPage')); const RegisterPage = lazy(() => import('@pages/auth/RegisterPage')); const ForgotPasswordPage = lazy(() => import('@pages/auth/ForgotPasswordPage')); const DashboardPage = lazy(() => import('@pages/dashboard/DashboardPage')); const NotFoundPage = lazy(() => import('@pages/NotFoundPage')); // Users pages const UsersListPage = lazy(() => import('@pages/users/UsersListPage')); const UserDetailPage = lazy(() => import('@pages/users/UserDetailPage')); const UserCreatePage = lazy(() => import('@pages/users/UserCreatePage')); const UserEditPage = lazy(() => import('@pages/users/UserEditPage')); // Companies pages const CompaniesListPage = lazy(() => import('@pages/companies/CompaniesListPage')); const CompanyDetailPage = lazy(() => import('@pages/companies/CompanyDetailPage')); const CompanyCreatePage = lazy(() => import('@pages/companies/CompanyCreatePage')); const CompanyEditPage = lazy(() => import('@pages/companies/CompanyEditPage')); // Partners pages const PartnersListPage = lazy(() => import('@pages/partners/PartnersListPage')); const PartnerDetailPage = lazy(() => import('@pages/partners/PartnerDetailPage')); const PartnerCreatePage = lazy(() => import('@pages/partners/PartnerCreatePage')); const PartnerEditPage = lazy(() => import('@pages/partners/PartnerEditPage')); // Billing pages const BillingPage = lazy(() => import('@pages/billing/BillingPage').then(m => ({ default: m.BillingPage }))); const PlansPage = lazy(() => import('@pages/billing/PlansPage').then(m => ({ default: m.PlansPage }))); const InvoicesPage = lazy(() => import('@pages/billing/InvoicesPage').then(m => ({ default: m.InvoicesPage }))); const UsagePage = lazy(() => import('@pages/billing/UsagePage').then(m => ({ default: m.UsagePage }))); function LazyWrapper({ children }: { children: React.ReactNode }) { return }>{children}; } function DashboardWrapper({ children }: { children: React.ReactNode }) { return ( {children} ); } export const router = createBrowserRouter([ // Public routes { path: '/login', element: ( ), }, { path: '/register', element: ( ), }, { path: '/forgot-password', element: ( ), }, // Protected routes { path: '/', element: , }, { path: '/dashboard', element: ( ), }, // Users routes { path: '/users', element: ( ), }, { path: '/users/new', element: ( ), }, { path: '/users/:id', element: ( ), }, { path: '/users/:id/edit', element: ( ), }, // Companies routes { path: '/companies', element: ( ), }, { path: '/companies/new', element: ( ), }, { path: '/companies/:id', element: ( ), }, { path: '/companies/:id/edit', element: ( ), }, // Partners routes { path: '/partners', element: ( ), }, { path: '/partners/new', element: ( ), }, { path: '/partners/:id', element: ( ), }, { path: '/partners/:id/edit', element: ( ), }, { path: '/inventory/*', element: (
Módulo de Inventario - En desarrollo
), }, { path: '/sales/*', element: (
Módulo de Ventas - En desarrollo
), }, { path: '/purchases/*', element: (
Módulo de Compras - En desarrollo
), }, { path: '/financial/*', element: (
Módulo Financiero - En desarrollo
), }, { path: '/projects/*', element: (
Módulo de Proyectos - En desarrollo
), }, { path: '/crm/*', element: (
Módulo CRM - En desarrollo
), }, { path: '/hr/*', element: (
Módulo RRHH - En desarrollo
), }, { path: '/settings/*', element: (
Configuración - En desarrollo
), }, // Billing routes { path: '/billing', element: ( ), }, { path: '/billing/plans', element: ( ), }, { path: '/billing/invoices', element: ( ), }, { path: '/billing/usage', element: ( ), }, { path: '/billing/*', element: (
Sección de facturación - En desarrollo
), }, // Error pages { path: '/unauthorized', element: (

403

No tienes permiso para acceder a esta página

), }, { path: '*', element: ( ), }, ]);