Agenda: horario 8-19h, bloques de 15 min, cita rapida, vista restringida para rol medico y chips de pacientes por doctor

This commit is contained in:
2026-08-28 07:35:46 +00:00
parent f9fc66b343
commit 29225e848a
5 changed files with 446 additions and 81 deletions

View File

@@ -42,10 +42,17 @@ const RequireAuth: FC<{ children: ReactNode; href: string }> = ({ children, href
const LoginRoute: FC = () => {
const { user, loading } = useAuth();
if (loading) return <FullScreenLoader />;
if (user) return <Navigate to="/" replace />;
if (user) return <Navigate to={user.role === 'medico' ? '/agenda' : '/'} replace />;
return <Login />;
};
// Pantalla inicial por rol: el médico aterriza directo en su Agenda
const HomeRoute: FC = () => {
const { user } = useAuth();
if (user?.role === 'medico') return <Navigate to="/agenda" replace />;
return <Dashboard />;
};
const App: FC = () => {
return (
<AuthProvider>
@@ -54,7 +61,7 @@ const App: FC = () => {
<ToastProvider />
<Routes>
<Route path="/login" element={<LoginRoute />} />
<Route path="/" element={<RequireAuth href="/"><Dashboard /></RequireAuth>} />
<Route path="/" element={<RequireAuth href="/"><HomeRoute /></RequireAuth>} />
<Route path="/agenda" element={<RequireAuth href="/agenda"><Agenda /></RequireAuth>} />
<Route path="/pacientes" element={<RequireAuth href="/pacientes"><Pacientes /></RequireAuth>} />
<Route path="/pos" element={<RequireAuth href="/pos"><Pos /></RequireAuth>} />