Spaces:
Running
Running
Yuchen Yuan commited on
Commit ·
28bbf5c
1
Parent(s): c6eecfe
frontend: split WelcomeTour into one file per slide
Browse filesEach of the four slides (welcome/algorithms/pipeline/try) now lives in
its own file under components/tour/, along with its inline SVG helpers.
WelcomeTour.tsx keeps the modal shell, slide sequencing, keyboard nav,
and first-visit hook.
Shell drops from 803 lines to 145; every slide is now editable without
scrolling past the other three.
Files changed (5)
1 unmodified line23456789101112131415161718192021222324252614 unmodified lines4142434445464791 unmodified lines1391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947951 unmodified line* Multi-slide onboarding overlay.** Shown automatically on the first visit (flag persisted in localStorage)* and re-openable via the help button in the TopBar. Illustrations are all* native SVG so no extra deps.*/import { useEffect, useState } from "react";import {Atom,ChevronLeft,ChevronRight,CircleDot,FileText,LineChart,Play,Shrink,Sparkles,Waypoints,X,} from "lucide-react";import { NODE_BY_KIND, type NodeKind } from "../lib/nodeCatalog";const TOUR_FLAG = "jqub-tour-seen-v1";14 unmodified linesif (open) setSlide("welcome");}, [open]);// Esc to close.useEffect(() => {if (!open) return;const h = (e: KeyboardEvent) => {91 unmodified lines);}/* ============================================================ *//* SLIDE 1 *//* ============================================================ */function WelcomeSlide() {return (<div className="p-8 sm:p-10 flex flex-col sm:flex-row gap-8 items-center"><div className="flex-1 min-w-0"><div className="chip mb-3 !text-accent !border-accent/40"><Sparkles className="w-3 h-3" /> JQub Lab · GMU ECE</div><h1 className="text-3xl sm:text-4xl font-semibold text-ink leading-tight mb-3">Welcome to <span className="bg-gradient-to-r from-accent via-accent2 to-accent3 bg-clip-text text-transparent">JQub Quantum Flow</span></h1><p className="text-mute leading-relaxed mb-4">A visual playground for three research algorithms from the{" "}<ahref="https://jqub.ece.gmu.edu/"target="_blank"rel="noreferrer"className="text-ink underline decoration-accent/40 underline-offset-2 hover:decoration-accent">JQub lab</a>{" "}at George Mason University (QuCAD, QuBound, and CompressVQC),applied to a quantum circuit of your choice.</p><p className="text-sm text-mute leading-relaxed">Build a pipeline by dragging blocks, hit{" "}<span className="kbd">Run pipeline</span>, and see what happens wheneach algorithm meets real IBM hardware noise.</p></div><div className="shrink-0"><HeroSVG /></div></div>);}function HeroSVG() {return (<svgwidth="220"height="220"viewBox="0 0 220 220"xmlns="http://www.w3.org/2000/svg"role="img"aria-label="JQub atom emblem"><defs><radialGradient id="core" cx="50%" cy="50%" r="50%"><stop offset="0%" stopColor="#4cc9f0" stopOpacity="1" /><stop offset="60%" stopColor="#7b5cff" stopOpacity="0.8" /><stop offset="100%" stopColor="#0b1020" stopOpacity="0" /></radialGradient><linearGradient id="orbit" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stopColor="#4cc9f0" /><stop offset="50%" stopColor="#7b5cff" /><stop offset="100%" stopColor="#f72585" /></linearGradient></defs><circle cx="110" cy="110" r="90" fill="url(#core)" />{[0, 60, 120].map((rot) => (<ellipsekey={rot}cx="110"cy="110"rx="85"ry="30"fill="none"stroke="url(#orbit)"strokeWidth="1.5"transform={`rotate(${rot} 110 110)`}opacity="0.9"/>))}{/* electrons */}{[0, 60, 120].map((rot, i) => (<g key={i} transform={`rotate(${rot} 110 110)`}><circle cx="195" cy="110" r="3.5" fill="#4cc9f0"><animateTransformattributeName="transform"type="rotate"from="0 110 110"to="360 110 110"dur={`${5 + i}s`}repeatCount="indefinite"/></circle></g>))}<circle cx="110" cy="110" r="10" fill="#e6ebff" /></svg>);}/* ============================================================ *//* SLIDE 2 *//* ============================================================ */function AlgorithmsSlide() {return (<div className="p-6 sm:p-8"><div className="mb-5"><div className="text-xs uppercase tracking-wider text-mute mb-1">The three algorithms</div><h2 className="text-xl font-semibold text-ink">One block each. Chain them any way you like.</h2></div><div className="grid grid-cols-1 md:grid-cols-3 gap-3"><AlgoCardaccent="text-accent2"border="border-accent2/40"bg="bg-accent2/5"icon={<Waypoints className="w-4 h-4" strokeWidth={2} />}name="QuCAD"kind="qucad"oneLine="Noise-aware VQC sparsification."detail="Prunes parameters that don't survive hardware noise, via ADMM with a stochastic-mask regulariser. Fewer gates, same answer."><QuCADVisual /></AlgoCard><AlgoCardaccent="text-accent3"border="border-accent3/40"bg="bg-accent3/5"icon={<LineChart className="w-4 h-4" strokeWidth={2} />}name="QuBound"kind="qubound"oneLine="Today's error bound, predicted."detail="Trains an LSTM on 14 days of real IBM Fez calibration data to predict a tight fidelity bound for your circuit, without running it."><QuBoundVisual /></AlgoCard><AlgoCardaccent="text-accent4"border="border-accent4/40"bg="bg-accent4/5"icon={<Shrink className="w-4 h-4" strokeWidth={2} />}name="CompressVQC"kind="compvqc"oneLine="QAOA-optimized circuit folding."detail="Builds a lookup table of equivalent gate sequences, then solves a QUBO to fold redundant rotations on Heron-family hardware."><CompVQCVisual /></AlgoCard></div><div className="mt-5 panel-alt p-3 text-[12px] text-mute leading-relaxed">These aren't toy demos. Each block wraps the actual code from thelab's research publications. Runs happen server-side with Qiskit +PyTorch.</div></div>);}function AlgoCard({accent,border,bg,icon,name,kind,oneLine,detail,children,}: {accent: string;border: string;bg: string;icon: React.ReactNode;name: string;kind: NodeKind;oneLine: string;detail: string;children: React.ReactNode;}) {const paper = NODE_BY_KIND[kind]?.paper;return (<div className={`panel-alt p-4 border ${border} ${bg} flex flex-col`}><div className={`flex items-center gap-2 ${accent}`}><spanclassName={`w-7 h-7 rounded-md border ${border} bg-surface flex items-center justify-center shrink-0`}>{icon}</span><div className="font-semibold text-ink">{name}</div></div><div className="mt-2 text-[13px] text-ink">{oneLine}</div><div className="mt-1 text-[11px] text-mute leading-relaxed">{detail}</div>{paper && (<ahref={paper.url}target="_blank"rel="noopener noreferrer"className="mt-2 inline-flex items-center gap-1 text-[11px] text-mute hover:text-ink transition-colors self-start"title={paper.title}><FileText className="w-3 h-3" strokeWidth={2} /><span className="underline decoration-edge underline-offset-2 hover:decoration-accent">{paper.venue}</span></a>)}<div className="mt-3 h-[84px] flex items-center justify-center">{children}</div></div>);}function QuCADVisual() {// Parameter-magnitude bars: pre-prune (tall) vs post-prune (many zero).const pre = [0.7, 0.9, 0.45, 0.82, 0.55, 0.65, 0.92, 0.38, 0.7, 0.6];const post = [0.72, 0.92, 0.0, 0.85, 0.0, 0.0, 0.95, 0.0, 0.71, 0.0];return (<svg viewBox="0 0 240 80" width="100%" height="80" aria-label="QuCAD sparsity">{pre.map((h, i) => (<g key={i}><rectx={10 + i * 22}y={70 - h * 60}width={8}height={h * 60}fill="#7b5cff"opacity="0.25"/><rectx={20 + i * 22}y={70 - post[i] * 60}width={8}height={post[i] * 60}fill="#7b5cff"opacity={post[i] === 0 ? 0.15 : 1}><animateattributeName="height"from={pre[i] * 60}to={post[i] * 60}dur="1.8s"repeatCount="indefinite"values={`${pre[i] * 60};${post[i] * 60};${pre[i] * 60}`}keyTimes="0;0.5;1"/><animateattributeName="y"from={70 - pre[i] * 60}to={70 - post[i] * 60}dur="1.8s"repeatCount="indefinite"values={`${70 - pre[i] * 60};${70 - post[i] * 60};${70 - pre[i] * 60}`}keyTimes="0;0.5;1"/></rect></g>))}<line x1="0" y1="70" x2="240" y2="70" stroke="#1f2a4a" strokeWidth="1" /></svg>);}function QuBoundVisual() {// A wavy calibration history followed by a flat predicted bound.const pts = Array.from({ length: 48 }, (_, i) => {const x = i * 4 + 8;const noise =30 +12 * Math.sin(i / 3) +6 * Math.sin(i / 1.4) +(i > 36 ? 4 : 0);return `${x},${80 - noise * 1.2}`;}).join(" ");return (<svg viewBox="0 0 220 80" width="100%" height="80" aria-label="QuBound LSTM prediction"><line x1="150" y1="0" x2="150" y2="80" stroke="#1f2a4a" strokeDasharray="2 3" /><polylinepoints={pts}fill="none"stroke="#f72585"strokeWidth="1.5"opacity="0.9"/>{/* prediction zone */}<rect x="150" y="22" width="64" height="8" fill="#f72585" opacity="0.18" /><linex1="150"y1="26"x2="214"y2="26"stroke="#f72585"strokeWidth="2"strokeDasharray="4 3"/><text x="155" y="18" fill="#f72585" fontSize="8" fontFamily="monospace">bound</text><text x="8" y="14" fill="#8492c7" fontSize="8" fontFamily="monospace">14-day noise →</text></svg>);}function CompVQCVisual() {// "Before" and "after" gate sequences; some gates dimmed out (folded).const before = [0, 1, 2, 3, 4, 5, 6];const folded = new Set([1, 3, 5]);return (<svg viewBox="0 0 240 84" width="100%" height="84" aria-label="CompressVQC folding">{/* two qubit lines */}<line x1="10" y1="22" x2="230" y2="22" stroke="#1f2a4a" /><line x1="10" y1="62" x2="230" y2="62" stroke="#1f2a4a" />{before.map((i) => (<g key={i}><rectx={20 + i * 28}y={14}width={16}height={16}rx={3}fill={folded.has(i) ? "transparent" : "#06d6a0"}stroke="#06d6a0"strokeWidth={folded.has(i) ? 1 : 0}opacity={folded.has(i) ? 0.35 : 1}/>{folded.has(i) && (<><linex1={20 + i * 28}y1={14}x2={36 + i * 28}y2={30}stroke="#f72585"strokeWidth="1"opacity="0.6"/><linex1={20 + i * 28}y1={30}x2={36 + i * 28}y2={14}stroke="#f72585"strokeWidth="1"opacity="0.6"/></>)}<rectx={20 + i * 28}y={54}width={16}height={16}rx={3}fill={folded.has(i) ? "transparent" : "#06d6a0"}stroke="#06d6a0"strokeWidth={folded.has(i) ? 1 : 0}opacity={folded.has(i) ? 0.35 : 1}/></g>))}<text x="10" y="80" fill="#8492c7" fontSize="8" fontFamily="monospace">3 of 7 rotations folded</text></svg>);}/* ============================================================ *//* SLIDE 3 *//* ============================================================ */function PipelineSlide() {return (<div className="p-6 sm:p-8"><div className="mb-4"><div className="text-xs uppercase tracking-wider text-mute mb-1">How pipelines work</div><h2 className="text-xl font-semibold text-ink">Topologically sorted, executed server-side.</h2></div><div className="panel-alt p-5 mb-4"><PipelineSVG /></div><div className="grid grid-cols-1 sm:grid-cols-2 gap-3 text-[12px] leading-relaxed"><div className="panel-alt p-3"><div className="text-accent font-semibold mb-0.5">Blocks you drag</div><span className="text-mute">Each block wraps one stage: a circuit source, a backend, analgorithm, a metric, or a sink. Parameters are editable on theblock itself.</span></div><div className="panel-alt p-3"><div className="text-accent2 font-semibold mb-0.5">Links you draw</div><span className="text-mute">Connect block handles left-to-right. The runner topologicallysorts the graph; cycles are rejected before execution.</span></div><div className="panel-alt p-3"><div className="text-accent3 font-semibold mb-0.5">State between blocks</div><span className="text-mute">Each algorithm block may mutate the circuit in-place (CompressVQC,QuCAD) or emit a metric attached to the output (QuBound, Fidelity).</span></div><div className="panel-alt p-3"><div className="text-accent4 font-semibold mb-0.5">Offline by default</div><span className="text-mute">QuBound uses a 14-day cached calibration pickle; no IBM tokenneeded. Flip <span className="kbd">ALLOW_LIVE_IBM</span> to fetchfresh history.</span></div></div></div>);}function PipelineSVG() {return (<svgviewBox="0 0 680 140"width="100%"height="140"aria-label="Pipeline: circuit → backend → algorithm → output"><defs><linearGradient id="edgegrad" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#4cc9f0" stopOpacity="0.2" /><stop offset="100%" stopColor="#4cc9f0" stopOpacity="1" /></linearGradient></defs>{/* edges with animated particles */}{[[135, 390],[305, 560],[475, 680],].map(([x0, x1], i) => (<g key={i}><linex1={x0}y1={70}x2={x1}y2={70}stroke="#1f2a4a"strokeWidth="2"strokeDasharray="3 4"/><circle r="3.5" fill="#4cc9f0"><animateattributeName="cx"from={x0}to={x1}dur="2.2s"begin={`${i * 0.5}s`}repeatCount="indefinite"/><animateattributeName="cy"from={70}to={70}dur="2.2s"repeatCount="indefinite"/></circle></g>))}<PipelineNode x={20} y={40} color="#4cc9f0" label="Input circuit" sub="SOURCE" kind="circuit" /><PipelineNode x={190} y={40} color="#4cc9f0" label="Noisy simulator" sub="BACKEND" kind="backend" /><PipelineNode x={360} y={40} color="#7b5cff" label="QuCAD" sub="ALGORITHM" kind="algo" /><PipelineNode x={530} y={40} color="#e6ebff" label="Output" sub="SINK" kind="out" /></svg>);}function PipelineNode({x,y,color,label,sub,kind,}: {x: number;y: number;color: string;label: string;sub: string;kind: "circuit" | "backend" | "algo" | "out";}) {return (<g transform={`translate(${x}, ${y})`}><rectwidth="120"height="60"rx="8"fill="#111830"stroke={color}strokeOpacity="0.55"/><g transform="translate(12, 12)"><rect width="28" height="28" rx="6" fill="#0b1020" stroke={color} strokeOpacity="0.5" />{kind === "circuit" && <CircuitGlyph color={color} />}{kind === "backend" && <BackendGlyph color={color} />}{kind === "algo" && <AlgoGlyph color={color} />}{kind === "out" && <OutGlyph color={color} />}</g><text x="50" y="25" fontSize="11" fill="#e6ebff" fontFamily="ui-sans-serif">{label}</text><text x="50" y="40" fontSize="8" fill="#8492c7" fontFamily="monospace" letterSpacing="1">{sub}</text>{/* handles */}<circle cx="0" cy="30" r="3" fill="#0b1020" stroke={color} /><circle cx="120" cy="30" r="3" fill="#0b1020" stroke={color} /></g>);}function CircuitGlyph({ color }: { color: string }) {return (<g stroke={color} fill="none" strokeWidth="1.3"><line x1="4" y1="10" x2="24" y2="10" /><line x1="4" y1="20" x2="24" y2="20" /><rect x="8" y="6" width="6" height="8" fill={color} opacity="0.3" /><circle cx="18" cy="20" r="2" fill={color} /></g>);}function BackendGlyph({ color }: { color: string }) {return (<g stroke={color} fill="none" strokeWidth="1.3"><rect x="4" y="4" width="20" height="8" rx="1" /><rect x="4" y="16" width="20" height="8" rx="1" /><circle cx="8" cy="8" r="1" fill={color} /><circle cx="8" cy="20" r="1" fill={color} /></g>);}function AlgoGlyph({ color }: { color: string }) {return (<g stroke={color} fill="none" strokeWidth="1.3"><polyline points="4,22 10,12 16,18 24,6" /><circle cx="10" cy="12" r="1.5" fill={color} /><circle cx="24" cy="6" r="1.5" fill={color} /></g>);}function OutGlyph({ color }: { color: string }) {return (<g stroke={color} fill="none" strokeWidth="1.3"><rect x="5" y="5" width="18" height="18" rx="2" /><polyline points="9,14 13,18 20,10" /></g>);}/* ============================================================ *//* SLIDE 4 *//* ============================================================ */function TrySlide() {return (<div className="p-6 sm:p-8"><div className="mb-5"><div className="text-xs uppercase tracking-wider text-mute mb-1">You're ready</div><h2 className="text-xl font-semibold text-ink mb-1">A default pipeline is already loaded.</h2><p className="text-mute text-sm">Pick one of the sample circuits on the left, then hit{" "}<span className="kbd">Run pipeline</span> in the canvas toolbar.Default pipelines on the built-in samples hit a precomputed cacheand return instantly. Switch in <span className="text-ink">QuBound</span>{" "}with a cache miss and the run can take about two minutes on HF'sshared CPU while it trains the LSTM — don't close the tab.</p></div><div className="grid grid-cols-1 md:grid-cols-2 gap-3"><div className="panel-alt p-4"><div className="flex items-center gap-2 text-accent mb-2"><CircleDot className="w-3.5 h-3.5" /><span className="text-xs font-semibold uppercase tracking-wider">What to try first</span></div><ul className="text-[12px] text-mute space-y-1.5 leading-relaxed"><li><span className="text-ink">bell_state</span> + QuCAD →instant (precomputed), shows noise-aware parameter pruningend-to-end.</li><li><span className="text-ink">efficient_su2_4q</span> + QuBound →see the LSTM-predicted error bound fall out.</li><li><span className="text-ink">qaoa_maxcut_4</span> + CompressVQC →see how many rotations can be folded.</li></ul></div><div className="panel-alt p-4"><div className="flex items-center gap-2 text-accent2 mb-2"><Atom className="w-3.5 h-3.5" /><span className="text-xs font-semibold uppercase tracking-wider">Build your own</span></div><ul className="text-[12px] text-mute space-y-1.5 leading-relaxed"><li>Drag blocks from the strip at the top of the canvas.</li><li>Connect their handles left-to-right.</li><li>Hover a block to reveal the <span className="kbd">×</span>{" "}delete button.</li><li>Upload your own Qiskit <span className="kbd">.qpy</span> orOpenQASM <span className="kbd">.qasm</span> circuit via the{" "}<span className="text-ink">upload</span> link.</li></ul></div></div><div className="mt-4 flex items-center gap-2 text-[11px] text-mute"><Sparkles className="w-3 h-3 text-accent" />You can re-open this tour any time from the{" "}<span className="text-ink">Tour</span> button in the top-right.</div></div>);}/* ============================================================ *//* First-visit hook *//* ============================================================ */export function useFirstVisitTour(): [boolean, (open: boolean) => void] {const [open, setOpen] = useState(false);useEffect(() => {1 unmodified line2345678910111213141516171814 unmodified lines3334353637383991 unmodified lines1311321331341351361371 unmodified line* Multi-slide onboarding overlay.** Shown automatically on the first visit (flag persisted in localStorage)* and re-openable via the help button in the TopBar. Each slide lives in* its own file under `./tour/`; this module owns the modal shell, slide* sequencing, and the first-visit hook.*/import { useEffect, useState } from "react";import { ChevronLeft, ChevronRight, Play, X } from "lucide-react";import { WelcomeSlide } from "./tour/WelcomeSlide";import { AlgorithmsSlide } from "./tour/AlgorithmsSlide";import { PipelineSlide } from "./tour/PipelineSlide";import { TrySlide } from "./tour/TrySlide";const TOUR_FLAG = "jqub-tour-seen-v1";14 unmodified linesif (open) setSlide("welcome");}, [open]);// Keyboard shortcuts: Esc closes, arrow keys navigate between slides.useEffect(() => {if (!open) return;const h = (e: KeyboardEvent) => {91 unmodified lines);}/** First-visit hook: pop the tour on initial load unless already seen. */export function useFirstVisitTour(): [boolean, (open: boolean) => void] {const [open, setOpen] = useState(false);useEffect(() => {
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268// Tour slide 2: the three algorithms as cards with inline SVG visuals.
import { FileText, LineChart, Shrink, Waypoints } from "lucide-react";import { NODE_BY_KIND, type NodeKind } from "../../lib/nodeCatalog";
export function AlgorithmsSlide() { return ( <div className="p-6 sm:p-8"> <div className="mb-5"> <div className="text-xs uppercase tracking-wider text-mute mb-1"> The three algorithms </div> <h2 className="text-xl font-semibold text-ink"> One block each. Chain them any way you like. </h2> </div> <div className="grid grid-cols-1 md:grid-cols-3 gap-3"> <AlgoCard accent="text-accent2" border="border-accent2/40" bg="bg-accent2/5" icon={<Waypoints className="w-4 h-4" strokeWidth={2} />} name="QuCAD" kind="qucad" oneLine="Noise-aware VQC sparsification." detail="Prunes parameters that don't survive hardware noise, via ADMM with a stochastic-mask regulariser. Fewer gates, same answer." > <QuCADVisual /> </AlgoCard> <AlgoCard accent="text-accent3" border="border-accent3/40" bg="bg-accent3/5" icon={<LineChart className="w-4 h-4" strokeWidth={2} />} name="QuBound" kind="qubound" oneLine="Today's error bound, predicted." detail="Trains an LSTM on 14 days of real IBM Fez calibration data to predict a tight fidelity bound for your circuit, without running it." > <QuBoundVisual /> </AlgoCard> <AlgoCard accent="text-accent4" border="border-accent4/40" bg="bg-accent4/5" icon={<Shrink className="w-4 h-4" strokeWidth={2} />} name="CompressVQC" kind="compvqc" oneLine="QAOA-optimized circuit folding." detail="Builds a lookup table of equivalent gate sequences, then solves a QUBO to fold redundant rotations on Heron-family hardware." > <CompVQCVisual /> </AlgoCard> </div> <div className="mt-5 panel-alt p-3 text-[12px] text-mute leading-relaxed"> These aren't toy demos. Each block wraps the actual code from the lab's research publications. Runs happen server-side with Qiskit + PyTorch. </div> </div> );}
function AlgoCard({ accent, border, bg, icon, name, kind, oneLine, detail, children,}: { accent: string; border: string; bg: string; icon: React.ReactNode; name: string; kind: NodeKind; oneLine: string; detail: string; children: React.ReactNode;}) { const paper = NODE_BY_KIND[kind]?.paper; return ( <div className={`panel-alt p-4 border ${border} ${bg} flex flex-col`}> <div className={`flex items-center gap-2 ${accent}`}> <span className={`w-7 h-7 rounded-md border ${border} bg-surface flex items-center justify-center shrink-0`} > {icon} </span> <div className="font-semibold text-ink">{name}</div> </div> <div className="mt-2 text-[13px] text-ink">{oneLine}</div> <div className="mt-1 text-[11px] text-mute leading-relaxed">{detail}</div> {paper && ( <a href={paper.url} target="_blank" rel="noopener noreferrer" className="mt-2 inline-flex items-center gap-1 text-[11px] text-mute hover:text-ink transition-colors self-start" title={paper.title} > <FileText className="w-3 h-3" strokeWidth={2} /> <span className="underline decoration-edge underline-offset-2 hover:decoration-accent"> {paper.venue} </span> </a> )} <div className="mt-3 h-[84px] flex items-center justify-center">{children}</div> </div> );}
function QuCADVisual() { // Parameter-magnitude bars: pre-prune (tall) vs post-prune (many zero). const pre = [0.7, 0.9, 0.45, 0.82, 0.55, 0.65, 0.92, 0.38, 0.7, 0.6]; const post = [0.72, 0.92, 0.0, 0.85, 0.0, 0.0, 0.95, 0.0, 0.71, 0.0]; return ( <svg viewBox="0 0 240 80" width="100%" height="80" aria-label="QuCAD sparsity"> {pre.map((h, i) => ( <g key={i}> <rect x={10 + i * 22} y={70 - h * 60} width={8} height={h * 60} fill="#7b5cff" opacity="0.25" /> <rect x={20 + i * 22} y={70 - post[i] * 60} width={8} height={post[i] * 60} fill="#7b5cff" opacity={post[i] === 0 ? 0.15 : 1} > <animate attributeName="height" from={pre[i] * 60} to={post[i] * 60} dur="1.8s" repeatCount="indefinite" values={`${pre[i] * 60};${post[i] * 60};${pre[i] * 60}`} keyTimes="0;0.5;1" /> <animate attributeName="y" from={70 - pre[i] * 60} to={70 - post[i] * 60} dur="1.8s" repeatCount="indefinite" values={`${70 - pre[i] * 60};${70 - post[i] * 60};${70 - pre[i] * 60}`} keyTimes="0;0.5;1" /> </rect> </g> ))} <line x1="0" y1="70" x2="240" y2="70" stroke="#1f2a4a" strokeWidth="1" /> </svg> );}
function QuBoundVisual() { // A wavy calibration history followed by a flat predicted bound. const pts = Array.from({ length: 48 }, (_, i) => { const x = i * 4 + 8; const noise = 30 + 12 * Math.sin(i / 3) + 6 * Math.sin(i / 1.4) + (i > 36 ? 4 : 0); return `${x},${80 - noise * 1.2}`; }).join(" "); return ( <svg viewBox="0 0 220 80" width="100%" height="80" aria-label="QuBound LSTM prediction"> <line x1="150" y1="0" x2="150" y2="80" stroke="#1f2a4a" strokeDasharray="2 3" /> <polyline points={pts} fill="none" stroke="#f72585" strokeWidth="1.5" opacity="0.9" /> {/* prediction zone */} <rect x="150" y="22" width="64" height="8" fill="#f72585" opacity="0.18" /> <line x1="150" y1="26" x2="214" y2="26" stroke="#f72585" strokeWidth="2" strokeDasharray="4 3" /> <text x="155" y="18" fill="#f72585" fontSize="8" fontFamily="monospace"> bound </text> <text x="8" y="14" fill="#8492c7" fontSize="8" fontFamily="monospace"> 14-day noise → </text> </svg> );}
function CompVQCVisual() { // "Before" and "after" gate sequences; some gates dimmed out (folded). const before = [0, 1, 2, 3, 4, 5, 6]; const folded = new Set([1, 3, 5]); return ( <svg viewBox="0 0 240 84" width="100%" height="84" aria-label="CompressVQC folding"> {/* two qubit lines */} <line x1="10" y1="22" x2="230" y2="22" stroke="#1f2a4a" /> <line x1="10" y1="62" x2="230" y2="62" stroke="#1f2a4a" /> {before.map((i) => ( <g key={i}> <rect x={20 + i * 28} y={14} width={16} height={16} rx={3} fill={folded.has(i) ? "transparent" : "#06d6a0"} stroke="#06d6a0" strokeWidth={folded.has(i) ? 1 : 0} opacity={folded.has(i) ? 0.35 : 1} /> {folded.has(i) && ( <> <line x1={20 + i * 28} y1={14} x2={36 + i * 28} y2={30} stroke="#f72585" strokeWidth="1" opacity="0.6" /> <line x1={20 + i * 28} y1={30} x2={36 + i * 28} y2={14} stroke="#f72585" strokeWidth="1" opacity="0.6" /> </> )} <rect x={20 + i * 28} y={54} width={16} height={16} rx={3} fill={folded.has(i) ? "transparent" : "#06d6a0"} stroke="#06d6a0" strokeWidth={folded.has(i) ? 1 : 0} opacity={folded.has(i) ? 0.35 : 1} /> </g> ))} <text x="10" y="80" fill="#8492c7" fontSize="8" fontFamily="monospace"> 3 of 7 rotations folded </text> </svg> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196// Tour slide 3: how pipelines work. Inline SVG pipeline + four tip cards.
export function PipelineSlide() { return ( <div className="p-6 sm:p-8"> <div className="mb-4"> <div className="text-xs uppercase tracking-wider text-mute mb-1"> How pipelines work </div> <h2 className="text-xl font-semibold text-ink"> Topologically sorted, executed server-side. </h2> </div>
<div className="panel-alt p-5 mb-4"> <PipelineSVG /> </div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 text-[12px] leading-relaxed"> <div className="panel-alt p-3"> <div className="text-accent font-semibold mb-0.5">Blocks you drag</div> <span className="text-mute"> Each block wraps one stage: a circuit source, a backend, an algorithm, a metric, or a sink. Parameters are editable on the block itself. </span> </div> <div className="panel-alt p-3"> <div className="text-accent2 font-semibold mb-0.5">Links you draw</div> <span className="text-mute"> Connect block handles left-to-right. The runner topologically sorts the graph; cycles are rejected before execution. </span> </div> <div className="panel-alt p-3"> <div className="text-accent3 font-semibold mb-0.5"> State between blocks </div> <span className="text-mute"> Each algorithm block may mutate the circuit in-place (CompressVQC, QuCAD) or emit a metric attached to the output (QuBound, Fidelity). </span> </div> <div className="panel-alt p-3"> <div className="text-accent4 font-semibold mb-0.5">Offline by default</div> <span className="text-mute"> QuBound uses a 14-day cached calibration pickle; no IBM token needed. Flip <span className="kbd">ALLOW_LIVE_IBM</span> to fetch fresh history. </span> </div> </div> </div> );}
function PipelineSVG() { return ( <svg viewBox="0 0 680 140" width="100%" height="140" aria-label="Pipeline: circuit → backend → algorithm → output" > <defs> <linearGradient id="edgegrad" x1="0" y1="0" x2="1" y2="0"> <stop offset="0%" stopColor="#4cc9f0" stopOpacity="0.2" /> <stop offset="100%" stopColor="#4cc9f0" stopOpacity="1" /> </linearGradient> </defs> {/* edges with animated particles */} {[ [135, 390], [305, 560], [475, 680], ].map(([x0, x1], i) => ( <g key={i}> <line x1={x0} y1={70} x2={x1} y2={70} stroke="#1f2a4a" strokeWidth="2" strokeDasharray="3 4" /> <circle r="3.5" fill="#4cc9f0"> <animate attributeName="cx" from={x0} to={x1} dur="2.2s" begin={`${i * 0.5}s`} repeatCount="indefinite" /> <animate attributeName="cy" from={70} to={70} dur="2.2s" repeatCount="indefinite" /> </circle> </g> ))}
<PipelineNode x={20} y={40} color="#4cc9f0" label="Input circuit" sub="SOURCE" kind="circuit" /> <PipelineNode x={190} y={40} color="#4cc9f0" label="Noisy simulator" sub="BACKEND" kind="backend" /> <PipelineNode x={360} y={40} color="#7b5cff" label="QuCAD" sub="ALGORITHM" kind="algo" /> <PipelineNode x={530} y={40} color="#e6ebff" label="Output" sub="SINK" kind="out" /> </svg> );}
function PipelineNode({ x, y, color, label, sub, kind,}: { x: number; y: number; color: string; label: string; sub: string; kind: "circuit" | "backend" | "algo" | "out";}) { return ( <g transform={`translate(${x}, ${y})`}> <rect width="120" height="60" rx="8" fill="#111830" stroke={color} strokeOpacity="0.55" /> <g transform="translate(12, 12)"> <rect width="28" height="28" rx="6" fill="#0b1020" stroke={color} strokeOpacity="0.5" /> {kind === "circuit" && <CircuitGlyph color={color} />} {kind === "backend" && <BackendGlyph color={color} />} {kind === "algo" && <AlgoGlyph color={color} />} {kind === "out" && <OutGlyph color={color} />} </g> <text x="50" y="25" fontSize="11" fill="#e6ebff" fontFamily="ui-sans-serif"> {label} </text> <text x="50" y="40" fontSize="8" fill="#8492c7" fontFamily="monospace" letterSpacing="1"> {sub} </text> {/* handles */} <circle cx="0" cy="30" r="3" fill="#0b1020" stroke={color} /> <circle cx="120" cy="30" r="3" fill="#0b1020" stroke={color} /> </g> );}
function CircuitGlyph({ color }: { color: string }) { return ( <g stroke={color} fill="none" strokeWidth="1.3"> <line x1="4" y1="10" x2="24" y2="10" /> <line x1="4" y1="20" x2="24" y2="20" /> <rect x="8" y="6" width="6" height="8" fill={color} opacity="0.3" /> <circle cx="18" cy="20" r="2" fill={color} /> </g> );}function BackendGlyph({ color }: { color: string }) { return ( <g stroke={color} fill="none" strokeWidth="1.3"> <rect x="4" y="4" width="20" height="8" rx="1" /> <rect x="4" y="16" width="20" height="8" rx="1" /> <circle cx="8" cy="8" r="1" fill={color} /> <circle cx="8" cy="20" r="1" fill={color} /> </g> );}function AlgoGlyph({ color }: { color: string }) { return ( <g stroke={color} fill="none" strokeWidth="1.3"> <polyline points="4,22 10,12 16,18 24,6" /> <circle cx="10" cy="12" r="1.5" fill={color} /> <circle cx="24" cy="6" r="1.5" fill={color} /> </g> );}function OutGlyph({ color }: { color: string }) { return ( <g stroke={color} fill="none" strokeWidth="1.3"> <rect x="5" y="5" width="18" height="18" rx="2" /> <polyline points="9,14 13,18 20,10" /> </g> );}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980// Tour slide 4: "you're ready" CTA with two tip columns.
import { Atom, CircleDot, Sparkles } from "lucide-react";
export function TrySlide() { return ( <div className="p-6 sm:p-8"> <div className="mb-5"> <div className="text-xs uppercase tracking-wider text-mute mb-1"> You're ready </div> <h2 className="text-xl font-semibold text-ink mb-1"> A default pipeline is already loaded. </h2> <p className="text-mute text-sm"> Pick one of the sample circuits on the left, then hit{" "} <span className="kbd">Run pipeline</span> in the canvas toolbar. Default pipelines on the built-in samples hit a precomputed cache and return instantly. Switch in <span className="text-ink">QuBound</span>{" "} with a cache miss and the run can take about two minutes on HF's shared CPU while it trains the LSTM — don't close the tab. </p> </div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3"> <div className="panel-alt p-4"> <div className="flex items-center gap-2 text-accent mb-2"> <CircleDot className="w-3.5 h-3.5" /> <span className="text-xs font-semibold uppercase tracking-wider"> What to try first </span> </div> <ul className="text-[12px] text-mute space-y-1.5 leading-relaxed"> <li> <span className="text-ink">bell_state</span> + QuCAD → instant (precomputed), shows noise-aware parameter pruning end-to-end. </li> <li> <span className="text-ink">efficient_su2_4q</span> + QuBound → see the LSTM-predicted error bound fall out. </li> <li> <span className="text-ink">qaoa_maxcut_4</span> + CompressVQC → see how many rotations can be folded. </li> </ul> </div>
<div className="panel-alt p-4"> <div className="flex items-center gap-2 text-accent2 mb-2"> <Atom className="w-3.5 h-3.5" /> <span className="text-xs font-semibold uppercase tracking-wider"> Build your own </span> </div> <ul className="text-[12px] text-mute space-y-1.5 leading-relaxed"> <li>Drag blocks from the strip at the top of the canvas.</li> <li>Connect their handles left-to-right.</li> <li> Hover a block to reveal the <span className="kbd">×</span>{" "} delete button. </li> <li> Upload your own Qiskit <span className="kbd">.qpy</span> or OpenQASM <span className="kbd">.qasm</span> circuit via the{" "} <span className="text-ink">upload</span> link. </li> </ul> </div> </div>
<div className="mt-4 flex items-center gap-2 text-[11px] text-mute"> <Sparkles className="w-3 h-3 text-accent" /> You can re-open this tour any time from the{" "} <span className="text-ink">Tour</span> button in the top-right. </div> </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899// Tour slide 1: intro. Big title + tagline + animated atom emblem.
import { Sparkles } from "lucide-react";
export function WelcomeSlide() { return ( <div className="p-8 sm:p-10 flex flex-col sm:flex-row gap-8 items-center"> <div className="flex-1 min-w-0"> <div className="chip mb-3 !text-accent !border-accent/40"> <Sparkles className="w-3 h-3" /> JQub Lab · GMU ECE </div> <h1 className="text-3xl sm:text-4xl font-semibold text-ink leading-tight mb-3"> Welcome to{" "} <span className="bg-gradient-to-r from-accent via-accent2 to-accent3 bg-clip-text text-transparent"> JQub Quantum Flow </span> </h1> <p className="text-mute leading-relaxed mb-4"> A visual playground for three research algorithms from the{" "} <a href="https://jqub.ece.gmu.edu/" target="_blank" rel="noreferrer" className="text-ink underline decoration-accent/40 underline-offset-2 hover:decoration-accent" > JQub lab </a>{" "} at George Mason University (QuCAD, QuBound, and CompressVQC), applied to a quantum circuit of your choice. </p> <p className="text-sm text-mute leading-relaxed"> Build a pipeline by dragging blocks, hit{" "} <span className="kbd">Run pipeline</span>, and see what happens when each algorithm meets real IBM hardware noise. </p> </div> <div className="shrink-0"> <HeroSVG /> </div> </div> );}
function HeroSVG() { return ( <svg width="220" height="220" viewBox="0 0 220 220" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="JQub atom emblem" > <defs> <radialGradient id="core" cx="50%" cy="50%" r="50%"> <stop offset="0%" stopColor="#4cc9f0" stopOpacity="1" /> <stop offset="60%" stopColor="#7b5cff" stopOpacity="0.8" /> <stop offset="100%" stopColor="#0b1020" stopOpacity="0" /> </radialGradient> <linearGradient id="orbit" x1="0" y1="0" x2="1" y2="1"> <stop offset="0%" stopColor="#4cc9f0" /> <stop offset="50%" stopColor="#7b5cff" /> <stop offset="100%" stopColor="#f72585" /> </linearGradient> </defs> <circle cx="110" cy="110" r="90" fill="url(#core)" /> {[0, 60, 120].map((rot) => ( <ellipse key={rot} cx="110" cy="110" rx="85" ry="30" fill="none" stroke="url(#orbit)" strokeWidth="1.5" transform={`rotate(${rot} 110 110)`} opacity="0.9" /> ))} {/* electrons */} {[0, 60, 120].map((rot, i) => ( <g key={i} transform={`rotate(${rot} 110 110)`}> <circle cx="195" cy="110" r="3.5" fill="#4cc9f0"> <animateTransform attributeName="transform" type="rotate" from="0 110 110" to="360 110 110" dur={`${5 + i}s`} repeatCount="indefinite" /> </circle> </g> ))} <circle cx="110" cy="110" r="10" fill="#e6ebff" /> </svg> );}frontend/src/components/WelcomeTour.tsx+10-668
frontend/src/components/tour/AlgorithmsSlide.tsxAdded+268
frontend/src/components/tour/PipelineSlide.tsxAdded+196
frontend/src/components/tour/TrySlide.tsxAdded+80
frontend/src/components/tour/WelcomeSlide.tsxAdded+99