Overview
The layout components provide the fundamental structure for DoctorSoft+ application pages. They handle navigation, patient context, and responsive behavior across desktop and mobile devices.Layout
The main layout wrapper component that provides the application structure with sidebar and header.Props
The page content to render within the layout
Usage
Features
- Automatic patient context management
- Responsive sidebar (collapsed on hover)
- Patient selection and deselection
- Real-time counts for clinical records
- Appointment tracking (last and next)
- Mobile-optimized layout
Internal state
The Layout component manages:- Sidebar expansion state (
isExpanded) - Clinical record counts (history, evolution, prescriptions, files, somatometry)
- Patient appointment information
- User information (from AuthContext)
- Mobile detection
Sidebar
Collapsible navigation sidebar with role-based menu items.Props
Whether the sidebar is expanded or collapsed
Callback to update expansion state
Current user’s role for filtering navigation items
Application version to display in footer
Logout handler function
Whether the current device is mobile
Count of clinical evolution records to display as badge
Usage
Navigation items
Base navigation items (~/workspace/source/src/components/Sidebar.tsx:8-14):- Dashboard (
/) - Actividad (
/activity) - Agenda (
/agenda/agenda) - Pacientes (
/patients) - Citas (
/appointments)
- Unidades de Negocio (
/clinica) - Admin only - Usuarios (
/users) - Admin only - Configuración (
/settings) - Cerrar Sesión
Behavior
- Expands on mouse enter (desktop only)
- Collapses on mouse leave (desktop only)
- Shows tooltips when collapsed
- Displays notification badges for counts
- Filters items by user role
MainHeader
Header component displaying patient information or user info when no patient is selected.Props
Currently selected patient object or null
User information object with fields:
authId: stringnombre: string | nullidbu: string | nullbusiness_name: string | nullrol: string | null
Count of clinical history records
Count of clinical evolution records
Count of prescription records
Count of patient file records
Count of somatometry records
Information about the patient’s last appointment
Date of the patient’s next appointment
Whether the context menu is visible
Handler for context menu button clicks
Handler for deselecting the current patient
Handler for editing the current patient
Usage
Features
When patient is selected
- Patient avatar with initials
- Full name display
- Age, birth date, gender
- Contact information (phone, email)
- Last and next appointment dates
- Referring physician
- Context menu with actions:
- Deselect patient
- Edit patient
- Print patient data sheet
- Generate comprehensive clinical report
Patient navigation
Shows navigation tabs for medical/admin users (~/workspace/source/src/components/MainHeader.tsx:352-645):- Ficha Clínica (dropdown with submenu):
- Antecedentes Heredo-Familiares
- Antecedentes Patológicos
- Antecedentes no Patológicos
- Antecedentes Gineco-Obstétricos (female patients only)
- Evolución Clínica (with count badge)
- Recetas (with count badge)
- Archivos del Paciente (with count badge)
- Somatometrías (conditional, with count badge)
- Signos Vitales
When no patient is selected
Displays user information:- Welcome message with user name
- User role
- Business unit assignment
Conditional rendering
Somatometry tab only shows if:- Patient has existing somatometry records, OR
- Patient is under 66 months old (5 years 6 months)