pediatric-ai-scribe-v3/public/app/assets/ConfirmModal-zYA0ebt6.js
Daniel 515c57571f perf(client): code-split every heavy route via React.lazy()
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.
2026-04-24 02:28:52 +02:00

1 line
No EOL
1.7 KiB
JavaScript

import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";var r=e(t(),1),i=n();function a({open:e,title:t,body:n,confirmText:a=`Confirm`,cancelText:o=`Cancel`,danger:s=!1,requirePassword:c=!1,passwordPlaceholder:l=`Password`,onConfirm:u,onCancel:d,busy:f=!1}){let[p,m]=(0,r.useState)(``);if((0,r.useEffect)(()=>{e||m(``)},[e]),(0,r.useEffect)(()=>{function t(t){e&&t.key===`Escape`&&d()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,d]),!e)return null;let h=f||c&&!p;return(0,i.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`confirm-modal-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,onClick:d,children:(0,i.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border border-border bg-background p-5 shadow-lg space-y-3`,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`h3`,{id:`confirm-modal-title`,className:`text-base font-semibold`,children:t}),n&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),c&&(0,i.jsx)(`input`,{type:`password`,autoFocus:!0,value:p,onChange:e=>m(e.target.value),placeholder:l,className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,onKeyDown:e=>{e.key===`Enter`&&!h&&u(p)}}),(0,i.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md border border-border px-3 py-2 text-sm`,"data-testid":`confirm-modal-cancel`,children:o}),(0,i.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>u(c?p:void 0),className:`rounded-md px-3 py-2 text-sm font-medium text-white disabled:opacity-50 `+(s?`bg-destructive`:`bg-primary`),"data-testid":`confirm-modal-ok`,children:f?`Working…`:a})]})]})})}export{a as t};