Cuts the initial bundle roughly in half. Users who open Home,
Extensions, or FAQ download ~343 kB / 106 kB gz instead of 817 kB /
230 kB gz. Heavy clinical reference data (PE_DATA, Fenton LMS,
Rosner BP splines, 15 Bedside drug panels, 10 Calculator formulas,
13 Settings sub-sections, 10 Admin sub-tabs) only loads when the
user opens that route.
client/src/App.tsx
Every route except Home / Extensions / FAQ wrapped in
React.lazy(() => import(...)) + <Suspense fallback>. Extensions and
FAQ stay in the main chunk because they're small (3 kB, 2 kB) and
likely visited early. The RouteFallback component shows a single
"Loading…" line — Vite prefetches chunks on hover so the delay is
typically invisible.
Resulting chunks (gzipped):
• index.js 106 kB React + Router + Query + Layout +
Home + Extensions + FAQ
• Bedside.js 33 kB 15 clinical dosing panels
• PeGuide.js 36 kB PE_DATA hierarchy + scales + sounds
• Calculators.js 42 kB All 10 calculators + BP Rosner
coefficients + Fenton + BMI LMS
• Settings.js 10 kB 13 Settings sub-sections
• Admin.js 7 kB 10 Admin sub-tabs
• Learning.js 3 kB
• Fenton chunk (shared) 3 kB Reused between Bedside neonatal
and the Growth Charts calculator
• Note pages (each) 1-2 kB Encounter / SOAP / Well / Sick /
Hospital / Chart / Dictation / Vax /
Catch-up individually chunked
Vite's 500 kB chunk-size warning is gone. No functional changes.
1 line
No EOL
2.2 KiB
JavaScript
1 line
No EOL
2.2 KiB
JavaScript
import{t as e}from"./jsx-runtime-ByY1xr43.js";import{i as t,o as n}from"./index-B0uH73Hx.js";var r=e();function i(){let{data:e,isLoading:i,error:a}=n({queryKey:[`schedule-data`],queryFn:()=>t.get(`/api/schedule-data`)});if(i)return(0,r.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading schedule…`});if(a)return(0,r.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:a.message});if(!e)return null;let o=e.visitAges.filter(t=>e.periodicity[t.id]?.vaccines?.length),s=[],c=new Set;return o.forEach(t=>{e.periodicity[t.id].vaccines.forEach(e=>{c.has(e.vaccine)||(c.add(e.vaccine),s.push(e.vaccine))})}),(0,r.jsxs)(`div`,{className:`max-w-full mx-auto p-6 space-y-4`,children:[(0,r.jsxs)(`header`,{children:[(0,r.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Vaccine Schedule`}),(0,r.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`AAP/ACIP 2025 complete immunization schedule (0–18 years).`})]}),(0,r.jsx)(`div`,{className:`rounded-lg border border-border overflow-auto bg-card`,children:(0,r.jsxs)(`table`,{className:`text-xs`,children:[(0,r.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{className:`text-left font-semibold px-3 py-2 border-b border-border min-w-[180px] sticky left-0 bg-muted`,children:`Vaccine`}),o.map(e=>(0,r.jsx)(`th`,{className:`px-2 py-2 border-b border-border text-center whitespace-nowrap`,children:e.label},e.id))]})}),(0,r.jsx)(`tbody`,{children:s.map(t=>(0,r.jsxs)(`tr`,{className:`even:bg-muted/20`,children:[(0,r.jsx)(`td`,{className:`px-3 py-2 border-b border-border font-medium sticky left-0 bg-card`,children:e.vaccineFullNames[t]||t}),o.map(n=>{let i=(e.periodicity[n.id].vaccines||[]).find(e=>e.vaccine===t);if(!i)return(0,r.jsx)(`td`,{className:`border-b border-border`},n.id);let a=typeof i.dose==`number`?`#`+i.dose:i.dose||`•`;return(0,r.jsx)(`td`,{className:`border-b border-border text-center bg-primary/10 font-mono text-[11px]`,title:i.notes||`${t} dose ${i.dose}`,children:a},n.id)})]},t))})]})}),(0,r.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Hover any filled cell for notes. Sources: AAP/Bright Futures (Feb 2025), CDC Child & Adolescent Immunization Schedule (2025).`})]})}export{i as default}; |