import type { FC, ReactNode } from 'react'; import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; import { ToastProvider } from './components/ui'; import { AuthProvider, useAuth } from './lib/auth'; import { QuickLinksProvider } from './lib/quicklinks'; import Dashboard from './pages/Dashboard'; import Agenda from './pages/Agenda'; import Pacientes from './pages/Pacientes'; import Pos from './pages/Pos'; import Visitas from './pages/Visitas'; import Consultas from './pages/Consultas'; import UltimasVisitas from './pages/UltimasVisitas'; import Servicios from './pages/Servicios'; import Medicos from './pages/Medicos'; import Monedero from './pages/Monedero'; import Pagos from './pages/Pagos'; import Ventas from './pages/Ventas'; import Cortes from './pages/Cortes'; import Reportes from './pages/Reportes'; import Configuracion from './pages/Configuracion'; import Cumpleanos from './pages/Cumpleanos'; import Inventario from './pages/Inventario'; import WacrmMessages from './pages/WacrmMessages'; import WacrmLeads from './pages/WacrmLeads'; import Login from './pages/Login'; import './App.css'; const FullScreenLoader: FC = () => (
); const RequireAuth: FC<{ children: ReactNode; href: string }> = ({ children, href }) => { const { user, loading, canSee } = useAuth(); if (loading) return ; if (!user) return ; if (!canSee(href)) return ; return <>{children}; }; const LoginRoute: FC = () => { const { user, loading } = useAuth(); if (loading) return ; if (user) return ; return ; }; const App: FC = () => { return ( } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> ); }; export default App;