import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { BarChart3, Layers, Database, ShieldCheck, TrendingUp, CheckCircle2, Cpu, ArrowRight, } from 'lucide-react'; import { useModalA11y } from '../hooks/useModalA11y'; interface BenchmarkLaunchModalProps { isOpen: boolean; onClose?: () => void; onComplete: () => void; } interface BenchmarkStageInfo { id: number; label: string; subtext: string; tag: string; icon: typeof BarChart3; color: string; glow: string; } const BENCHMARK_STAGES: BenchmarkStageInfo[] = [ { id: 1, label: 'Kaggle & PaySim Baseline Ingestion', subtext: 'Loading 284,807 real-world credit card transactions & 492 fraud cases', tag: '284.8k Records · Loaded', icon: Database, color: '#6366f1', glow: 'rgba(99, 102, 241, 0.4)', }, { id: 2, label: 'Non-IID Dirichlet α=0.5 Cross-Bank Partition', subtext: 'Synthesizing heterogeneous data skew across JPM, HSBC & DBK nodes', tag: 'Dirichlet α=0.5 · Bounded', icon: Layers, color: '#8b5cf6', glow: 'rgba(139, 92, 246, 0.4)', }, { id: 3, label: 'Collaborative GNN vs Siloed Model Matrix', subtext: 'Benchmarking PR-AUC (0.8420 vs 0.6940) & ROC-AUC (0.9120 vs 0.8350)', tag: '+21.3% PR-AUC Gain', icon: TrendingUp, color: '#06b6d4', glow: 'rgba(6, 182, 212, 0.4)', }, { id: 4, label: 'Daily Cost & False Positive Reduction Audit', subtext: 'Reconciling cross-bank laundering volume detection (+$836.3k detected volume)', tag: '+55.59% Gain', icon: Cpu, color: '#10b981', glow: 'rgba(16, 185, 129, 0.4)', }, { id: 5, label: 'Launching Design Partner Benchmark Sandbox', subtext: 'Attestation verified. Opening live interactive empirical metrics canvas', tag: 'Sandbox Ready · v2.4', icon: ShieldCheck, color: '#38bdf8', glow: 'rgba(56, 189, 248, 0.4)', }, ]; export default function BenchmarkLaunchModal({ isOpen, onClose, onComplete }: BenchmarkLaunchModalProps) { const [currentStageIdx, setCurrentStageIdx] = useState(0); const [progress, setProgress] = useState(10); const { containerRef } = useModalA11y({ isOpen, onClose: onClose || onComplete, closeOnEscape: true, trapFocus: true, restoreFocus: true, }); useEffect(() => { if (!isOpen) { setCurrentStageIdx(0); setProgress(10); return; } const TOTAL_DURATION_MS = 850; const UPDATE_INTERVAL_MS = 15; const startTime = Date.now(); let completionTimeout: ReturnType | null = null; const timer = setInterval(() => { const elapsed = Date.now() - startTime; const rawPct = Math.min(100, 10 + (elapsed / TOTAL_DURATION_MS) * 90); setProgress(rawPct); const computedIdx = Math.min( BENCHMARK_STAGES.length - 1, Math.floor((elapsed / TOTAL_DURATION_MS) * BENCHMARK_STAGES.length) ); setCurrentStageIdx(computedIdx); if (elapsed >= TOTAL_DURATION_MS) { clearInterval(timer); setProgress(100); completionTimeout = setTimeout(() => { onComplete(); }, 100); } }, UPDATE_INTERVAL_MS); return () => { clearInterval(timer); if (completionTimeout) { clearTimeout(completionTimeout); } }; }, [isOpen, onComplete]); if (!isOpen) return null; const currentStage: BenchmarkStageInfo = BENCHMARK_STAGES[currentStageIdx] ?? (BENCHMARK_STAGES[0] as BenchmarkStageInfo); const CurrentIcon = currentStage.icon; return (
{/* Deep Backdrop with Ambient Glow */} {/* Modal Window Container */} {/* Top Edge Glow */}
{/* Header */}

Initializing Benchmark Sandbox

Empirical Proof & Real Data Baseline Engine

{Math.min(100, Math.round(progress))}%
{/* Active Stage Animated Card */}
Stage 0{currentStage.id} of 05

{currentStage.label}

{currentStage.tag}

{currentStage.subtext}

{/* Step Progression Indicators */}
{BENCHMARK_STAGES.map((s, idx) => { const isCompleted = idx < currentStageIdx; const isCurrent = idx === currentStageIdx; return (
{isCompleted ? ( ) : isCurrent ? ( ) : ( )} {s.label}
{isCompleted ? '✓ Done' : isCurrent ? 'Active...' : 'Queued'}
); })}
{/* Progress Bar */}
Authenticating Secure Sandbox... Redirecting to Benchmark Hub
); }