pediatric-ai-scribe-v3/public/js/e2e-bootstrap.js
Daniel 1431498fd6 feat(nav): promote Bedside to its own tab; reorganise sidebar sections
Bedside is now a top-level tab instead of a sub-pill inside Calculators —
it's the highest-traffic emergency reference in the app and deserves a
one-click entry. Same DOM structure and JS modules; only the container
moved.

Sidebar reorg:
- Notes: Hospital Course, Chart Review, SOAP Note, Well Visit, Sick Visit
  (Well Visit + Sick Visit relocated from the old "Pediatric" group —
  they're clinical note workflows, not pure reference tools).
- Section rename: "Pediatric" → "Clinical Tools". The section now holds
  Vaccine Schedule, Catch-Up Schedule, Physical Exam Guide, Bedside,
  Calculators, Pagers & Extensions, Learning Hub, Content Manager — mix
  of reference tables + active calculators + utilities, none strictly
  pediatric. "Clinical Tools" reads naturally for the combined set.

Layout changes:
- calculators.html: dropped 480 lines of bedside panel + the Bedside
  nav-pill. The shared age→weight estimator moved with it.
- bedside.html: new component file, contains the full bedside card +
  the age→weight estimator prepended.
- index.html: added bedside-tab section, sidebar restructured.
- e2e-harness.html: renders calculators + bedside side-by-side (not the
  old calc-tab→bedside-pill dance) so the bedside smoke suite still
  works without auth. e2e-bootstrap fetches both with a cache-buster.
- bedside-smoke.spec.js: removed the now-obsolete calc-nav-pill click
  from each test.

Tab persistence is unchanged — ped_last_tab already survives sign-out,
and the lazy-load cache keeps sub-pill state across navigation within a
session. Persistence across browser restart for sub-pills is a separate
follow-up.
2026-04-23 18:58:38 +02:00

23 lines
1.1 KiB
JavaScript

// E2E harness bootstrap — external file because the app's CSP blocks inline scripts.
// Runs after calc-math.js + calculators.js (all three have `defer`, so execution
// is in document order once parsing completes).
(async function bootstrap() {
try {
// Cache-bust so stale playwright browser caches never serve an outdated
// component HTML between reorg deploys.
const cb = '?cb=' + Date.now();
const [calcHtml, bedsideHtml] = await Promise.all([
fetch('/components/calculators.html' + cb).then(r => r.text()),
fetch('/components/bedside.html' + cb).then(r => r.text()),
]);
document.getElementById('calculators-tab').innerHTML = calcHtml;
document.getElementById('bedside-tab').innerHTML = bedsideHtml;
// Fire tabChanged for both so per-tab initialisers run.
document.dispatchEvent(new CustomEvent('tabChanged', { detail: { tab: 'calculators' } }));
document.dispatchEvent(new CustomEvent('tabChanged', { detail: { tab: 'bedside' } }));
window.__harnessReady = true;
} catch (e) {
console.error('[e2e-harness] bootstrap failed:', e);
window.__harnessError = String(e);
}
})();