Spaces:
Running
Running
File size: 9,099 Bytes
518343a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | import { DEMO_SCENARIOS, type DemoScenarioKey, useDemoMode } from '../../lib/operations/demo-mode';
import { ArrowRight, Clock, Play, Sparkles, X } from 'lucide-react';
import { useEffect, useState } from 'react';
import { useLocation } from 'wouter';
const BASE = import.meta.env.BASE_URL.replace(/\/$/, '');
const STORAGE_KEY = 'command_demo_launchpad_dismissed';
type RouteKey = 'exec5' | 'operator15';
interface RouteOption {
key: RouteKey;
label: string;
minutes: number;
audience: string;
description: string;
steps: { label: string; href: string }[];
}
const ROUTES: RouteOption[] = [
{
key: 'exec5',
label: '5-Minute Executive',
minutes: 5,
audience: 'C-suite, investors, board',
description: 'One full governed decision cycle — signal to outcome, with proof.',
steps: [
{ label: 'Governed Decision Loop', href: '/operations/governed-decision-loop' },
{ label: 'Policy Gate', href: '/operations/governed-decision-loop?tab=policy' },
{ label: 'Approval Chain', href: '/operations/governed-decision-loop?tab=approval' },
{ label: 'Proof Chain', href: '/operations/governed-decision-loop?tab=proof' },
{ label: 'Outcome', href: '/operations/governed-decision-loop?tab=outcome' },
],
},
{
key: 'operator15',
label: '15-Minute Operator',
minutes: 15,
audience: 'VP Ops, Chief of Staff, enterprise buyers',
description: 'Signal triage, full nine-step loop, audit surface, cross-domain intelligence.',
steps: [
{ label: 'Signal Feed', href: '/operations/prism' },
{ label: 'Governed Decision Loop', href: '/operations/governed-decision-loop' },
{ label: 'Approvals', href: '/operations/policy-approvals' },
{ label: 'Trust Console', href: '/operations/trust-audit' },
{ label: 'Executive Briefing', href: '/strategy/executive-briefing' },
],
},
];
function isLive(): boolean {
const override = (import.meta.env.VITE_DEPLOY_ENV as string | undefined)?.toLowerCase();
if (override) return override === 'live';
return import.meta.env.PROD === true;
}
export function DemoLaunchpadPanel() {
const [, navigate] = useLocation();
const { activate } = useDemoMode();
const [dismissed, setDismissed] = useState(true);
const [selectedRoute, setSelectedRoute] = useState<RouteKey>('exec5');
const [selectedScenario, setSelectedScenario] = useState<DemoScenarioKey>('aegis');
useEffect(() => {
if (isLive()) return;
const stored = typeof window !== 'undefined' ? window.localStorage.getItem(STORAGE_KEY) : '1';
setDismissed(stored === '1');
}, []);
if (isLive() || dismissed) return null;
const route = ROUTES.find((r) => r.key === selectedRoute) ?? ROUTES[0];
const handleDismiss = () => {
try {
window.localStorage.setItem(STORAGE_KEY, '1');
} catch {
/* ignore */
}
setDismissed(true);
};
const goTo = (href: string) => {
if (href.startsWith('http')) {
window.location.href = href;
return;
}
const path = href.startsWith(BASE) ? href.slice(BASE.length) || '/' : href;
navigate(path);
};
const handleStart = () => {
activate(selectedScenario);
goTo('/operations/governed-decision-loop');
};
return (
<div
data-testid="demo-launchpad-panel"
className="rounded-xl overflow-hidden"
style={{
backgroundColor: 'var(--color-bg-elevated)',
border: '1px solid color-mix(in srgb, #d4a054 30%, transparent)',
padding: '20px 24px',
position: 'relative',
}}
>
<button
type="button"
aria-label="Dismiss demo launchpad"
onClick={handleDismiss}
style={{
position: 'absolute',
top: 12,
right: 12,
background: 'transparent',
border: 'none',
cursor: 'pointer',
color: 'var(--color-fg-muted)',
padding: 4,
}}
>
<X className="w-4 h-4" />
</button>
<div className="flex items-center gap-2 mb-1">
<Sparkles className="w-4 h-4" style={{ color: '#d4a054' }} />
<span
className="text-[10px] font-bold uppercase tracking-widest"
style={{ color: '#d4a054' }}
>
Demo Launchpad
</span>
</div>
<p className="text-xs mb-4" style={{ color: 'var(--color-fg-muted)' }}>
One-click start for presenters. Pick a route, pick a scenario, then launch the governed
decision loop.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 mb-4">
{ROUTES.map((r) => {
const isActive = r.key === selectedRoute;
return (
<button
key={r.key}
type="button"
onClick={() => setSelectedRoute(r.key)}
style={{
textAlign: 'left',
padding: '12px 14px',
borderRadius: 10,
background: isActive
? 'color-mix(in srgb, #d4a054 12%, transparent)'
: 'var(--color-bg-primary)',
border: `1px solid ${isActive ? 'color-mix(in srgb, #d4a054 40%, transparent)' : 'var(--color-surface-border)'}`,
cursor: 'pointer',
}}
>
<div className="flex items-center gap-2 mb-1">
<Clock
className="w-3 h-3"
style={{ color: isActive ? '#d4a054' : 'var(--color-fg-muted)' }}
/>
<span
className="text-xs font-bold uppercase tracking-wider"
style={{ color: isActive ? '#d4a054' : 'var(--color-fg-primary)' }}
>
{r.label}
</span>
</div>
<p className="text-[11px]" style={{ color: 'var(--color-fg-muted)' }}>
{r.description}
</p>
<p className="text-[10px] mt-1 font-mono" style={{ color: 'var(--color-fg-muted)' }}>
Audience: {r.audience}
</p>
</button>
);
})}
</div>
<div className="mb-4">
<p
className="text-[10px] font-bold uppercase tracking-widest mb-2"
style={{ color: 'var(--color-fg-muted)' }}
>
Step Navigation — {route.label}
</p>
<div className="flex flex-wrap gap-2">
{route.steps.map((step, i) => (
<button
key={`${route.key}-${step.href}-${i}`}
type="button"
onClick={() => goTo(step.href)}
className="flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider px-3 py-1.5 rounded-lg transition-opacity hover:opacity-80"
style={{
backgroundColor: 'var(--color-bg-primary)',
border: '1px solid var(--color-surface-border)',
color: 'var(--color-fg-muted)',
}}
>
<span style={{ color: '#d4a054' }}>{String(i + 1).padStart(2, '0')}</span>
{step.label}
<ArrowRight className="w-3 h-3" />
</button>
))}
</div>
</div>
<div className="flex flex-wrap items-center gap-3 justify-between">
<div className="flex items-center gap-2 flex-wrap">
<span
className="text-[10px] font-bold uppercase tracking-widest"
style={{ color: 'var(--color-fg-muted)' }}
>
Scenario:
</span>
{DEMO_SCENARIOS.map((s) => {
const isActive = s.key === selectedScenario;
return (
<button
key={s.key}
type="button"
onClick={() => setSelectedScenario(s.key)}
className="flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider px-3 py-1.5 rounded-lg"
style={{
backgroundColor: isActive
? `color-mix(in srgb, ${s.color} 15%, transparent)`
: 'var(--color-bg-primary)',
border: `1px solid ${isActive ? s.color : 'var(--color-surface-border)'}`,
color: isActive ? s.color : 'var(--color-fg-muted)',
cursor: 'pointer',
}}
>
<span aria-hidden>{s.icon}</span>
{s.name}
</button>
);
})}
</div>
<button
type="button"
onClick={handleStart}
data-testid="demo-launchpad-start"
className="flex items-center gap-2 text-xs font-bold uppercase tracking-wider px-4 py-2 rounded-lg transition-opacity hover:opacity-90"
style={{
backgroundColor: '#d4a054',
color: '#1a1410',
border: '1px solid #d4a054',
cursor: 'pointer',
}}
>
<Play className="w-3.5 h-3.5" />
Start Demo
</button>
</div>
</div>
);
}
export default DemoLaunchpadPanel;
|