feat: two-lab switcher (synthetic Okafor + real McClean) - #6
Merged
Merged
Conversation
…public data) Swaps the prototype's single seed lab from the synthetic "Okafor Lab" to the real McClean Lab (PI Megan N. McClean, Dept. of Biomedical Engineering, UW-Madison), populated only from cited public evidence. All four flows + the guided tour now render coherently with McClean data and real citations. INTEGRITY BOUNDARY (documented at the top of src/lib/data.ts): REAL (from public sources, never invented): - LAB identity, mission, dept, Room 3156 ECB [mccleanlab.bme.wisc.edu] - PEOPLE names/roles/emails (emails left "" where not public) [mccleanlab.bme.wisc.edu/people/people/] - SKILLS, EQUIPMENT + models (Nikon Eclipse Ti, Eppendorf 5810R/5418) [openwetware.org/wiki/McClean:_Nikon_TI_Basic_Use] - REAGENTS + catalog numbers (PEG Sigma P3640, carrier DNA Sigma D1626, glass beads Fisher 11-312B, filter Nalgene 295-4545) [openwetware.org/wiki/McClean:Yeast_Transformation] - PROTOCOLS + steps + why + hazards (yeast transformation, Nikon Ti startup) - TACIT_NOTES verbatim (PEG-through-filter, carrier-DNA boil, scope warm-up, mandatory log book) - ONBOARDING journey (Statement of Expectations, WisCard, Ashley Prochaska HR, Larry Wheeler keys, OWW/CAE/Quartzy, biosafety training) [openwetware.org/wiki/McClean:_Joining_The_Lab] DEMO (synthesized, marked illustrative; captured at onboarding in production): - skills-competency MATRIX cell states - per-person joined dates, isNewHire / leavingInDays flags - the literal sole-ownership claim Bus-factor-1 thread is grounded in REAL named-author protocol attribution [openwetware.org/wiki/McClean:Protocols]: Ping Xu owns the "P. Xu" FISH variant (departing-expert thread), Renee Szakaly owns the "Mix & Go" competent-cell prep. The departing/new-hire TIMING is marked demo. New hire = Timothy Wakiyama (real roster member). Capturing Ping's FISH know-how drops bus-factor-1 risks 2 -> 1. CI: typecheck + next build green. Zero em-dashes. JoVE branding and DESIGN-SYSTEM intact. README data-provenance note updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restore the original synthetic Okafor Lab as a second selectable dataset alongside the real-public McClean Lab, with a calm, on-brand lab switcher. Default active lab = McClean (the real PoC headline). Every flow, graph, and tour swaps to the active lab with zero state bleed. Architecture (routing refactor, not a rewrite): - LabDataset type (src/lib/types.ts): carries each lab's identity, data, per-lab lookups, scripts, knowledge graph + per-lab neighborsOf, and a `narration` object that holds every authored lab-specific string and step-id gate (the part that kills hardcoded lab names in components). - buildGraph(src) (src/lib/graph.ts): builds the node set + a neighborsOf that closes over THIS lab's links (not a global). NODE_TYPE_LABELS stays shared. - Bundles: src/lib/labs/mcclean.ts (real-public, INTEGRITY BOUNDARY header + every // source: comment + DEMO: marker preserved verbatim) and src/lib/labs/okafor.ts (synthetic, faithfully recovered from f4a4f3d: the A-grade flows, the Sofia/Chen/Ada/Liang cast, iPSC protocols, the Sofia journey, the Okafor interview + chat scripts). Registry in labs/index.ts. - LabProvider + useLab() (src/components/shell/LabProvider.tsx): context always available; a tiny Suspense-wrapped child reads ?lab= from the URL. Selection precedence: URL, then localStorage, then DEFAULT (mcclean). setLab updates the URL via router.replace (preserves route + flow position) and localStorage. Nested OUTSIDE Compliance/Tour so both tour and flows see it. - LabSwitcher (top nav): accessible Radix dropdown, aria-label="Active lab", ring-2 ring-action focus, check on the active lab, per-lab provenance chip (McClean "Real public data" / Okafor "Illustrative demo"), single action-blue accent only. State-bleed prevention: - GraphExplorer/ForceGraph reset selection on dataset.id change. - Flow content is keyed by activeLabId (FlowKey in flows/layout.tsx), remounting the flow subtree on switch so no stale chat history / wizard phase / journey view / selected node leaks between labs. Chrome (nav/sidebar/tour) stays mounted above the key boundary. All flow components now read from useLab(): Landing, TopNav, Sidebar, Brain, Matrix, Journey, Setup, GraphExplorer, ForceGraph, TourProvider. No component imports @/lib/data, @/lib/graph (data), or @/lib/scripts anymore; the old data.ts/scripts.ts are removed (data.ts -> labs/mcclean.ts as a rename). Branding (joVE | LabOS), the pain-first A-grade landing copy, and the global Compliance toggle are unchanged. Zero em-dashes in src/. typecheck + next build clean. Verified headless (Playwright) per-lab across all four flows + the tour: McClean strings (McClean / Ping Xu / Nikon / PEG) and Okafor strings (Okafor / Sofia / iPSC / Chen / patch-clamp) render exclusively per lab; switch-stress (Okafor->McClean->Okafor) shows no bleed, clean console; ?lab= survives reload. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two-lab switcher: synthetic Okafor + real McClean
The app shipped one lab. This PR restores the original synthetic Okafor Lab as a second selectable dataset alongside the real-public McClean Lab, and adds a calm, on-brand lab switcher in the top nav. Default active lab = McClean (the real PoC headline). Switching swaps every flow, graph, and tour to the active lab with zero state bleed.
Architecture (routing refactor, not a rewrite)
LabDatasettype (src/lib/types.ts): each lab carries its identity, data arrays, per-lab lookups, scripts, a per-lab knowledge graph +neighborsOf, and anarrationobject holding every authored lab-specific string and step-id gate. This is what removes hardcoded lab names from the flow components.buildGraph(src)(src/lib/graph.ts): builds the node set + aneighborsOfthat closes over this lab's links (not a global).NODE_TYPE_LABELSstays shared.src/lib/labs/mcclean.ts(real-public; the INTEGRITY BOUNDARY header, every// source:comment, and everyDEMO:marker preserved verbatim),src/lib/labs/okafor.ts(synthetic; faithfully recovered fromf4a4f3d— the A-grade flows, the Sofia / Chen Yu / Ada Okafor / Liang Wei cast, iPSC protocols, the Sofia journey, the Okafor interview + chat scripts), registry inlabs/index.ts.LabProvider+useLab(): context is always available; a tiny Suspense-wrapped child reads?lab=(Next 15 requirement). Precedence: URL → localStorage → default (mcclean).setLabupdates the URL viarouter.replace(preserves route + flow position) and mirrors to localStorage. Nested outside Compliance/Tour so both see it.LabSwitcher: accessible Radix dropdown,aria-label="Active lab",ring-2 ring-actionfocus, check on the active lab, per-lab provenance chip (McClean "Real public data" / Okafor "Illustrative demo"), single action-blue accent only.State-bleed prevention
GraphExplorer/ForceGraphreset selection ondataset.idchange.activeLabId(FlowKeyinflows/layout.tsx) so the flow subtree remounts on switch — no stale chat history / wizard phase / journey view / selected node leaks between labs. Chrome (nav/sidebar/tour) stays mounted above the key boundary.Verification
tsc --noEmitclean;next buildclean (9/9 static pages). Nolintscript (CI skips by design).src/(grep -rn '—' src/is empty).?lab=survives a full reload; Brain answers cite only the active lab's nodes.A Vercel preview deploy from this PR is fine. Do not merge or touch production.
🤖 Generated with Claude Code