Restores and rewrites content on Home, Mobile SDK, DNS Protect, Halo CPE, For Operators, Financial Services, Why BlackDice, Investors and Contact to match the approved source copy, removing stray dashes site-wide in favour of plain punctuation. Removes an unreachable duplicate Contact page block that left a stray unclosed <div> in the markup. Shrinks and repads the Guardian Mobile SDK explorer widget so it fits without excess scrolling. Also includes in-progress nav, blog seed and demo scenario tweaks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2053 lines
114 KiB
TypeScript
2053 lines
114 KiB
TypeScript
import React, { useEffect, useRef, useState } from 'react'
|
||
import { useSearchParams } from 'react-router-dom'
|
||
import { AnimatePresence, animate, motion } from 'framer-motion'
|
||
import './demo.css'
|
||
import {
|
||
type FlowId,
|
||
type DemoPlayerState,
|
||
ALL_FLOWS,
|
||
useDemoPlayer,
|
||
} from './context/DemoContext'
|
||
import { ScoreRing } from './components/ScoreRing'
|
||
import {
|
||
IconHome, IconUsers, IconApps, IconSliders, IconCheck,
|
||
IconShieldCheck as IconShieldCheckSvg, IconChevron as IconChevronSvg,
|
||
IconShield, IconAlert, IconLock, IconPin, IconRouter,
|
||
IconConsole, IconTv, IconCamera, IconSpeaker, IconPhone, IconLaptop,
|
||
IconBell, IconDownload, IconGlobe,
|
||
} from './components/Icons'
|
||
import {
|
||
SECURITY_ALERTS,
|
||
WEEKLY_REPORT,
|
||
SECURITY_SCORE,
|
||
EMMA_INCIDENT_TIMELINE,
|
||
} from './data/mock'
|
||
|
||
// ── Design tokens ─────────────────────────────────────────────────────────────
|
||
const T = {
|
||
bg: '#013B49',
|
||
bgGrad: 'radial-gradient(140% 90% at 50% 0%, #075466 0%, #013B49 55%, #01303b 100%)',
|
||
surface: 'rgba(255,255,255,0.04)',
|
||
surface2: 'rgba(255,255,255,0.07)',
|
||
surface3: 'rgba(255,255,255,0.10)',
|
||
surfaceStr:'#0a4856',
|
||
border: 'rgba(255,255,255,0.09)',
|
||
borderStr: 'rgba(255,255,255,0.16)',
|
||
text: '#e8f4f3',
|
||
text2: '#b9cdd1',
|
||
muted: '#8aa5ab',
|
||
dim: '#5a7a82',
|
||
accent: '#3BB586',
|
||
accentSoft:'rgba(59,181,134,0.16)',
|
||
accentGlow:'rgba(59,181,134,0.30)',
|
||
danger: '#ff6b6b',
|
||
dangerSoft:'rgba(255,107,107,0.14)',
|
||
warn: '#ffb56b',
|
||
warnSoft: 'rgba(255,181,107,0.14)',
|
||
success: '#4ec99a',
|
||
successSoft:'rgba(78,201,154,0.14)',
|
||
info: '#6fa9f7',
|
||
av: { S: '#2563EB', E: '#ea580c', M: '#9333EA', J: '#16A34A' } as Record<string, string>,
|
||
chrome: '#013B49',
|
||
chrome2: '#012e3a',
|
||
chromeBdr: 'rgba(59,181,134,0.18)',
|
||
toastBg: '#0a3d4a',
|
||
}
|
||
|
||
// ── Easing ────────────────────────────────────────────────────────────────────
|
||
const EASE_OUT = [0.23, 1, 0.32, 1] as const // strong ease-out for entries
|
||
const EASE_SPRING = { type: 'spring', stiffness: 340, damping: 28 } as const
|
||
|
||
// ── Atoms ─────────────────────────────────────────────────────────────────────
|
||
|
||
const cardStyle: React.CSSProperties = {
|
||
background: T.surface2,
|
||
border: `1px solid ${T.border}`,
|
||
borderRadius: 16,
|
||
padding: '12px 14px',
|
||
}
|
||
|
||
function Av({ k, size = 32 }: { k: string; size?: number }) {
|
||
const col = T.av[k] ?? T.accent
|
||
const init: Record<string, string> = { S:'S', E:'E', M:'M', J:'J' }
|
||
return (
|
||
<div style={{ width: size, height: size, borderRadius: '50%', background: col, color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 600, fontSize: size * 0.38, flexShrink: 0 }}>
|
||
{init[k] ?? k}
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function Pill({ label, variant }: { label: string; variant: 'ok'|'warn'|'off'|'danger'|'info' }) {
|
||
const map = {
|
||
ok: { bg: T.successSoft, color: T.success },
|
||
warn: { bg: T.warnSoft, color: T.warn },
|
||
off: { bg: T.surface3, color: T.muted },
|
||
danger: { bg: T.dangerSoft, color: T.danger },
|
||
info: { bg: T.accentSoft, color: T.accent },
|
||
}
|
||
const s = map[variant]
|
||
return <span style={{ fontSize: 10, padding: '2px 8px', borderRadius: 100, whiteSpace: 'nowrap', fontWeight: 500, background: s.bg, color: s.color }}>{label}</span>
|
||
}
|
||
|
||
function Iconbox({ children, color = T.text2, bg = T.surface3, size = 32 }: {
|
||
children: React.ReactNode; color?: string; bg?: string; size?: number
|
||
}) {
|
||
return (
|
||
<div style={{ width: size, height: size, borderRadius: 9, background: bg, color, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
{children}
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function Chevron() { return <IconChevronSvg size={14} style={{ color: T.muted }} /> }
|
||
|
||
function ShieldCheck({ size = 20, color = T.success }: { size?: number; color?: string }) {
|
||
return <IconShieldCheckSvg size={size} style={{ color }} />
|
||
}
|
||
|
||
function PrimaryBtn({ children, color = T.accent, onClick }: { children: React.ReactNode; color?: string; onClick?: () => void }) {
|
||
return (
|
||
<motion.button whileTap={{ scale: 0.97 }} onClick={onClick}
|
||
style={{ fontFamily: 'inherit', fontSize: 12, fontWeight: 600, borderRadius: 12, padding: '9px 14px', border: 'none', background: color, color: '#fff', cursor: 'pointer', width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6, letterSpacing: '.1px' }}>
|
||
{children}
|
||
</motion.button>
|
||
)
|
||
}
|
||
|
||
function LiveDot({ color = T.success }: { color?: string }) {
|
||
return (
|
||
<span style={{ position: 'relative', display: 'inline-flex', width: 7, height: 7, flexShrink: 0 }}>
|
||
<motion.span animate={{ scale: [1, 2.4, 1], opacity: [0.8, 0, 0.8] }} transition={{ duration: 2.2, repeat: Infinity, ease: 'easeOut' }}
|
||
style={{ position: 'absolute', inset: 0, borderRadius: '50%', background: color }} />
|
||
<span style={{ position: 'relative', width: 7, height: 7, borderRadius: '50%', background: color }} />
|
||
</span>
|
||
)
|
||
}
|
||
|
||
function AnimNum({ to, from = 0, delay = 0 }: { to: number; from?: number; delay?: number }) {
|
||
const ref = useRef<HTMLSpanElement>(null)
|
||
useEffect(() => {
|
||
const timer = setTimeout(() => {
|
||
animate(from, to, {
|
||
duration: 1.4, ease: [0.22, 1, 0.36, 1],
|
||
onUpdate: v => { if (ref.current) ref.current.textContent = Math.round(v).toString() },
|
||
})
|
||
}, delay)
|
||
return () => clearTimeout(timer)
|
||
}, [to, from, delay])
|
||
return <span ref={ref}>{from}</span>
|
||
}
|
||
|
||
function RowDivider({ first }: { first: boolean }) {
|
||
return first ? null : <div style={{ height: 1, background: T.border, margin: '0 0' }} />
|
||
}
|
||
|
||
function StatusChip({ label, ok }: { label: string; ok: boolean }) {
|
||
return (
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 5, padding: '6px 10px', background: ok ? T.successSoft : T.dangerSoft, borderRadius: 8 }}>
|
||
<div style={{ width: 6, height: 6, borderRadius: '50%', background: ok ? T.success : T.danger }} />
|
||
<span style={{ fontSize: 10, fontWeight: 500, color: ok ? T.success : T.danger }}>{label}</span>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
// ── Global pulse keyframes ────────────────────────────────────────────────────
|
||
const PULSE_CSS = `
|
||
@keyframes bdPulse {
|
||
0%,100% { box-shadow: 0 0 0 0 rgba(255,107,107,.45) }
|
||
50% { box-shadow: 0 0 0 10px rgba(255,107,107,0) }
|
||
}
|
||
@keyframes bdGlow {
|
||
0%,100% { opacity: .7 }
|
||
50% { opacity: 1 }
|
||
}
|
||
`
|
||
|
||
// ── Flow A ────────────────────────────────────────────────────────────────────
|
||
|
||
export function SceneHome() {
|
||
const [count, setCount] = useState(47)
|
||
useEffect(() => { const t = setTimeout(() => setCount(48), 2800); return () => clearTimeout(t) }, [])
|
||
|
||
return (
|
||
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
||
{/* Greeting + live badge */}
|
||
<motion.div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: .3 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Good morning, Sarah</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 5 }}>
|
||
<LiveDot color={T.success} />
|
||
<span style={{ fontSize: 9, fontWeight: 600, color: T.success, letterSpacing: '.5px' }}>LIVE</span>
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* KPI strip */}
|
||
<div style={{ display: 'flex', gap: 6 }}>
|
||
{[
|
||
{ label: 'Blocked today', value: count, color: T.success },
|
||
{ label: 'Devices safe', value: 12, color: T.accent },
|
||
{ label: 'Family score', value: 92, color: T.success },
|
||
].map((k, i) => (
|
||
<motion.div key={k.label}
|
||
initial={{ opacity: 0, y: 5 }} animate={{ opacity: 1, y: 0 }}
|
||
transition={{ delay: i * .05, duration: .25, ease: EASE_OUT }}
|
||
style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '8px 4px' }}>
|
||
<div style={{ fontSize: 15, fontWeight: 700, color: k.color }}>
|
||
{k.label === 'Blocked today' ? count : k.value}
|
||
</div>
|
||
<div style={{ fontSize: 9, color: T.muted, marginTop: 2 }}>{k.label}</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
{/* Protection banner */}
|
||
<motion.div style={{ ...cardStyle, background: T.successSoft, borderColor: 'transparent', display: 'flex', alignItems: 'center', gap: 12 }}
|
||
initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .1, ease: EASE_OUT }}>
|
||
<div style={{ width: 38, height: 38, borderRadius: '50%', background: T.success, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
<ShieldCheck size={18} color="#fff" />
|
||
</div>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 500, color: T.success }}>Your family is protected</div>
|
||
<div style={{ fontSize: 10, color: T.success }}>3 children · 12 devices · VPN active</div>
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Approval nudge */}
|
||
<motion.div style={{ ...cardStyle, background: T.warnSoft, borderColor: 'transparent', display: 'flex', alignItems: 'center', gap: 10, cursor: 'pointer' }}
|
||
initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .15, ease: EASE_OUT }}>
|
||
<Iconbox bg={T.warn} color="#fff" size={32}><IconCheck size={15} style={{ color: '#fff' }} /></Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 12, fontWeight: 500, color: T.warn }}>2 requests need your attention</div>
|
||
<div style={{ fontSize: 10, color: T.warn }}>App install · Website access</div>
|
||
</div>
|
||
<Chevron />
|
||
</motion.div>
|
||
|
||
{/* Quick actions */}
|
||
<motion.div style={{ display: 'flex', gap: 8 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .18 }}>
|
||
{([{ Icon: IconLock, label: 'Pause internet' }, { Icon: IconPin, label: 'Where are kids' }] as const).map(q => (
|
||
<div key={q.label} style={{ ...cardStyle, flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6, padding: '10px 6px', cursor: 'pointer' }}>
|
||
<q.Icon size={18} style={{ color: T.text2 }} />
|
||
<div style={{ fontSize: 11, color: T.text }}>{q.label}</div>
|
||
</div>
|
||
))}
|
||
</motion.div>
|
||
|
||
{/* Family */}
|
||
<motion.div style={cardStyle} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .22 }}>
|
||
<div style={{ fontSize: 10, fontWeight: 600, color: T.muted, letterSpacing: '.4px', textTransform: 'uppercase', marginBottom: 6 }}>Family</div>
|
||
{[
|
||
{ k:'E', name:'Emma', sub:'At school · 2h 47m left', pill:'ok' as const },
|
||
{ k:'M', name:'Mia', sub:'At home · 45m today', pill:'ok' as const },
|
||
{ k:'J', name:'Jack', sub:'Home · screen limit hit', pill:'warn' as const },
|
||
].map((c, i) => (
|
||
<motion.div key={c.k}
|
||
initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }}
|
||
transition={{ delay: .24 + i * .05, ease: EASE_OUT }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<div style={{ position: 'relative' }}>
|
||
<Av k={c.k} size={30} />
|
||
<div style={{ position: 'absolute', bottom: -1, right: -1, width: 8, height: 8, borderRadius: '50%', background: c.pill === 'ok' ? T.success : T.warn, border: `1.5px solid ${T.bg}` }} />
|
||
</div>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 12, color: T.text }}>{c.name}</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>{c.sub}</div>
|
||
</div>
|
||
<Pill label={c.pill === 'ok' ? 'Online' : 'Limit'} variant={c.pill} />
|
||
</motion.div>
|
||
))}
|
||
</motion.div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function SceneAlertToast() {
|
||
const [show, setShow] = useState(false)
|
||
useEffect(() => { const t = setTimeout(() => setShow(true), 600); return () => clearTimeout(t) }, [])
|
||
return (
|
||
<div style={{ position: 'relative' }}>
|
||
<style>{PULSE_CSS}</style>
|
||
<div style={{ opacity: .45, pointerEvents: 'none' }}><SceneHome /></div>
|
||
<AnimatePresence>
|
||
{show && (
|
||
<motion.div
|
||
initial={{ y: -24, opacity: 0, scale: .96 }}
|
||
animate={{ y: 0, opacity: 1, scale: 1 }}
|
||
exit={{ y: -16, opacity: 0 }}
|
||
transition={EASE_SPRING}
|
||
style={{
|
||
position: 'absolute', top: 0, left: 0, right: 0,
|
||
background: T.toastBg,
|
||
border: `1.5px solid ${T.danger}`,
|
||
borderRadius: 16, padding: '12px 14px',
|
||
boxShadow: `0 6px 32px rgba(0,0,0,.55), 0 0 0 1px ${T.danger}44`,
|
||
animation: 'bdPulse 1.8s ease-in-out infinite',
|
||
}}>
|
||
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 10 }}>
|
||
<motion.div
|
||
animate={{ scale: [1, 1.08, 1] }} transition={{ duration: 1.4, repeat: Infinity }}
|
||
style={{ width: 36, height: 36, borderRadius: 10, background: T.danger, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
<IconAlert size={18} style={{ color: '#fff' }} />
|
||
</motion.div>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 2 }}>
|
||
<span style={{ fontSize: 9, fontWeight: 700, color: T.danger, letterSpacing: '.6px', textTransform: 'uppercase' }}>Critical</span>
|
||
<div style={{ width: 3, height: 3, borderRadius: '50%', background: T.dim }} />
|
||
<span style={{ fontSize: 9, color: T.muted }}>Just now</span>
|
||
</div>
|
||
<div style={{ fontSize: 12, fontWeight: 600, color: T.text }}>Malware detected · PlayStation 5</div>
|
||
<div style={{ fontSize: 10, color: T.muted, marginTop: 2 }}>Trojan.GenericKD.71234 · Outbound C&C traffic</div>
|
||
</div>
|
||
<div style={{ fontSize: 10, color: T.danger, fontWeight: 600, whiteSpace: 'nowrap' }}>Tap →</div>
|
||
</div>
|
||
</motion.div>
|
||
)}
|
||
</AnimatePresence>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function SceneAlertDetail() {
|
||
const a = SECURITY_ALERTS[0]
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Threat header */}
|
||
<motion.div style={{ ...cardStyle, background: T.dangerSoft, borderColor: T.danger + '88' }}
|
||
initial={{ opacity: 0, scale: .97 }} animate={{ opacity: 1, scale: 1 }} transition={EASE_SPRING}>
|
||
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginBottom: 10 }}>
|
||
<div style={{ width: 40, height: 40, borderRadius: 11, background: T.danger, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
<IconAlert size={20} style={{ color: '#fff' }} />
|
||
</div>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 2 }}>
|
||
<Pill label="Critical" variant="danger" />
|
||
<span style={{ fontSize: 9, color: T.muted }}>{a.timeAgo}</span>
|
||
</div>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Malware detected</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>PlayStation 5 · Jack · Age 8</div>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Threat name */}
|
||
<div style={{ background: 'rgba(0,0,0,.2)', borderRadius: 8, padding: '7px 10px', marginBottom: 8, fontFamily: "'Ubuntu Mono', monospace" }}>
|
||
<div style={{ fontSize: 9, color: T.muted, marginBottom: 2 }}>THREAT IDENTIFIER</div>
|
||
<div style={{ fontSize: 12, fontWeight: 700, color: T.danger }}>Trojan.GenericKD.71234</div>
|
||
</div>
|
||
|
||
{/* Kill chain */}
|
||
<div style={{ display: 'flex', gap: 4, alignItems: 'center', marginBottom: 2 }}>
|
||
{['Delivery', 'Install', 'C&C ←', 'Exfil...'].map((s, i) => (
|
||
<React.Fragment key={s}>
|
||
<motion.div initial={{ opacity: 0, scale: .85 }} animate={{ opacity: 1, scale: 1 }} transition={{ delay: .2 + i * .1 }}
|
||
style={{ fontSize: 9, padding: '2px 6px', borderRadius: 5, background: i < 3 ? T.danger + '33' : T.surface3, color: i < 3 ? T.danger : T.dim, fontWeight: 500, border: `1px solid ${i < 3 ? T.danger + '44' : T.border}` }}>
|
||
{s}
|
||
</motion.div>
|
||
{i < 3 && <span style={{ fontSize: 9, color: T.dim }}>›</span>}
|
||
</React.Fragment>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Intelligence rows */}
|
||
<motion.div style={{ ...cardStyle, padding: '4px 14px' }}
|
||
initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .15, ease: EASE_OUT }}>
|
||
{[
|
||
{ label: 'C&C Server', value: '185.220.101.47', sub: 'Amsterdam 🇳🇱 · Tor exit node', color: T.danger },
|
||
{ label: 'Upload rate', value: '3.2 MB/s', sub: 'Sustained 4 min · Rising', color: T.warn },
|
||
{ label: 'Device', value: a.deviceName ?? 'PlayStation 5', sub: 'FW 23.02 · Jack', color: T.text2 },
|
||
{ label: 'Detected', value: a.timeAgo, sub: 'Pattern match + heuristic', color: T.muted },
|
||
].map((r, i) => (
|
||
<motion.div key={r.label} initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .2 + i * .05 }}
|
||
style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '8px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>{r.label}</div>
|
||
{r.sub && <div style={{ fontSize: 9, color: T.dim, marginTop: 1 }}>{r.sub}</div>}
|
||
</div>
|
||
<span style={{ fontSize: 11, fontWeight: 600, color: r.color, fontFamily: r.label === 'C&C Server' ? "'Ubuntu Mono', monospace" : 'inherit' }}>{r.value}</span>
|
||
</motion.div>
|
||
))}
|
||
</motion.div>
|
||
|
||
<motion.div initial={{ opacity: 0, y: 5 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .35, ease: EASE_OUT }}>
|
||
<PrimaryBtn color={T.danger}>Isolate PlayStation 5 →</PrimaryBtn>
|
||
</motion.div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneDevicePS5() {
|
||
const [mb, setMb] = useState(3.2)
|
||
useEffect(() => {
|
||
const t = setInterval(() => setMb(v => Math.round((v + 0.1) * 10) / 10), 1800)
|
||
return () => clearInterval(t)
|
||
}, [])
|
||
const bars = [18, 22, 19, 25, 20, 71, 88, 92, mb > 3.5 ? 94 : 90]
|
||
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0, x: 12 }} animate={{ opacity: 1, x: 0 }} transition={{ ease: EASE_OUT }}>
|
||
{/* Device card */}
|
||
<div style={{ ...cardStyle, background: T.dangerSoft, borderColor: T.danger + '77' }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
|
||
<Iconbox bg="rgba(255,107,107,.22)" color={T.danger} size={40}>
|
||
<IconConsole size={20} style={{ color: T.danger }} />
|
||
</Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>PlayStation 5</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Sony · FW 23.02 · 192.168.1.9</div>
|
||
</div>
|
||
<Pill label="Threat" variant="danger" />
|
||
</div>
|
||
|
||
{/* Live traffic */}
|
||
<div style={{ background: 'rgba(0,0,0,.18)', borderRadius: 10, padding: '8px 10px', marginBottom: 8 }}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 6 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 5 }}>
|
||
<LiveDot color={T.danger} />
|
||
<span style={{ fontSize: 9, fontWeight: 600, color: T.danger, letterSpacing: '.4px' }}>LIVE OUTBOUND</span>
|
||
</div>
|
||
<motion.span key={mb} initial={{ opacity: .4, scale: .95 }} animate={{ opacity: 1, scale: 1 }}
|
||
style={{ fontSize: 13, fontWeight: 700, color: T.danger, fontFamily: "'Ubuntu Mono', monospace" }}>
|
||
{mb.toFixed(1)} MB/s
|
||
</motion.span>
|
||
</div>
|
||
<div style={{ height: 44, display: 'flex', alignItems: 'flex-end', gap: 2 }}>
|
||
{bars.map((h, i) => (
|
||
<motion.div key={i}
|
||
initial={{ height: 0, opacity: 0 }} animate={{ height: `${Math.min(h, 100)}%`, opacity: 1 }}
|
||
transition={{ delay: i * .05, duration: .4, ease: EASE_OUT }}
|
||
style={{ flex: 1, borderRadius: '2px 2px 0 0', background: h > 50 ? T.danger : T.accentSoft }} />
|
||
))}
|
||
</div>
|
||
</div>
|
||
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||
<IconAlert size={12} style={{ color: T.danger }} />
|
||
<span style={{ fontSize: 10, color: T.danger }}>→ 185.220.101.47 · Amsterdam · Tor exit</span>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Info table */}
|
||
<div style={{ ...cardStyle, padding: '4px 14px' }}>
|
||
{[
|
||
{ l: 'Status', v: 'Active C&C link', c: T.danger },
|
||
{ l: 'Owner', v: 'Jack · Age 8', c: T.text2 },
|
||
{ l: 'Network', v: 'Hughes-Home-5G', c: T.text2 },
|
||
{ l: 'Last clean',v: '14 days ago', c: T.muted },
|
||
].map((r, i) => (
|
||
<div key={r.l} style={{ display: 'flex', justifyContent: 'space-between', padding: '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}`, fontSize: 11 }}>
|
||
<span style={{ color: T.muted }}>{r.l}</span>
|
||
<span style={{ color: r.c, fontWeight: 500 }}>{r.v}</span>
|
||
</div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneIsolateModal() {
|
||
const [tapped, setTapped] = useState(false)
|
||
return (
|
||
// Negative margin exactly cancels the screen padding (6px top / 13px sides / 8px bottom)
|
||
// so the panel fills the phone screen edge-to-edge with no scroll/overflow.
|
||
<div style={{ margin: '-6px -13px -8px', height: 'calc(100% + 14px)', position: 'relative' }}>
|
||
{/* Dimmed background scene */}
|
||
<div style={{ opacity: .2, pointerEvents: 'none', filter: 'blur(2px)', padding: '6px 13px' }}>
|
||
<SceneDevicePS5 />
|
||
</div>
|
||
|
||
{/* Full overlay — fills the phone screen, sheet anchored to bottom */}
|
||
<motion.div
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: .2 }}
|
||
style={{ position: 'absolute', inset: 0, background: 'rgba(1,18,26,.88)', backdropFilter: 'blur(12px)', display: 'flex', alignItems: 'flex-end' }}>
|
||
|
||
{/* Bottom sheet slides up */}
|
||
<motion.div
|
||
initial={{ y: '100%' }} animate={{ y: 0 }}
|
||
transition={{ ...EASE_SPRING, delay: .05 }}
|
||
style={{ width: '100%', background: T.surfaceStr, borderTop: `1px solid ${T.danger}44`, borderRadius: '20px 20px 0 0', overflow: 'hidden', boxShadow: `0 -16px 48px rgba(0,0,0,.5), 0 0 0 1px ${T.danger}18` }}>
|
||
|
||
{/* Drag handle */}
|
||
<div style={{ display: 'flex', justifyContent: 'center', padding: '10px 0 0' }}>
|
||
<div style={{ width: 36, height: 4, borderRadius: 2, background: 'rgba(255,255,255,.15)' }} />
|
||
</div>
|
||
|
||
{/* Header */}
|
||
<div style={{ padding: '16px 20px 14px', textAlign: 'start', borderBottom: `1px solid ${T.border}`,overflow:'hidden' }}>
|
||
<motion.div
|
||
initial={{ scale: 0.6, opacity: 0 }} animate={{ scale: 1, opacity: 1 }}
|
||
transition={{ ...EASE_SPRING, delay: .18 }}
|
||
style={{ width: 52, height: 52, borderRadius: '50%', background: T.danger, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 12px', boxShadow: `0 0 0 8px ${T.danger}22` }}>
|
||
<IconLock size={22} style={{ color: '#fff' }} />
|
||
</motion.div>
|
||
<div style={{ fontSize: 15, fontWeight: 700, color: T.text, marginBottom: 4 }}>Isolate PlayStation 5?</div>
|
||
<div style={{ fontSize: 11, color: T.text2, lineHeight: 1.6 }}>
|
||
All internet access cut immediately.<br />Restore any time from your dashboard.
|
||
</div>
|
||
</div>
|
||
|
||
{/* Checklist */}
|
||
<div style={{ padding: '4px 20px 0' }}>
|
||
{[
|
||
'C&C connection severed instantly',
|
||
'Outbound uploads stopped',
|
||
'All 11 other devices unaffected',
|
||
'Full incident report auto-saved',
|
||
].map((text, i) => (
|
||
<motion.div key={text}
|
||
initial={{ opacity: 0, x: -6 }} animate={{ opacity: 1, x: 0 }}
|
||
transition={{ delay: .28 + i * .07, ease: EASE_OUT }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '8px 0', borderBottom: i < 3 ? `1px solid ${T.border}` : 'none', fontSize: 11, color: T.text2 }}>
|
||
<div style={{ width: 18, height: 18, borderRadius: '50%', background: T.successSoft, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
<IconCheck size={10} style={{ color: T.success }} />
|
||
</div>
|
||
{text}
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
{/* Actions */}
|
||
<div style={{ padding: '14px 16px 20px', display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||
<PrimaryBtn color={T.danger} onClick={() => setTapped(true)}>
|
||
{tapped ? 'Isolating…' : 'Isolate Now'}
|
||
</PrimaryBtn>
|
||
<motion.div whileTap={{ scale: .97 }}
|
||
style={{ textAlign: 'center', fontSize: 11, color: T.muted, cursor: 'pointer', padding: '3px 0' }}>
|
||
Cancel – stay connected
|
||
</motion.div>
|
||
</div>
|
||
</motion.div>
|
||
</motion.div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function SceneIsolateProgress() {
|
||
const [done, setDone] = useState(-1)
|
||
useEffect(() => {
|
||
const timers = [600, 1800, 3200, 4800].map((d, i) => setTimeout(() => setDone(i), d))
|
||
return () => timers.forEach(clearTimeout)
|
||
}, [])
|
||
const steps = [
|
||
{ label: 'Blocking network access', sub: 'Firewall rule applied' },
|
||
{ label: 'Severing C&C connection', sub: '185.220.101.47 blacklisted' },
|
||
{ label: 'Logging incident report', sub: 'CVE reference + pcap saved' },
|
||
{ label: 'Notifying Sarah', sub: 'Push + email sent' },
|
||
]
|
||
const pct = done < 0 ? 0 : done >= 3 ? 100 : Math.round(((done + 1) / 4) * 100)
|
||
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 14, paddingTop: 6 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Progress ring */}
|
||
<div style={{ position: 'relative', width: 74, height: 74 }}>
|
||
<svg width="74" height="74" viewBox="0 0 74 74" style={{ transform: 'rotate(-90deg)' }}>
|
||
<circle cx="37" cy="37" r="30" fill="none" stroke={T.surface3} strokeWidth="6"/>
|
||
<motion.circle cx="37" cy="37" r="30" fill="none" stroke={done >= 3 ? T.success : T.danger} strokeWidth="6"
|
||
strokeLinecap="round" strokeDasharray={188.5}
|
||
animate={{ strokeDashoffset: 188.5 - (188.5 * pct / 100) }}
|
||
transition={{ duration: .6, ease: EASE_OUT }} />
|
||
</svg>
|
||
<div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||
{done >= 3
|
||
? <IconCheck size={22} style={{ color: T.success }} />
|
||
: <span style={{ fontSize: 13, fontWeight: 700, color: T.danger }}>{pct}%</span>}
|
||
</div>
|
||
</div>
|
||
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: done >= 3 ? T.success : T.text }}>
|
||
{done >= 3 ? 'Device isolated' : 'Isolating PlayStation 5…'}
|
||
</div>
|
||
|
||
<div style={{ ...cardStyle, width: '100%' }}>
|
||
{steps.map((s, i) => {
|
||
const state = i < done ? 'done' : i === done ? 'active' : 'pending'
|
||
return (
|
||
<motion.div key={s.label}
|
||
initial={{ opacity: 0, x: -6 }} animate={{ opacity: state === 'pending' ? .4 : 1, x: 0 }}
|
||
transition={{ delay: i * .08 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '8px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<motion.div animate={{ scale: state === 'active' ? [1, 1.15, 1] : 1 }} transition={{ duration: .8, repeat: state === 'active' ? Infinity : 0 }}
|
||
style={{ width: 20, height: 20, borderRadius: '50%', flexShrink: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', background: state === 'done' ? T.successSoft : state === 'active' ? T.dangerSoft : T.surface3 }}>
|
||
{state === 'done' ? <IconCheck size={11} style={{ color: T.success }} /> : <div style={{ width: 6, height: 6, borderRadius: '50%', background: state === 'active' ? T.danger : T.dim }} />}
|
||
</motion.div>
|
||
<div>
|
||
<div style={{ fontSize: 11, fontWeight: state === 'active' ? 600 : 400, color: state === 'pending' ? T.muted : T.text }}>{s.label}</div>
|
||
{state !== 'pending' && <div style={{ fontSize: 9, color: T.dim, marginTop: 1 }}>{s.sub}</div>}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
})}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneResolved() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Success banner */}
|
||
<motion.div initial={{ scale: .94 }} animate={{ scale: 1 }} transition={EASE_SPRING}
|
||
style={{ ...cardStyle, background: T.successSoft, borderColor: 'transparent', textAlign: 'center', padding: '18px 14px' }}>
|
||
<motion.div initial={{ scale: 0, rotate: -20 }} animate={{ scale: 1, rotate: 0 }} transition={{ ...EASE_SPRING, delay: .1 }}
|
||
style={{ width: 52, height: 52, borderRadius: '50%', background: T.success, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px' }}>
|
||
<ShieldCheck size={26} color="#fff" />
|
||
</motion.div>
|
||
<div style={{ fontSize: 14, fontWeight: 600, color: T.success }}>Threat neutralised</div>
|
||
<div style={{ fontSize: 10, color: T.success, marginTop: 3 }}>PlayStation 5 isolated · family safe</div>
|
||
</motion.div>
|
||
|
||
{/* Score before → after */}
|
||
<motion.div style={{ ...cardStyle, display: 'flex', alignItems: 'center', gap: 14 }}
|
||
initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .18, ease: EASE_OUT }}>
|
||
<ScoreRing score={94} size={58} strokeWidth={5} delay={300} />
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 16, fontWeight: 700, color: T.success }}>
|
||
<AnimNum to={94} from={88} delay={350} /><span style={{ fontSize: 11, color: T.muted, fontWeight: 400 }}>/100</span>
|
||
</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Family Security Score</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 4 }}>
|
||
<div style={{ fontSize: 10, color: T.dim, textDecoration: 'line-through' }}>88</div>
|
||
<div style={{ fontSize: 9, color: T.dim }}>→</div>
|
||
<div style={{ fontSize: 10, color: T.success, fontWeight: 600 }}>94 · ▲ +6</div>
|
||
</div>
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Action log */}
|
||
<motion.div style={{ ...cardStyle, padding: '4px 14px' }}
|
||
initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .24, ease: EASE_OUT }}>
|
||
{[
|
||
{ label: 'Malware blocked', done: true },
|
||
{ label: 'PS5 network isolated', done: true },
|
||
{ label: 'C&C connection severed', done: true },
|
||
{ label: 'All 11 other devices safe', done: true },
|
||
].map((r, i) => (
|
||
<motion.div key={r.label} initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .28 + i * .06 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}`, fontSize: 11, color: T.text2 }}>
|
||
<IconCheck size={12} style={{ color: T.success, flexShrink: 0 }} />
|
||
{r.label}
|
||
</motion.div>
|
||
))}
|
||
</motion.div>
|
||
|
||
<motion.div style={{ fontSize: 11, color: T.accent, textAlign: 'center', cursor: 'pointer' }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .5 }}>
|
||
View full incident report →
|
||
</motion.div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
// ── Flow B ────────────────────────────────────────────────────────────────────
|
||
|
||
function SceneNotifPanel() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}
|
||
initial={{ opacity: 0, y: -6 }} animate={{ opacity: 1, y: 0 }} transition={{ ease: EASE_OUT }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 2 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Notifications</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||
<div style={{ background: T.dangerSoft, color: T.danger, fontSize: 9, fontWeight: 700, padding: '2px 7px', borderRadius: 10 }}>2 critical</div>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Critical group */}
|
||
<div style={{ fontSize: 9, fontWeight: 700, color: T.danger, letterSpacing: '.5px', textTransform: 'uppercase', padding: '0 2px' }}>Critical</div>
|
||
{([
|
||
{ Icon: IconAlert, title: "Suspicious login – Emma's account", body: 'Instagram · Moscow 🇷🇺 · 02:31 AM', t: '8m ago', variant: 'danger' as const },
|
||
{ Icon: IconShield, title: 'Malware blocked · PS5', body: 'Trojan.GenericKD.71234 · Stopped', t: '6m ago', variant: 'danger' as const },
|
||
] as const).map((n, i) => {
|
||
const c = T.danger
|
||
return (
|
||
<motion.div key={n.title} initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: i * .07, ease: EASE_OUT }}
|
||
style={{ ...cardStyle, display: 'flex', gap: 10, cursor: 'pointer', borderColor: c + '55', background: c + '0d', padding: '10px 12px' }}>
|
||
<Iconbox color={c} bg={c + '22'} size={32}><n.Icon size={15} style={{ color: c }} /></Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 12, fontWeight: 600, color: T.text }}>{n.title}</div>
|
||
<div style={{ fontSize: 10, color: T.muted, marginTop: 2 }}>{n.body}</div>
|
||
</div>
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 4 }}>
|
||
<div style={{ width: 7, height: 7, borderRadius: '50%', background: c }} />
|
||
<span style={{ fontSize: 9, color: T.dim }}>{n.t}</span>
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
})}
|
||
|
||
{/* Info group */}
|
||
<div style={{ fontSize: 9, fontWeight: 700, color: T.muted, letterSpacing: '.5px', textTransform: 'uppercase', padding: '0 2px', marginTop: 4 }}>Earlier</div>
|
||
{([
|
||
{ Icon: IconPin, title: 'Emma arrived at School', body: '8:42 AM · geofence enter', t: '2h ago', variant: 'ok' as const },
|
||
{ Icon: IconLock, title: 'Unsafe WiFi – VPN on', body: "Starbucks_Free · Sarah's iPhone", t: '4h ago', variant: 'warn' as const },
|
||
] as const).map((n, i) => {
|
||
const vc = { ok: T.success, warn: T.warn }
|
||
const c = vc[n.variant]
|
||
return (
|
||
<motion.div key={n.title} initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .2 + i * .07, ease: EASE_OUT }}
|
||
style={{ ...cardStyle, display: 'flex', gap: 10, cursor: 'pointer', padding: '9px 12px' }}>
|
||
<Iconbox color={c} bg={c + '18'} size={30}><n.Icon size={14} style={{ color: c }} /></Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 11, color: T.text }}>{n.title}</div>
|
||
<div style={{ fontSize: 10, color: T.muted, marginTop: 1 }}>{n.body}</div>
|
||
</div>
|
||
<span style={{ fontSize: 9, color: T.dim }}>{n.t}</span>
|
||
</motion.div>
|
||
)
|
||
})}
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneEmmaProfile() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0, x: 10 }} animate={{ opacity: 1, x: 0 }} transition={{ ease: EASE_OUT }}>
|
||
{/* Alert banner */}
|
||
<motion.div style={{ ...cardStyle, background: T.dangerSoft, borderColor: T.danger + '55', display: 'flex', alignItems: 'center', gap: 10, cursor: 'pointer' }}
|
||
initial={{ opacity: 0, y: -8 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .14, ...EASE_SPRING }}>
|
||
<Iconbox bg={T.danger} color="#fff" size={32}><IconAlert size={15} style={{ color: '#fff' }} /></Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 12, fontWeight: 600, color: T.danger }}>Account alert · Investigate →</div>
|
||
<div style={{ fontSize: 10, color: T.text2 }}>Suspicious login on Instagram · 02:31</div>
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Profile */}
|
||
<motion.div style={{ ...cardStyle, display: 'flex', alignItems: 'center', gap: 12 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .2 }}>
|
||
<div style={{ position: 'relative' }}>
|
||
<Av k="E" size={42} />
|
||
<div style={{ position: 'absolute', bottom: -1, right: -1, width: 10, height: 10, borderRadius: '50%', background: T.success, border: `1.5px solid ${T.bg}` }} />
|
||
</div>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Emma Hughes</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Age 14 · Teen filter · iPhone 14</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 5, marginTop: 4 }}>
|
||
<IconPin size={10} style={{ color: T.accent }} />
|
||
<span style={{ fontSize: 10, color: T.accent }}>School · since 8:42 AM</span>
|
||
</div>
|
||
</div>
|
||
<Pill label="Online" variant="ok" />
|
||
</motion.div>
|
||
|
||
{/* Screen time */}
|
||
<motion.div style={cardStyle} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .26 }}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 6 }}>
|
||
<span style={{ fontSize: 11, color: T.muted }}>Screen time today</span>
|
||
<span style={{ fontSize: 11, fontWeight: 500, color: T.warn }}>2h 47m / 4h</span>
|
||
</div>
|
||
<div style={{ height: 5, background: T.surface3, borderRadius: 3, overflow: 'hidden', marginBottom: 6 }}>
|
||
<motion.div initial={{ width: 0 }} animate={{ width: '69%' }} transition={{ duration: 1, delay: .4, ease: EASE_OUT }}
|
||
style={{ height: '100%', background: T.warn, borderRadius: 3 }} />
|
||
</div>
|
||
<div style={{ display: 'flex', gap: 8 }}>
|
||
{[{ app: 'TikTok', t: '1h 12m', c: T.danger }, { app: 'YouTube', t: '48m', c: T.warn }, { app: 'Snapchat', t: '31m', c: T.accent }].map(a => (
|
||
<div key={a.app} style={{ fontSize: 9, color: a.c }}>{a.app} {a.t}</div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Devices */}
|
||
<motion.div style={{ ...cardStyle, padding: '4px 14px' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .3 }}>
|
||
{[
|
||
{ icon: <IconPhone size={14} style={{ color: T.accent }} />, label: "iPhone 14", sub: 'Online · iOS 17.4', ok: true },
|
||
{ icon: <IconLaptop size={14} style={{ color: T.muted }} />, label: "MacBook Air", sub: 'At home · Off', ok: false },
|
||
].map((d, i) => (
|
||
<div key={d.label} style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<Iconbox bg={T.surface3} size={28}>{d.icon}</Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 11, color: T.text }}>{d.label}</div>
|
||
<div style={{ fontSize: 9, color: T.muted }}>{d.sub}</div>
|
||
</div>
|
||
<Pill label={d.ok ? 'Online' : 'Off'} variant={d.ok ? 'ok' : 'off'} />
|
||
</div>
|
||
))}
|
||
</motion.div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneTimeline() {
|
||
const kindColor: Record<string, string> = { normal: T.success, info: T.muted, anomaly: T.danger, blocked: T.warn }
|
||
return (
|
||
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 }}>
|
||
<div style={{ fontSize: 10, fontWeight: 700, color: T.muted, letterSpacing: '.5px', textTransform: 'uppercase' }}>Event Timeline · Emma</div>
|
||
<div style={{ fontSize: 9, color: T.dim }}>Jun 28–29</div>
|
||
</div>
|
||
<div style={{ position: 'relative', paddingLeft: 22 }}>
|
||
<div style={{ position: 'absolute', left: 5, top: 8, bottom: 8, width: 1, background: `linear-gradient(to bottom, ${T.border}, ${T.dim}, ${T.border})` }} />
|
||
{EMMA_INCIDENT_TIMELINE.map((e, i) => {
|
||
const isAnomaly = e.kind === 'anomaly'
|
||
return (
|
||
<motion.div key={e.id}
|
||
initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }}
|
||
transition={{ delay: i * .09, ease: EASE_OUT }}
|
||
style={{ position: 'relative', marginBottom: 14 }}>
|
||
<motion.div
|
||
animate={isAnomaly ? { scale: [1, 1.3, 1], opacity: [1, .7, 1] } : {}}
|
||
transition={{ duration: 1.5, repeat: isAnomaly ? Infinity : 0 }}
|
||
style={{ position: 'absolute', left: -22, top: 4, width: 11, height: 11, borderRadius: '50%', background: kindColor[e.kind] ?? T.muted, border: `2px solid ${T.bg}`, boxShadow: isAnomaly ? `0 0 0 3px ${T.danger}33` : 'none' }} />
|
||
<div style={{ fontSize: 9, color: T.dim, fontWeight: 700, marginBottom: 2, letterSpacing: '.3px' }}>{e.time}</div>
|
||
<div style={{ ...isAnomaly ? { ...cardStyle, background: T.dangerSoft, borderColor: T.danger + '44', padding: '6px 10px', borderRadius: 10 } : {} }}>
|
||
<div style={{ fontSize: 11, fontWeight: isAnomaly ? 700 : 400, color: isAnomaly ? T.danger : e.kind === 'blocked' ? T.warn : T.text }}>{e.label}</div>
|
||
<div style={{ fontSize: 10, color: T.muted, lineHeight: 1.5, marginTop: isAnomaly ? 2 : 1 }}>{e.detail}</div>
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
})}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneIPDetail() {
|
||
const riskPct = 94
|
||
const circ = 2 * Math.PI * 28
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* IP card */}
|
||
<motion.div style={{ ...cardStyle, background: T.dangerSoft, borderColor: T.danger + '66' }}
|
||
initial={{ opacity: 0, scale: .97 }} animate={{ opacity: 1, scale: 1 }} transition={EASE_SPRING}>
|
||
<div style={{ display: 'flex', gap: 10, alignItems: 'flex-start' }}>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 10, color: T.muted, marginBottom: 4 }}>IP Intelligence</div>
|
||
<div style={{ fontSize: 15, fontWeight: 700, color: T.danger, fontFamily: "'Ubuntu Mono', monospace" }}>77.88.55.244</div>
|
||
<div style={{ fontSize: 10, color: T.text2, marginTop: 3 }}>Yandex LLC · Moscow 🇷🇺 · AS208312</div>
|
||
</div>
|
||
{/* Risk gauge */}
|
||
<div style={{ position: 'relative', width: 64, height: 64 }}>
|
||
<svg width="64" height="64" viewBox="0 0 64 64" style={{ transform: 'rotate(-90deg)' }}>
|
||
<circle cx="32" cy="32" r="28" fill="none" stroke={T.surface3} strokeWidth="5" strokeLinecap="round"/>
|
||
<motion.circle cx="32" cy="32" r="28" fill="none" stroke={T.danger} strokeWidth="5"
|
||
strokeLinecap="round" strokeDasharray={circ}
|
||
initial={{ strokeDashoffset: circ }} animate={{ strokeDashoffset: circ - (circ * riskPct / 100) }}
|
||
transition={{ duration: 1.2, delay: .3, ease: EASE_OUT }} />
|
||
</svg>
|
||
<div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
||
<div style={{ fontSize: 13, fontWeight: 800, color: T.danger }}>9.4</div>
|
||
<div style={{ fontSize: 8, color: T.dim }}>risk</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{/* Tags */}
|
||
<div style={{ display: 'flex', gap: 5, flexWrap: 'wrap', marginTop: 10 }}>
|
||
{['Credential stuffing', 'Botnet C&C', 'Tor exit', 'Brute force'].map(tag => (
|
||
<span key={tag} style={{ fontSize: 9, padding: '2px 7px', borderRadius: 6, background: T.dangerSoft, color: T.danger, fontWeight: 500 }}>{tag}</span>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Stats grid */}
|
||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 7 }}>
|
||
{[
|
||
{ label: 'Abuse reports', value: '94', color: T.danger },
|
||
{ label: 'Countries hit', value: '37', color: T.warn },
|
||
{ label: 'Victims linked', value: '3,400+', color: T.warn },
|
||
{ label: 'Active since', value: 'Nov 2024', color: T.text2 },
|
||
].map((s, i) => (
|
||
<motion.div key={s.label} initial={{ opacity: 0, y: 5 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .15 + i * .05 }}
|
||
style={{ ...cardStyle, padding: '8px 10px' }}>
|
||
<div style={{ fontSize: 9, color: T.muted, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '.4px' }}>{s.label}</div>
|
||
<div style={{ fontSize: 14, fontWeight: 700, color: s.color, marginTop: 3 }}>{s.value}</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
<motion.div style={{ ...cardStyle, fontSize: 11, color: T.text2, lineHeight: 1.6 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .35 }}>
|
||
<span style={{ color: T.danger, fontWeight: 600 }}>Linked to:</span> Instagram credential stuffing campaign – 3,400+ victims globally, ongoing since Nov 2024.
|
||
</motion.div>
|
||
|
||
<PrimaryBtn color={T.danger}>Block this IP across all devices →</PrimaryBtn>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneScope() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Impact numbers */}
|
||
<div style={{ display: 'flex', gap: 8 }}>
|
||
{[
|
||
{ n: 1, label: 'Account affected', color: T.danger, sub: "Emma's Instagram" },
|
||
{ n: 0, label: 'Devices affected', color: T.success, sub: '12/12 safe' },
|
||
].map((s, i) => (
|
||
<motion.div key={s.label} initial={{ opacity: 0, scale: .95 }} animate={{ opacity: 1, scale: 1 }} transition={{ delay: i * .1, ...EASE_SPRING }}
|
||
style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '12px 8px', borderColor: s.n > 0 ? T.danger + '44' : T.border, background: s.n > 0 ? T.dangerSoft : T.surface2 }}>
|
||
<div style={{ fontSize: 22, fontWeight: 300, color: s.color }}>
|
||
<AnimNum to={s.n} delay={200} />
|
||
</div>
|
||
<div style={{ fontSize: 10, color: T.muted, marginTop: 2 }}>{s.label}</div>
|
||
<div style={{ fontSize: 9, color: s.n > 0 ? T.danger : T.success, marginTop: 2 }}>{s.sub}</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
{/* Actions required */}
|
||
<div style={cardStyle}>
|
||
<div style={{ fontSize: 10, fontWeight: 700, color: T.warn, textTransform: 'uppercase', letterSpacing: '.4px', marginBottom: 8 }}>Actions required</div>
|
||
{[
|
||
{ label: 'Force Instagram password reset', urgency: 'Now', color: T.danger },
|
||
{ label: 'Enable two-factor authentication', urgency: '5 min', color: T.warn },
|
||
{ label: 'Review connected third-party apps', urgency: '10 min', color: T.accent },
|
||
].map((r, i) => (
|
||
<motion.div key={r.label} initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .15 + i * .08 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '8px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<div style={{ width: 4, height: 32, borderRadius: 2, background: r.color, flexShrink: 0 }} />
|
||
<div style={{ flex: 1, fontSize: 11, color: T.text }}>{r.label}</div>
|
||
<span style={{ fontSize: 9, color: r.color, fontWeight: 700 }}>{r.urgency}</span>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
<PrimaryBtn>Take action now →</PrimaryBtn>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
// ── Flow C ────────────────────────────────────────────────────────────────────
|
||
|
||
function SceneDevicesList() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 2 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Home devices</div>
|
||
<div style={{ fontSize: 10, color: T.warn }}>1 needs attention</div>
|
||
</div>
|
||
|
||
<div style={{ ...cardStyle, padding: '4px 14px' }}>
|
||
{([
|
||
{ Icon: IconPhone, name: "Sarah's iPhone 15 Pro", sub: 'iOS 17.4 · Online', variant: 'ok' as const, score: 100 },
|
||
{ Icon: IconLaptop, name: "Mark's MacBook Pro", sub: 'macOS 14.4 · Online', variant: 'ok' as const, score: 98 },
|
||
{ Icon: IconConsole, name: 'PlayStation 5', sub: 'FW 23.02 · Isolated', variant: 'warn' as const, score: 72 },
|
||
{ Icon: IconTv, name: 'Samsung 65" Smart TV', sub: 'Tizen 7.0 · Online', variant: 'ok' as const, score: 95 },
|
||
{ Icon: IconRouter, name: 'HP LaserJet Pro', sub: 'FW 22.5 · CVE-2024-8471', variant: 'warn' as const, score: 61 },
|
||
{ Icon: IconCamera, name: 'Nest Cam (Front Door)', sub: 'FW 3.5.2 · Online', variant: 'ok' as const, score: 97 },
|
||
] as const).map((d, i) => (
|
||
<motion.div key={d.name} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: i * .06 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '9px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}`, cursor: 'pointer' }}>
|
||
<Iconbox bg={d.variant === 'warn' ? T.warnSoft : T.surface3} size={32}>
|
||
<d.Icon size={16} style={{ color: d.variant === 'warn' ? T.warn : T.text2 }} />
|
||
</Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 12, color: T.text }}>{d.name}</div>
|
||
<div style={{ fontSize: 9, color: T.muted }}>{d.sub}</div>
|
||
</div>
|
||
<div style={{ textAlign: 'right' }}>
|
||
<div style={{ fontSize: 11, fontWeight: 700, color: d.score >= 90 ? T.success : d.score >= 75 ? T.accent : T.warn }}>{d.score}</div>
|
||
<div style={{ fontSize: 8, color: T.dim }}>score</div>
|
||
</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneVulnDetail() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<motion.div style={{ ...cardStyle, background: T.warnSoft, borderColor: T.warn + '66' }}
|
||
initial={{ opacity: 0, scale: .97 }} animate={{ opacity: 1, scale: 1 }} transition={EASE_SPRING}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
|
||
<Iconbox bg={T.warnSoft} color={T.warn} size={40}><IconRouter size={20} style={{ color: T.warn }} /></Iconbox>
|
||
<div>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>HP LaserJet Pro</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Firmware 22.5 · Port 9100</div>
|
||
</div>
|
||
<div style={{ marginLeft: 'auto' }}><Pill label="High" variant="warn" /></div>
|
||
</div>
|
||
|
||
{/* CVE */}
|
||
<div style={{ background: 'rgba(0,0,0,.18)', borderRadius: 8, padding: '7px 10px', marginBottom: 10 }}>
|
||
<div style={{ fontSize: 9, color: T.muted, marginBottom: 2 }}>VULNERABILITY</div>
|
||
<div style={{ fontSize: 12, fontWeight: 700, color: T.warn, fontFamily: "'Ubuntu Mono', monospace" }}>CVE-2024-8471</div>
|
||
<div style={{ fontSize: 10, color: T.text2, marginTop: 2 }}>Remote code execution via print port 9100</div>
|
||
</div>
|
||
|
||
{/* CVSS bar */}
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4 }}>
|
||
<span style={{ fontSize: 9, color: T.muted, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '.4px' }}>CVSS v3</span>
|
||
<span style={{ fontSize: 12, fontWeight: 700, color: T.warn }}>7.8 / 10</span>
|
||
</div>
|
||
<div style={{ height: 5, background: T.surface3, borderRadius: 3, overflow: 'hidden' }}>
|
||
<motion.div initial={{ width: 0 }} animate={{ width: '78%' }} transition={{ duration: 1.1, delay: .3, ease: EASE_OUT }}
|
||
style={{ height: '100%', background: `linear-gradient(to right, ${T.accent}, ${T.warn})`, borderRadius: 3 }} />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Attack vector */}
|
||
<motion.div style={cardStyle} initial={{ opacity: 0, y: 5 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .15 }}>
|
||
<div style={{ fontSize: 10, color: T.muted, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '.4px', marginBottom: 8 }}>Attack vector</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||
{[['🌐', 'Network'], ['→', ''], ['🖨️', 'Port 9100'], ['→', ''], ['💀', 'RCE']].map((p, i) => (
|
||
p[0] === '→'
|
||
? <motion.span key={i} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .2 + i * .06 }} style={{ color: T.dim, fontSize: 12 }}>→</motion.span>
|
||
: <motion.div key={i} initial={{ opacity: 0, scale: .8 }} animate={{ opacity: 1, scale: 1 }} transition={{ delay: .2 + i * .07 }}
|
||
style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2 }}>
|
||
<span style={{ fontSize: 16 }}>{p[0]}</span>
|
||
<span style={{ fontSize: 8, color: T.muted }}>{p[1]}</span>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
|
||
{/* Fix */}
|
||
<motion.div style={{ ...cardStyle, padding: '4px 14px' }} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .25 }}>
|
||
{[
|
||
{ l: 'Affected FW', v: '< 22.6', c: T.danger, first: true },
|
||
{ l: 'Your version', v: '22.5 · Vulnerable', c: T.danger, first: false },
|
||
{ l: 'Fix available', v: 'v22.6.1 · Ready', c: T.success, first: false },
|
||
{ l: 'Downtime', v: 'None required', c: T.accent, first: false },
|
||
].map(r => (
|
||
<div key={r.l} style={{ display: 'flex', justifyContent: 'space-between', padding: '7px 0', borderTop: r.first ? 'none' : `1px solid ${T.border}`, fontSize: 11 }}>
|
||
<span style={{ color: T.muted }}>{r.l}</span>
|
||
<span style={{ color: r.c, fontWeight: 500 }}>{r.v}</span>
|
||
</div>
|
||
))}
|
||
</motion.div>
|
||
|
||
<PrimaryBtn color={T.warn}>Update firmware now →</PrimaryBtn>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneScanRunning() {
|
||
const items: { Icon: React.ComponentType<{ size?: number; style?: React.CSSProperties }>; name: string; ok: boolean; warn?: boolean }[] = [
|
||
{ Icon: IconPhone, name: "Sarah's iPhone", ok: true },
|
||
{ Icon: IconLaptop, name: "Mark's MacBook", ok: true },
|
||
{ Icon: IconPhone, name: "Emma's iPhone", ok: true },
|
||
{ Icon: IconLaptop, name: "Mia's iPad", ok: true },
|
||
{ Icon: IconConsole, name: 'PS5', ok: true },
|
||
{ Icon: IconTv, name: 'Smart TV', ok: true },
|
||
{ Icon: IconCamera, name: 'Nest Cam', ok: true },
|
||
{ Icon: IconSpeaker, name: 'HomePod', ok: true },
|
||
{ Icon: IconConsole, name: 'Switch', ok: true },
|
||
{ Icon: IconRouter, name: 'Hue Bridge', ok: true },
|
||
{ Icon: IconRouter, name: 'HP Printer', ok: false, warn: true },
|
||
{ Icon: IconLaptop, name: 'Guest Laptop', ok: false },
|
||
]
|
||
const [visible, setVisible] = useState(0)
|
||
useEffect(() => {
|
||
const t = setInterval(() => setVisible(v => Math.min(v + 1, items.length)), 280)
|
||
return () => clearInterval(t)
|
||
}, [items.length])
|
||
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Progress */}
|
||
<div style={cardStyle}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||
<LiveDot color={T.accent} />
|
||
<span style={{ fontSize: 12, fontWeight: 600, color: T.accent }}>Scanning network…</span>
|
||
</div>
|
||
<span style={{ fontSize: 10, color: T.muted }}>{Math.min(visible, 11)} / 12</span>
|
||
</div>
|
||
<div style={{ height: 4, background: T.surface3, borderRadius: 2, overflow: 'hidden' }}>
|
||
<motion.div animate={{ width: `${(Math.min(visible, 11) / 12) * 100}%` }} transition={{ duration: .3, ease: EASE_OUT }}
|
||
style={{ height: '100%', background: T.accent, borderRadius: 2 }} />
|
||
</div>
|
||
<div style={{ fontSize: 10, color: visible >= 11 ? T.warn : T.muted, marginTop: 5 }}>
|
||
{visible >= 11 ? '⚠ 1 issue found · HP Printer · CVE-2024-8471' : 'Checking firmware versions and CVE database…'}
|
||
</div>
|
||
</div>
|
||
|
||
{/* Device grid */}
|
||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}>
|
||
{items.map((d, i) => {
|
||
const shown = i < visible
|
||
const iconColor = d.warn ? T.warn : d.ok ? T.accent : T.dim
|
||
return (
|
||
<AnimatePresence key={d.name}>
|
||
{shown && (
|
||
<motion.div
|
||
initial={{ opacity: 0, scale: .88 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0 }}
|
||
transition={{ type: 'spring', stiffness: 400, damping: 28 }}
|
||
style={{ ...cardStyle, padding: '7px 9px', display: 'flex', alignItems: 'center', gap: 6, borderColor: d.warn ? T.warn + '55' : T.border, background: d.warn ? T.warnSoft : T.surface2 }}>
|
||
<d.Icon size={14} style={{ color: iconColor, flexShrink: 0 }} />
|
||
<span style={{ fontSize: 10, flex: 1, color: T.text2, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{d.name}</span>
|
||
{d.warn
|
||
? <IconAlert size={11} style={{ color: T.warn, flexShrink: 0 }} />
|
||
: d.ok ? <IconCheck size={11} style={{ color: T.success, flexShrink: 0 }} /> : null}
|
||
</motion.div>
|
||
)}
|
||
</AnimatePresence>
|
||
)
|
||
})}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneRemediation() {
|
||
const [phase, setPhase] = useState(0)
|
||
useEffect(() => {
|
||
const ts = [900, 2200, 3800].map((d, i) => setTimeout(() => setPhase(i + 1), d))
|
||
return () => ts.forEach(clearTimeout)
|
||
}, [])
|
||
const stages = ['Downloading v22.6.1', 'Verifying checksum', 'Applying patch']
|
||
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Device header */}
|
||
<div style={cardStyle}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
|
||
<Iconbox bg={phase >= 3 ? T.successSoft : T.surface3} size={40}>
|
||
<IconRouter size={20} style={{ color: phase >= 3 ? T.success : T.text2 }} />
|
||
</Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>HP LaserJet Pro</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>
|
||
{phase < 3 ? `FW 22.5 → 22.6.1 · ${stages[Math.min(phase, 2)]}` : 'FW 22.6.1 · Patch applied'}
|
||
</div>
|
||
</div>
|
||
<Pill label={phase >= 3 ? 'Updated' : 'Updating…'} variant={phase >= 3 ? 'ok' : 'warn'} />
|
||
</div>
|
||
|
||
{/* Stage progress */}
|
||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||
{stages.map((s, i) => {
|
||
const done = phase > i
|
||
const active = phase === i
|
||
return (
|
||
<div key={s} style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||
<div style={{ width: 16, height: 16, borderRadius: '50%', flexShrink: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', background: done ? T.successSoft : active ? T.accentSoft : T.surface3 }}>
|
||
{done ? <IconCheck size={10} style={{ color: T.success }} /> : <div style={{ width: 5, height: 5, borderRadius: '50%', background: active ? T.accent : T.dim }} />}
|
||
</div>
|
||
<div style={{ flex: 1, height: 4, background: T.surface3, borderRadius: 2, overflow: 'hidden' }}>
|
||
<motion.div animate={{ width: done ? '100%' : active ? '70%' : '0%' }} transition={{ duration: active ? 1.5 : .4, ease: 'easeOut' }}
|
||
style={{ height: '100%', background: done ? T.success : T.accent, borderRadius: 2 }} />
|
||
</div>
|
||
<span style={{ fontSize: 9, color: done ? T.success : active ? T.accent : T.dim, width: 14, textAlign: 'right' }}>
|
||
{done ? '✓' : active ? '…' : ''}
|
||
</span>
|
||
</div>
|
||
)
|
||
})}
|
||
</div>
|
||
|
||
{phase >= 3 && (
|
||
<motion.div initial={{ opacity: 0, y: 4 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .2 }}
|
||
style={{ marginTop: 10, textAlign: 'center', fontSize: 12, fontWeight: 600, color: T.success }}>
|
||
✓ Firmware updated successfully
|
||
</motion.div>
|
||
)}
|
||
</div>
|
||
|
||
<div style={{ ...cardStyle, padding: '4px 14px' }}>
|
||
{[
|
||
{ l: 'Patch version', v: '22.5 → 22.6.1', c: T.text2, first: true },
|
||
{ l: 'CVE closed', v: 'CVE-2024-8471', c: T.success, first: false },
|
||
{ l: 'Downtime', v: 'None required', c: T.accent, first: false },
|
||
{ l: 'Verified by', v: 'BlackDice cloud', c: T.muted, first: false },
|
||
].map(r => (
|
||
<div key={r.l} style={{ display: 'flex', justifyContent: 'space-between', padding: '7px 0', borderTop: r.first ? 'none' : `1px solid ${T.border}`, fontSize: 11 }}>
|
||
<span style={{ color: T.muted }}>{r.l}</span>
|
||
<span style={{ color: r.c, fontWeight: 500 }}>{r.v}</span>
|
||
</div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneVerified() {
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<motion.div initial={{ scale: .94 }} animate={{ scale: 1 }} transition={EASE_SPRING}
|
||
style={{ ...cardStyle, background: T.successSoft, borderColor: 'transparent', textAlign: 'center', padding: '18px 14px' }}>
|
||
<motion.div initial={{ scale: 0, rotate: -20 }} animate={{ scale: 1, rotate: 0 }} transition={{ ...EASE_SPRING, delay: .1 }}
|
||
style={{ width: 50, height: 50, borderRadius: '50%', background: T.success, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px' }}>
|
||
<ShieldCheck size={24} color="#fff" />
|
||
</motion.div>
|
||
<div style={{ fontSize: 14, fontWeight: 600, color: T.success }}>All clear</div>
|
||
<div style={{ fontSize: 10, color: T.success, marginTop: 3 }}>HP Printer patched · CVE-2024-8471 resolved</div>
|
||
</motion.div>
|
||
|
||
<div style={{ ...cardStyle, display: 'flex', alignItems: 'center', gap: 14 }}>
|
||
<ScoreRing score={95} size={58} strokeWidth={5} delay={300} />
|
||
<div>
|
||
<div style={{ fontSize: 16, fontWeight: 700, color: T.success }}>
|
||
<AnimNum to={95} from={92} delay={350} /><span style={{ fontSize: 11, color: T.muted, fontWeight: 400 }}>/100</span>
|
||
</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Family Security Score</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 3 }}>
|
||
<div style={{ fontSize: 10, color: T.dim, textDecoration: 'line-through' }}>92</div>
|
||
<div style={{ fontSize: 10, color: T.success, fontWeight: 600 }}>95 · ▲ +3</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div style={{ ...cardStyle, padding: '4px 14px' }}>
|
||
{[
|
||
{ t: 'HP Printer · FW 22.6.1 installed', done: true },
|
||
{ t: 'CVE-2024-8471 patch verified', done: true },
|
||
{ t: '12 devices · all secure', done: true },
|
||
{ t: 'Next scan in 24 hours', done: false },
|
||
].map((r, i) => (
|
||
<motion.div key={r.t} initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .2 + i * .07 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}`, fontSize: 11 }}>
|
||
{r.done
|
||
? <IconCheck size={12} style={{ color: T.success, flexShrink: 0 }} />
|
||
: <div style={{ width: 12, height: 12, borderRadius: '50%', border: `1.5px solid ${T.muted}`, flexShrink: 0 }} />}
|
||
<span style={{ color: r.done ? T.text2 : T.muted }}>{r.t}</span>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
// ── Flow D ────────────────────────────────────────────────────────────────────
|
||
|
||
function SceneScoreRingFull() {
|
||
const categories = [
|
||
{ label: 'Network', score: 97, color: T.success },
|
||
{ label: 'Devices', score: 88, color: T.accent },
|
||
{ label: 'Accounts', score: 94, color: T.success },
|
||
{ label: 'Kids', score: 92, color: T.accent },
|
||
]
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 14, paddingTop: 6 }}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<ScoreRing score={SECURITY_SCORE.score} size={120} strokeWidth={9} delay={150} />
|
||
|
||
<div style={{ textAlign: 'center' }}>
|
||
<div style={{ fontSize: 14, fontWeight: 600, color: T.success }}>{SECURITY_SCORE.label}</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Family Security Score</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 4, justifyContent: 'center' }}>
|
||
<span style={{ fontSize: 10, color: T.dim, textDecoration: 'line-through' }}>{SECURITY_SCORE.previous}</span>
|
||
<span style={{ fontSize: 10, color: T.success, fontWeight: 700 }}>+{SECURITY_SCORE.change} this week</span>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Category breakdown */}
|
||
<div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||
{categories.map((c, i) => (
|
||
<motion.div key={c.label} initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .3 + i * .06, ease: EASE_OUT }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||
<div style={{ fontSize: 10, color: T.muted, width: 52 }}>{c.label}</div>
|
||
<div style={{ flex: 1, height: 5, background: T.surface3, borderRadius: 3, overflow: 'hidden' }}>
|
||
<motion.div initial={{ width: 0 }} animate={{ width: `${c.score}%` }} transition={{ duration: 1, delay: .4 + i * .06, ease: EASE_OUT }}
|
||
style={{ height: '100%', background: c.color, borderRadius: 3 }} />
|
||
</div>
|
||
<div style={{ fontSize: 10, fontWeight: 700, color: c.color, width: 24, textAlign: 'right' }}>{c.score}</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
|
||
{/* Stats row */}
|
||
<div style={{ display: 'flex', gap: 7, width: '100%' }}>
|
||
{[
|
||
{ label: 'Threats blocked', value: WEEKLY_REPORT.threatsBlocked, color: T.success },
|
||
{ label: 'Devices', value: WEEKLY_REPORT.devicesProtected, color: T.accent },
|
||
{ label: 'Open issues', value: WEEKLY_REPORT.openIssues, color: T.warn },
|
||
].map((s, i) => (
|
||
<motion.div key={s.label} initial={{ opacity: 0, y: 5 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .6 + i * .05 }}
|
||
style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '8px 4px' }}>
|
||
<div style={{ fontSize: 15, fontWeight: 700, color: s.color }}>
|
||
<AnimNum to={s.value} delay={700 + i * 80} />
|
||
</div>
|
||
<div style={{ fontSize: 9, color: T.muted, marginTop: 1 }}>{s.label}</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneTrendsChart() {
|
||
const days = ['M','T','W','T','F','S','S']
|
||
const max = Math.max(...WEEKLY_REPORT.daily)
|
||
const total = WEEKLY_REPORT.daily.reduce((a, b) => a + b, 0)
|
||
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
{/* Bar chart */}
|
||
<div style={cardStyle}>
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 12 }}>
|
||
<div>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>
|
||
<AnimNum to={WEEKLY_REPORT.threatsBlocked} delay={100} /> blocked
|
||
</div>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 5, marginTop: 2 }}>
|
||
<span style={{ fontSize: 10, color: T.success }}>↓ {Math.abs(WEEKLY_REPORT.threatsVsLastWeek)}%</span>
|
||
<span style={{ fontSize: 10, color: T.dim }}>vs last week</span>
|
||
</div>
|
||
</div>
|
||
<Pill label={WEEKLY_REPORT.period} variant="info" />
|
||
</div>
|
||
<div style={{ display: 'flex', gap: 5, alignItems: 'flex-end', height: 64 }}>
|
||
{WEEKLY_REPORT.daily.map((v, i) => (
|
||
<div key={i} style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100%', justifyContent: 'flex-end' }}>
|
||
<motion.div initial={{ scaleY: 0 }} animate={{ scaleY: 1 }} transition={{ delay: .1 + i * .07, duration: .45, ease: EASE_OUT }}
|
||
style={{ width: '100%', borderRadius: '3px 3px 0 0', background: i === 6 ? T.accent : T.accentSoft, height: `${(v / max) * 100}%`, transformOrigin: 'bottom' }} />
|
||
<div style={{ fontSize: 9, color: T.dim, marginTop: 3 }}>{days[i]}</div>
|
||
</div>
|
||
))}
|
||
</div>
|
||
</div>
|
||
|
||
{/* Top threat types */}
|
||
<div style={cardStyle}>
|
||
<div style={{ fontSize: 10, fontWeight: 700, color: T.muted, textTransform: 'uppercase', letterSpacing: '.4px', marginBottom: 8 }}>By threat type</div>
|
||
{WEEKLY_REPORT.topThreats.map((t, i) => (
|
||
<motion.div key={t.label} initial={{ opacity: 0, x: -6 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: .2 + i * .07 }}
|
||
style={{ display: 'flex', alignItems: 'center', gap: 10, padding: i === 0 ? '0 0 7px' : '7px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}` }}>
|
||
<div style={{ fontSize: 10, color: T.text2, width: 80, flexShrink: 0 }}>{t.label}</div>
|
||
<div style={{ flex: 1, height: 4, background: T.surface3, borderRadius: 2, overflow: 'hidden' }}>
|
||
<motion.div initial={{ width: 0 }} animate={{ width: `${t.pct}%` }} transition={{ duration: .8, delay: .3 + i * .07, ease: EASE_OUT }}
|
||
style={{ height: '100%', background: i === 0 ? T.danger : i === 1 ? T.warn : T.accent, borderRadius: 2 }} />
|
||
</div>
|
||
<div style={{ fontSize: 10, fontWeight: 700, color: T.text2, width: 28, textAlign: 'right' }}>{t.pct}%</div>
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneDeviceGrid() {
|
||
const gridIcons = [
|
||
{ I: IconPhone, n: "Sarah" }, { I: IconLaptop, n: "Mark" },
|
||
{ I: IconPhone, n: "Emma" }, { I: IconLaptop, n: "Mia" },
|
||
{ I: IconConsole, n: "PS5" }, { I: IconConsole, n: "Switch" },
|
||
{ I: IconTv, n: "TV" }, { I: IconSpeaker, n: "HomePod" },
|
||
{ I: IconCamera, n: "Cam" }, { I: IconRouter, n: "Bridge" },
|
||
{ I: IconRouter, n: "Printer" }, { I: IconLaptop, n: "Guest" },
|
||
]
|
||
return (
|
||
<motion.div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
|
||
<motion.div style={{ ...cardStyle, textAlign: 'center', background: T.successSoft, borderColor: 'transparent' }}
|
||
initial={{ opacity: 0, scale: .97 }} animate={{ opacity: 1, scale: 1 }} transition={EASE_SPRING}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.success }}>12 Devices Protected</div>
|
||
<div style={{ fontSize: 10, color: T.success, marginTop: 3 }}>Last scan: Just now · 0 vulnerabilities</div>
|
||
</motion.div>
|
||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 6 }}>
|
||
{gridIcons.map((d, i) => (
|
||
<motion.div key={i}
|
||
initial={{ opacity: 0, scale: .8 }} animate={{ opacity: 1, scale: 1 }}
|
||
transition={{ delay: i * .04, type: 'spring', stiffness: 400, damping: 24 }}
|
||
style={{ ...cardStyle, textAlign: 'center', padding: '8px 5px', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 3 }}>
|
||
<d.I size={16} style={{ color: T.text2 }} />
|
||
<div style={{ fontSize: 8, color: T.dim, overflow: 'hidden', width: '100%', textAlign: 'center', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{d.n}</div>
|
||
<ShieldCheck size={11} color={T.success} />
|
||
</motion.div>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
)
|
||
}
|
||
|
||
function SceneExport() {
|
||
const [open, setOpen] = useState(false)
|
||
useEffect(() => { const t = setTimeout(() => setOpen(true), 650); return () => clearTimeout(t) }, [])
|
||
return (
|
||
<div style={{ position: 'relative', minHeight: 340 }}>
|
||
<div style={{ opacity: .35 }}><SceneDeviceGrid /></div>
|
||
<AnimatePresence>
|
||
{open && (
|
||
<motion.div initial={{ y: '100%' }} animate={{ y: 0 }} transition={{ ...EASE_SPRING }}
|
||
style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'flex-end', borderRadius: 16, background: 'rgba(1,30,38,.7)', backdropFilter: 'blur(6px)' }}>
|
||
<motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .15, ease: EASE_OUT }}
|
||
style={{ ...cardStyle, width: '100%', borderRadius: '16px 16px 0 0', margin: 0, background: T.surfaceStr, borderTop: `1px solid ${T.borderStr}` }}>
|
||
{/* Report preview */}
|
||
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 12, marginBottom: 14 }}>
|
||
<Iconbox bg={T.accentSoft} color={T.accent} size={42}>
|
||
<IconShieldCheckSvg size={20} style={{ color: T.accent }} />
|
||
</Iconbox>
|
||
<div style={{ flex: 1 }}>
|
||
<div style={{ fontSize: 13, fontWeight: 600, color: T.text }}>Weekly Security Report</div>
|
||
<div style={{ fontSize: 10, color: T.muted }}>Hughes Family · {WEEKLY_REPORT.period}</div>
|
||
<div style={{ display: 'flex', gap: 6, marginTop: 6 }}>
|
||
<StatusChip label={`${WEEKLY_REPORT.threatsBlocked} blocked`} ok={true} />
|
||
<StatusChip label={`${WEEKLY_REPORT.devicesProtected} safe`} ok={true} />
|
||
<StatusChip label={`${WEEKLY_REPORT.openIssues} open`} ok={false} />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Score summary row */}
|
||
<div style={{ display: 'flex', gap: 8, marginBottom: 14 }}>
|
||
<div style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '8px 4px' }}>
|
||
<div style={{ fontSize: 16, fontWeight: 700, color: T.success }}>{SECURITY_SCORE.score}</div>
|
||
<div style={{ fontSize: 9, color: T.muted }}>Security score</div>
|
||
</div>
|
||
<div style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '8px 4px' }}>
|
||
<div style={{ fontSize: 12, fontWeight: 700, color: T.success }}>↓{Math.abs(WEEKLY_REPORT.threatsVsLastWeek)}%</div>
|
||
<div style={{ fontSize: 9, color: T.muted }}>vs last week</div>
|
||
</div>
|
||
<div style={{ ...cardStyle, flex: 1, textAlign: 'center', padding: '8px 4px' }}>
|
||
<div style={{ fontSize: 16, fontWeight: 700, color: T.accent }}>A+</div>
|
||
<div style={{ fontSize: 9, color: T.muted }}>Rating</div>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Action buttons */}
|
||
<div style={{ display: 'flex', gap: 7 }}>
|
||
{(['Share', 'Download PDF', 'Print'] as const).map(l => (
|
||
<motion.button key={l} whileTap={{ scale: .96 }}
|
||
style={{ flex: 1, padding: '8px 0', background: l === 'Download PDF' ? T.accent : T.surface2, border: `1px solid ${l === 'Download PDF' ? T.accent : T.border}`, borderRadius: 10, color: l === 'Download PDF' ? '#fff' : T.text2, fontWeight: 600, fontSize: 11, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 4 }}>
|
||
{l === 'Download PDF' && <IconDownload size={12} style={{ color: '#fff' }} />}
|
||
{l}
|
||
</motion.button>
|
||
))}
|
||
</div>
|
||
</motion.div>
|
||
</motion.div>
|
||
)}
|
||
</AnimatePresence>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
// ── Scene registry ─────────────────────────────────────────────────────────────
|
||
const SCENES: Record<string, () => JSX.Element> = {
|
||
'home': SceneHome,
|
||
'alert-toast': SceneAlertToast,
|
||
'alert-detail': SceneAlertDetail,
|
||
'device-ps5': SceneDevicePS5,
|
||
'isolate-modal': SceneIsolateModal,
|
||
'isolate-progress': SceneIsolateProgress,
|
||
'resolved': SceneResolved,
|
||
'notif-panel': SceneNotifPanel,
|
||
'emma-profile': SceneEmmaProfile,
|
||
'timeline': SceneTimeline,
|
||
'ip-detail': SceneIPDetail,
|
||
'scope': SceneScope,
|
||
'devices-list': SceneDevicesList,
|
||
'vuln-detail': SceneVulnDetail,
|
||
'scan-running': SceneScanRunning,
|
||
'remediation': SceneRemediation,
|
||
'verified': SceneVerified,
|
||
'score-ring': SceneScoreRingFull,
|
||
'trends-chart': SceneTrendsChart,
|
||
'device-grid': SceneDeviceGrid,
|
||
'export': SceneExport,
|
||
}
|
||
|
||
// ── Video mode (Apple-style, phone-first) ─────────────────────────────────────
|
||
|
||
type Tilt = { rotateY: number; rotateX: number; scale: number }
|
||
type VideoItem = { id: string; scene: string | null; ms: number; caption: string; vo: string; tilt: Tilt }
|
||
|
||
// Sequence: title + 7 Flow-A scenes + end card ≈ 52s
|
||
const VIDEO_SEQUENCE: VideoItem[] = [
|
||
{ id: 'title', scene: null, ms: 4000, caption: 'Welcome', vo: 'Your family’s digital life. One screen.', tilt: { rotateY: -4, rotateX: 2, scale: 0.97 } },
|
||
{ id: 'home', scene: 'home', ms: 5400, caption: 'Home Dashboard', vo: 'Everything you need to protect your family – in one place.', tilt: { rotateY: -2, rotateX: 2, scale: 1.00 } },
|
||
{ id: 'toast', scene: 'alert-toast', ms: 6000, caption: 'Real-time Alert', vo: 'Real-time threats, delivered exactly when they happen.', tilt: { rotateY: 3, rotateX: 1, scale: 1.01 } },
|
||
{ id: 'detail', scene: 'alert-detail', ms: 6400, caption: 'Threat Intelligence', vo: 'We don’t just say something’s wrong. We show you what it is.', tilt: { rotateY: 0, rotateX: 0, scale: 1.00 } },
|
||
{ id: 'ps5', scene: 'device-ps5', ms: 6000, caption: 'Live Traffic', vo: 'Watch threats in real time. See what’s leaving your home.', tilt: { rotateY: -3, rotateX: 2, scale: 1.01 } },
|
||
{ id: 'modal', scene: 'isolate-modal', ms: 7400, caption: 'One Tap', vo: 'One tap. That’s all it takes to stop it.', tilt: { rotateY: 0, rotateX: 4, scale: 1.02 } },
|
||
{ id: 'progress', scene: 'isolate-progress', ms: 6500, caption: 'Automatic Response', vo: 'Isolated. Severed. Logged. Notified.', tilt: { rotateY: -1, rotateX: 1, scale: 1.00 } },
|
||
{ id: 'resolved', scene: 'resolved', ms: 5600, caption: 'Resolved', vo: 'Threat neutralised. Family safe. Score improved.', tilt: { rotateY: 0, rotateX: 0, scale: 1.00 } },
|
||
{ id: 'end', scene: null, ms: 5200, caption: 'BlackDice Angel', vo: 'BlackDice Angel. Safety you can see.', tilt: { rotateY: -4, rotateX: 2, scale: 0.97 } },
|
||
]
|
||
const VIDEO_TOTAL_MS = VIDEO_SEQUENCE.reduce((s, v) => s + v.ms, 0)
|
||
|
||
function VideoLogo({ size = 36 }: { size?: number }) {
|
||
return (
|
||
<svg width={size} height={size} viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" style={{ color: T.accent, flexShrink: 0 }}>
|
||
<g fill="none" stroke="currentColor" strokeWidth="3" strokeLinejoin="round" strokeLinecap="round">
|
||
<path d="M32 6 L56 20 L56 46 L32 60 L8 46 L8 20 Z"/>
|
||
<path d="M32 6 L32 32 M8 20 L32 32 M56 20 L32 32"/>
|
||
</g>
|
||
<g fill="currentColor">
|
||
<circle cx="20" cy="26" r="2.4"/><circle cx="20" cy="34" r="2.4"/><circle cx="44" cy="34" r="2.4"/>
|
||
</g>
|
||
</svg>
|
||
)
|
||
}
|
||
|
||
function SceneVideoTitle() {
|
||
return (
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', gap: 22, padding: '0 24px', textAlign: 'center' }}>
|
||
{/* Glow ring behind logo */}
|
||
<div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||
<motion.div
|
||
animate={{ scale: [1, 1.4, 1], opacity: [0.22, 0.06, 0.22] }}
|
||
transition={{ duration: 3.4, repeat: Infinity, ease: 'easeInOut' }}
|
||
style={{ position: 'absolute', width: 130, height: 130, borderRadius: '50%', background: T.accent, filter: 'blur(8px)' }} />
|
||
<motion.div initial={{ scale: 0.5, opacity: 0 }} animate={{ scale: 1, opacity: 1 }}
|
||
transition={{ duration: .7, ease: EASE_OUT }}>
|
||
<VideoLogo size={64} />
|
||
</motion.div>
|
||
</div>
|
||
|
||
<motion.div initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .35, ease: EASE_OUT }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 7, marginBottom: 10 }}>
|
||
<span style={{ fontSize: 25, fontWeight: 700, color: T.text, letterSpacing: '-.6px' }}>BlackDice</span>
|
||
<span style={{ fontSize: 25, fontWeight: 700, color: T.accent, letterSpacing: '-.6px' }}>Angel</span>
|
||
</div>
|
||
<div style={{ fontSize: 12.5, color: T.text2, lineHeight: 1.6, maxWidth: 220, margin: '0 auto', fontWeight: 300, letterSpacing: '.2px' }}>
|
||
Your family’s digital life.<br />One screen.
|
||
</div>
|
||
</motion.div>
|
||
|
||
<motion.div initial={{ opacity: 0, scaleX: 0 }} animate={{ opacity: 1, scaleX: 1 }} transition={{ delay: .7, duration: .6, ease: EASE_OUT }}
|
||
style={{ width: 54, height: 2, borderRadius: 1, background: `linear-gradient(to right, transparent, ${T.accent}, transparent)` }} />
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function SceneVideoEnd() {
|
||
return (
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', gap: 0, padding: '0 24px', textAlign: 'center' }}>
|
||
<motion.div initial={{ scale: 0.6, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} transition={{ ...EASE_SPRING, delay: .1 }}
|
||
style={{ position: 'relative', marginBottom: 18 }}>
|
||
<motion.div
|
||
animate={{ scale: [1, 1.3, 1], opacity: [0.25, 0.05, 0.25] }}
|
||
transition={{ duration: 3, repeat: Infinity, ease: 'easeInOut' }}
|
||
style={{ position: 'absolute', inset: -20, borderRadius: '50%', background: T.accent, filter: 'blur(10px)' }} />
|
||
<VideoLogo size={56} />
|
||
</motion.div>
|
||
|
||
<motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .3, ease: EASE_OUT }}>
|
||
<div style={{ fontSize: 21, fontWeight: 700, color: T.text, letterSpacing: '-.5px', marginBottom: 8 }}>
|
||
<span style={{ color: T.accent }}>Black</span>Dice Angel
|
||
</div>
|
||
<div style={{ fontSize: 12.5, color: T.text2, lineHeight: 1.6, marginBottom: 22, fontWeight: 300, letterSpacing: '.2px' }}>
|
||
Safety you can see.
|
||
</div>
|
||
</motion.div>
|
||
|
||
<motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: .55, ease: EASE_OUT }}
|
||
whileHover={{ scale: 1.02 }}
|
||
style={{ background: T.accent, color: '#fff', fontSize: 12.5, fontWeight: 600, padding: '11px 28px', borderRadius: 100, display: 'inline-block', letterSpacing: '.2px', boxShadow: `0 10px 30px ${T.accent}55` }}>
|
||
Get started free
|
||
</motion.div>
|
||
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: .9 }}
|
||
style={{ fontSize: 10.5, color: T.muted, marginTop: 16, letterSpacing: '.4px' }}>blackdice.ai/angel</motion.div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
// Apple-style bezel-less phone with Dynamic Island + ambient glass reflection
|
||
function PhoneShell({ children }: { children: React.ReactNode }) {
|
||
return (
|
||
<div style={{
|
||
// 290 wide → inner content = 290 - 8 (frame) - 26 (padding) = 256px,
|
||
// matching the prototype/interactive demo so every screen renders identically.
|
||
width: 270, height: 600, flexShrink: 0,
|
||
borderRadius: 50,
|
||
padding: 4,
|
||
background: 'linear-gradient(150deg, #2c3a42 0%, #0c1418 45%, #1a262d 100%)',
|
||
boxShadow: `0 50px 100px rgba(0,0,0,.75), 0 8px 30px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.06)`,
|
||
position: 'relative',
|
||
}}>
|
||
{/* Inner screen */}
|
||
<div style={{
|
||
width: '100%', height: '100%', borderRadius: 46, overflow: 'hidden', position: 'relative',
|
||
background: T.bg, backgroundImage: T.bgGrad,
|
||
boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.6)',
|
||
}}>
|
||
{/* Status bar */}
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '16px 26px 8px', fontSize: 11, color: T.text, fontWeight: 600 }}>
|
||
<span>9:41</span>
|
||
<span style={{ fontSize: 10, color: T.muted }}>5G ▲ 100%</span>
|
||
</div>
|
||
|
||
{/* Dynamic Island */}
|
||
<div style={{ position: 'absolute', top: 12, left: '50%', transform: 'translateX(-50%)', width: 92, height: 26, borderRadius: 14, background: '#000', zIndex: 30, boxShadow: 'inset 0 0 0 1px rgba(255,255,255,.04)' }} />
|
||
|
||
{/* Content */}
|
||
<div style={{ position: 'absolute', top: 42, bottom: 58, left: 0, right: 0, overflowY: 'auto', padding: '6px 13px 8px', WebkitOverflowScrolling: 'touch' }}>
|
||
{children}
|
||
</div>
|
||
|
||
{/* Tab bar */}
|
||
<div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 58, background: T.surfaceStr, borderTop: `1px solid ${T.border}`, display: 'flex', alignItems: 'center', justifyContent: 'space-around', paddingBottom: 6 }}>
|
||
{([
|
||
{ Icon: IconHome, label: 'Home' },
|
||
{ Icon: IconUsers, label: 'Family' },
|
||
{ Icon: IconApps, label: 'Devices' },
|
||
{ Icon: IconSliders, label: 'Controls'},
|
||
{ Icon: IconBell, label: 'Alerts' },
|
||
] as const).map((tab, i) => (
|
||
<div key={tab.label} style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, fontSize: 9, color: i === 0 ? T.accent : T.dim }}>
|
||
<tab.Icon size={18} style={{ color: i === 0 ? T.accent : T.dim }} />
|
||
{tab.label}
|
||
</div>
|
||
))}
|
||
</div>
|
||
|
||
{/* Ambient glass reflection (top-left sheen) */}
|
||
<div style={{ position: 'absolute', inset: 0, borderRadius: 46, pointerEvents: 'none', background: 'linear-gradient(135deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 32%)', zIndex: 40 }} />
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
export function VideoPlayer({ embedded = false }: { embedded?: boolean }) {
|
||
const [idx, setIdx] = useState(0)
|
||
const [started, setStarted] = useState(false)
|
||
const [muted, setMuted] = useState(false)
|
||
const [elapsed, setElapsed] = useState(0) // ms since start
|
||
const rafRef = useRef<number>(0)
|
||
const t0Ref = useRef<number>(0)
|
||
|
||
const cancelSpeech = () => { try { window.speechSynthesis && window.speechSynthesis.cancel() } catch { /* noop */ } }
|
||
|
||
const item = VIDEO_SEQUENCE[idx]
|
||
const isFirst = idx === 0
|
||
const isLast = idx === VIDEO_SEQUENCE.length - 1
|
||
|
||
// Cumulative start offset of current scene
|
||
const sceneOffset = VIDEO_SEQUENCE.slice(0, idx).reduce((s, v) => s + v.ms, 0)
|
||
const sceneElapsed = elapsed - sceneOffset
|
||
const scenePct = Math.min(sceneElapsed / item.ms, 1)
|
||
const totalPct = Math.min(elapsed / VIDEO_TOTAL_MS, 1)
|
||
|
||
function start() {
|
||
setStarted(true)
|
||
t0Ref.current = performance.now() - elapsed
|
||
function tick() {
|
||
const now = performance.now() - t0Ref.current
|
||
setElapsed(now)
|
||
|
||
// Advance scene
|
||
setIdx(i => {
|
||
let cum = 0
|
||
for (let j = 0; j < VIDEO_SEQUENCE.length; j++) {
|
||
cum += VIDEO_SEQUENCE[j].ms
|
||
if (now < cum) return j
|
||
}
|
||
return VIDEO_SEQUENCE.length - 1
|
||
})
|
||
|
||
if (now < VIDEO_TOTAL_MS) rafRef.current = requestAnimationFrame(tick)
|
||
else { setStarted(false) }
|
||
}
|
||
rafRef.current = requestAnimationFrame(tick)
|
||
}
|
||
|
||
function pause() {
|
||
setStarted(false)
|
||
cancelAnimationFrame(rafRef.current)
|
||
cancelSpeech()
|
||
}
|
||
|
||
function reset() {
|
||
cancelAnimationFrame(rafRef.current)
|
||
cancelSpeech()
|
||
setStarted(false)
|
||
setElapsed(0)
|
||
setIdx(0)
|
||
}
|
||
|
||
function jumpTo(i: number) {
|
||
const target = Math.max(0, Math.min(i, VIDEO_SEQUENCE.length - 1))
|
||
cancelAnimationFrame(rafRef.current)
|
||
cancelSpeech()
|
||
setStarted(false)
|
||
const off = VIDEO_SEQUENCE.slice(0, target).reduce((s, x) => s + x.ms, 0)
|
||
setElapsed(off)
|
||
setIdx(target)
|
||
}
|
||
|
||
useEffect(() => () => { cancelAnimationFrame(rafRef.current); cancelSpeech() }, [])
|
||
|
||
// Spoken voiceover for each scene via the Web Speech API (triggered by the
|
||
// user's Play click, so autoplay-audio policies allow it).
|
||
useEffect(() => {
|
||
if (!started || muted) return
|
||
const synth = window.speechSynthesis
|
||
if (!synth) return
|
||
synth.cancel()
|
||
const u = new SpeechSynthesisUtterance(item.vo)
|
||
u.lang = 'en-GB'
|
||
u.rate = 0.96
|
||
u.pitch = 1.02
|
||
u.volume = 1
|
||
const pickVoice = () => {
|
||
const vs = synth.getVoices()
|
||
return (
|
||
vs.find((v) => /en-GB/i.test(v.lang) && /female|libby|sonia|google uk english female|samantha/i.test(v.name)) ||
|
||
vs.find((v) => /en-GB/i.test(v.lang)) ||
|
||
vs.find((v) => /en-US/i.test(v.lang)) ||
|
||
vs.find((v) => /^en/i.test(v.lang))
|
||
)
|
||
}
|
||
const v = pickVoice()
|
||
if (v) u.voice = v
|
||
synth.speak(u)
|
||
return () => synth.cancel()
|
||
}, [idx, started, muted, item.vo])
|
||
|
||
const SceneComp = item.scene ? SCENES[item.scene] : null
|
||
const secs = Math.floor(elapsed / 1000)
|
||
const mins = Math.floor(secs / 60)
|
||
const ss = String(secs % 60).padStart(2, '0')
|
||
const tilt = item.tilt
|
||
|
||
return (
|
||
<div className="bd-demo-root" style={{
|
||
minHeight: embedded ? 0 : '100vh',
|
||
height: embedded ? '100%' : '100vh',
|
||
background: 'radial-gradient(130% 90% at 50% 0%, #075466 0%, #013B49 38%, #021b22 72%, #0a1a22 100%)',
|
||
fontFamily: "'Ubuntu', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif",
|
||
WebkitFontSmoothing: 'antialiased',
|
||
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
|
||
gap: 0, padding: '0', position: 'relative', overflow: 'hidden',
|
||
borderRadius: embedded ? 24 : 0,
|
||
}}>
|
||
{/* Vignette */}
|
||
<div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', background: 'radial-gradient(120% 80% at 50% 45%, transparent 50%, rgba(0,0,0,.55) 100%)' }} />
|
||
|
||
|
||
{/* Scene chip — top left, subtle */}
|
||
<AnimatePresence mode="wait">
|
||
<motion.div key={`chip-${item.id}`}
|
||
initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0 }}
|
||
transition={{ duration: .4, ease: EASE_OUT }}
|
||
style={{ position: 'absolute', top: 20, left: 24, display: 'flex', alignItems: 'center', gap: 8, zIndex: 50 }}>
|
||
<span style={{ fontSize: 9, fontWeight: 700, letterSpacing: '1.5px', textTransform: 'uppercase', color: T.accent }}>
|
||
{String(idx + 1).padStart(2, '0')}
|
||
</span>
|
||
<span style={{ width: 14, height: 1, background: 'rgba(255,255,255,.2)' }} />
|
||
<span style={{ fontSize: 11, fontWeight: 500, color: 'rgba(255,255,255,.65)', letterSpacing: '.3px' }}>{item.caption}</span>
|
||
</motion.div>
|
||
</AnimatePresence>
|
||
|
||
{/* ── Stage: full-size phone + vertical control dock beside it ── */}
|
||
<div style={{ flex: 1, minHeight: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 24, position: 'relative', zIndex: 1, padding: '16px 24px', width: '100%', boxSizing: 'border-box' }}>
|
||
|
||
{/* Phone column: device + voiceover subtitle below.
|
||
Fixed width so the phone & dock never shift between scenes. */}
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 18, width: 290, flexShrink: 0 }}>
|
||
{/* Phone — per-scene tilt wrapper */}
|
||
<motion.div
|
||
style={{ perspective: 1300, transformStyle: 'preserve-3d' }}
|
||
animate={{}}>
|
||
<motion.div
|
||
animate={{ rotateY: tilt.rotateY, rotateX: tilt.rotateX, scale: tilt.scale }}
|
||
transition={{ duration: 1.1, ease: EASE_OUT }}
|
||
style={{ transformStyle: 'preserve-3d' }}>
|
||
{/* Breathing float */}
|
||
<motion.div
|
||
animate={{ y: [0, -8, 0] }}
|
||
transition={{ duration: 5, repeat: Infinity, ease: 'easeInOut' }}
|
||
style={{ position: 'relative' }}>
|
||
{/* Accent glow behind phone */}
|
||
<div style={{ position: 'absolute', inset: '8% 14%', borderRadius: '50%', background: T.accent, opacity: 0.16, filter: 'blur(55px)', zIndex: 0 }} />
|
||
<PhoneShell>
|
||
<AnimatePresence mode="wait">
|
||
<motion.div key={item.id}
|
||
initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}
|
||
transition={{ duration: .45, ease: EASE_OUT }}
|
||
style={{ height: '100%' }}>
|
||
{SceneComp
|
||
? <SceneComp />
|
||
: isFirst ? <SceneVideoTitle /> : <SceneVideoEnd />}
|
||
</motion.div>
|
||
</AnimatePresence>
|
||
</PhoneShell>
|
||
</motion.div>
|
||
</motion.div>
|
||
</motion.div>
|
||
|
||
{/* Cinematic voiceover subtitle — fixed-size box so changing text
|
||
never alters the column's footprint. */}
|
||
<div style={{ position: 'relative', width: 290, height: 52, flexShrink: 0 }}>
|
||
<AnimatePresence mode="wait">
|
||
<motion.div key={`vo-${item.id}`}
|
||
initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }}
|
||
transition={{ duration: .5, ease: EASE_OUT }}
|
||
style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'flex-start', justifyContent: 'center', textAlign: 'center' }}>
|
||
<span style={{ fontSize: 16, fontWeight: 400, color: 'rgba(255,255,255,.9)', letterSpacing: '-.2px', lineHeight: 1.5 }}>
|
||
{item.vo}
|
||
</span>
|
||
</motion.div>
|
||
</AnimatePresence>
|
||
</div>
|
||
</div>
|
||
|
||
{/* ── Vertical control dock (right side of the phone) ── */}
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 12, padding: '18px 11px', background: 'rgba(255,255,255,.04)', border: '1px solid rgba(255,255,255,.09)', borderRadius: 16, height: 524, boxSizing: 'border-box', zIndex: 50 }}>
|
||
{/* Play / Pause */}
|
||
<motion.button whileTap={{ scale: .92 }} onClick={started ? pause : start}
|
||
style={{ width: 44, height: 44, borderRadius: '50%', background: T.accent, border: 'none', color: '#fff', fontSize: 17, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: `0 8px 24px ${T.accent}55`, flexShrink: 0 }}>
|
||
{started ? '⏸' : '▶'}
|
||
</motion.button>
|
||
{/* Mute / unmute voiceover */}
|
||
<motion.button whileTap={{ scale: .92 }} onClick={() => setMuted((m) => !m)}
|
||
title={muted ? 'Unmute voiceover' : 'Mute voiceover'}
|
||
style={{ width: 34, height: 34, borderRadius: '50%', background: muted ? 'rgba(255,255,255,.06)' : T.accentSoft, border: `1px solid ${muted ? 'rgba(255,255,255,.1)' : T.accentGlow}`, color: muted ? T.muted : T.accent, fontSize: 14, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||
{muted ? '🔇' : '🔊'}
|
||
</motion.button>
|
||
{/* Restart */}
|
||
<motion.button whileTap={{ scale: .92 }} onClick={reset}
|
||
style={{ width: 34, height: 34, borderRadius: '50%', background: 'rgba(255,255,255,.06)', border: '1px solid rgba(255,255,255,.1)', color: T.muted, fontSize: 13, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>↩</motion.button>
|
||
{/* Prev scene */}
|
||
<motion.button whileTap={{ scale: .92 }} onClick={() => jumpTo(idx - 1)} disabled={idx === 0}
|
||
style={{ width: 34, height: 34, borderRadius: '50%', background: 'rgba(255,255,255,.06)', border: '1px solid rgba(255,255,255,.1)', color: T.muted, fontSize: 11, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, opacity: idx === 0 ? .3 : 1 }}>▲</motion.button>
|
||
|
||
{/* Vertical progress track */}
|
||
<div style={{ flex: 1, width: 4, minHeight: 60, background: 'rgba(255,255,255,.08)', borderRadius: 3, overflow: 'hidden', position: 'relative' }}>
|
||
<motion.div animate={{ height: `${totalPct * 100}%` }} transition={{ duration: .08 }}
|
||
style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: `linear-gradient(to top, ${T.accent}, #4ec99a)`, borderRadius: 3 }} />
|
||
</div>
|
||
|
||
{/* Next scene */}
|
||
<motion.button whileTap={{ scale: .92 }} onClick={() => jumpTo(idx + 1)} disabled={idx >= VIDEO_SEQUENCE.length - 1}
|
||
style={{ width: 34, height: 34, borderRadius: '50%', background: 'rgba(255,255,255,.06)', border: '1px solid rgba(255,255,255,.1)', color: T.muted, fontSize: 11, cursor: 'pointer', fontFamily: 'inherit', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, opacity: idx >= VIDEO_SEQUENCE.length - 1 ? .3 : 1 }}>▼</motion.button>
|
||
|
||
{/* Scene dots */}
|
||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, alignItems: 'center' }}>
|
||
{VIDEO_SEQUENCE.map((v, i) => (
|
||
<motion.button key={v.id} whileTap={{ scale: .9 }} onClick={() => jumpTo(i)} title={v.caption}
|
||
style={{ width: 6, height: 6, borderRadius: '50%', border: 'none', cursor: 'pointer', padding: 0, background: i === idx ? T.accent : i < idx ? T.accent + '66' : 'rgba(255,255,255,.18)' }} />
|
||
))}
|
||
</div>
|
||
|
||
{/* Timecode */}
|
||
<span style={{ fontSize: 9, color: T.dim, fontVariantNumeric: 'tabular-nums', textAlign: 'center', lineHeight: 1.4 }}>
|
||
{mins}:{ss}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
// ── Control bar — vertical strip ──────────────────────────────────────────────
|
||
function ControlBar({ player }: { player: DemoPlayerState }) {
|
||
const { isPlaying, play, pause, reset, prev, next, flow, stepIndex } = player
|
||
const btn: React.CSSProperties = {
|
||
width: 34, height: 34, borderRadius: 9, background: 'rgba(255,255,255,0.06)',
|
||
border: `1px solid ${T.chromeBdr}`, color: T.muted, fontSize: 13, cursor: 'pointer',
|
||
display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'inherit', flexShrink: 0,
|
||
}
|
||
return (
|
||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8, padding: '14px 10px', background: T.chrome2, border: `1px solid ${T.chromeBdr}`, borderRadius: 14, height: '100%', boxSizing: 'border-box' }}>
|
||
{/* Reset */}
|
||
<button onClick={reset} style={btn} title="Reset">↩</button>
|
||
|
||
{/* Play / Pause */}
|
||
<motion.button onClick={isPlaying ? pause : play} whileTap={{ scale: .92 }}
|
||
style={{ ...btn, width: 40, height: 40, borderRadius: 12, background: flow.color + '22', color: flow.color, border: `1px solid ${flow.color}55`, fontSize: 17 }}>
|
||
{isPlaying ? '⏸' : '▶'}
|
||
</motion.button>
|
||
|
||
{/* Prev */}
|
||
<button onClick={prev} disabled={stepIndex === 0} style={{ ...btn, opacity: stepIndex === 0 ? .3 : 1, fontSize: 11 }}>▲</button>
|
||
|
||
{/* Vertical progress track */}
|
||
<div style={{ flex: 1, width: 3, background: 'rgba(255,255,255,0.08)', borderRadius: 2, overflow: 'hidden', position: 'relative', minHeight: 40 }}>
|
||
<motion.div
|
||
style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: flow.color, borderRadius: 2 }}
|
||
animate={{ height: `${player.totalProgress * 100}%` }}
|
||
transition={{ duration: .1 }} />
|
||
</div>
|
||
|
||
{/* Next */}
|
||
<button onClick={next} disabled={stepIndex >= flow.steps.length - 1} style={{ ...btn, opacity: stepIndex >= flow.steps.length - 1 ? .3 : 1, fontSize: 11 }}>▼</button>
|
||
|
||
{/* Step counter */}
|
||
<span style={{ fontSize: 9, color: T.dim, fontVariantNumeric: 'tabular-nums', textAlign: 'center', lineHeight: 1.4 }}>
|
||
{stepIndex + 1}<br /><span style={{ color: T.dim }}>/{flow.steps.length}</span>
|
||
</span>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
// ── Main DemoScreen ───────────────────────────────────────────────────────────
|
||
export default function DemoScreen() {
|
||
const [searchParams, setSearchParams] = useSearchParams()
|
||
|
||
// Video recording mode — ?mode=video
|
||
if (searchParams.get('mode') === 'video') return <VideoPlayer />
|
||
|
||
const rawFlow = searchParams.get('flow')?.toUpperCase() as FlowId | null
|
||
const [flowId, setFlowId] = useState<FlowId>(
|
||
rawFlow && ['A','B','C','D'].includes(rawFlow ?? '') ? rawFlow! : 'A'
|
||
)
|
||
const player = useDemoPlayer(flowId)
|
||
const { flow, step, stepIndex, isPlaying, progress } = player
|
||
|
||
useEffect(() => { setSearchParams({ flow: flowId }, { replace: true }) }, [flowId, setSearchParams])
|
||
useEffect(() => { if (rawFlow) player.play() }, []) // eslint-disable-line
|
||
|
||
const handleFlowChange = (id: FlowId) => { setFlowId(id); player.reset() }
|
||
const SceneComponent = SCENES[step.screen]
|
||
|
||
return (
|
||
<div className="bd-demo-root" style={{ height: '100vh', overflow: 'hidden', background: '#0a1a22', color: T.text2, fontFamily: "'Ubuntu', -apple-system, system-ui, sans-serif", WebkitFontSmoothing: 'antialiased', display: 'flex', flexDirection: 'column' }}>
|
||
|
||
{/* Top bar */}
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '8px 22px', borderBottom: `1px solid ${T.chromeBdr}`, background: T.chrome2, flexShrink: 0, height: 44 }}>
|
||
<div style={{ display: 'flex', alignItems: 'center', gap: 9 }}>
|
||
<svg width="24" height="24" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" style={{ color: T.accent, flexShrink: 0 }}>
|
||
<g fill="none" stroke="currentColor" strokeWidth="3" strokeLinejoin="round" strokeLinecap="round">
|
||
<path d="M32 6 L56 20 L56 46 L32 60 L8 46 L8 20 Z"/>
|
||
<path d="M32 6 L32 32 M8 20 L32 32 M56 20 L32 32"/>
|
||
</g>
|
||
<g fill="currentColor">
|
||
<circle cx="20" cy="26" r="2.4"/><circle cx="20" cy="34" r="2.4"/><circle cx="44" cy="34" r="2.4"/>
|
||
</g>
|
||
</svg>
|
||
<span style={{ fontWeight: 700, fontSize: 13, color: T.text }}>BlackDice</span>
|
||
<span style={{ fontWeight: 700, fontSize: 13, color: T.accent, marginLeft: -5 }}>Angel</span>
|
||
</div>
|
||
<div style={{ width: 1, height: 14, background: T.chromeBdr }} />
|
||
<span style={{ fontSize: 11, color: T.dim }}>Demo Player</span>
|
||
<div style={{ flex: 1 }} />
|
||
<div style={{ display: 'flex', gap: 5 }}>
|
||
{ALL_FLOWS.map(f => (
|
||
<motion.button key={f.id} onClick={() => handleFlowChange(f.id)} whileTap={{ scale: .95 }}
|
||
style={{ padding: '3px 11px', borderRadius: 7, fontSize: 11, fontWeight: 500, cursor: 'pointer', fontFamily: 'inherit', transition: 'all .15s', border: `1px solid ${flowId === f.id ? f.color : T.chromeBdr}`, background: flowId === f.id ? f.color + '20' : 'rgba(255,255,255,0.04)', color: flowId === f.id ? f.color : T.dim }}>
|
||
{f.id} · {f.durationSec}s
|
||
</motion.button>
|
||
))}
|
||
</div>
|
||
</div>
|
||
|
||
{/* Body — fills remaining 100vh */}
|
||
<div style={{ display: 'flex', flex: 1, overflow: 'hidden' }}>
|
||
|
||
{/* Left — steps (scrolls internally) */}
|
||
<div style={{ width: 236, borderRight: `1px solid ${T.chromeBdr}`, padding: '14px 10px', display: 'flex', flexDirection: 'column', gap: 8, overflowY: 'auto', flexShrink: 0, background: 'rgba(255,255,255,0.03)' }}>
|
||
<div>
|
||
<div style={{ fontSize: 12, fontWeight: 600, color: T.text, marginBottom: 1 }}>{flow.title}</div>
|
||
<div style={{ fontSize: 10, color: T.dim }}>{flow.subtitle}</div>
|
||
</div>
|
||
<div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||
{flow.steps.map((s, i) => {
|
||
const isActive = i === stepIndex
|
||
const isDone = i < stepIndex
|
||
return (
|
||
<button key={s.id} onClick={() => player.goTo(i)}
|
||
style={{ display: 'flex', alignItems: 'flex-start', gap: 7, padding: '7px 9px', borderRadius: 9, border: `1px solid ${isActive ? flow.color + '55' : T.chromeBdr}`, background: isActive ? flow.color + '12' : isDone ? 'rgba(255,255,255,.03)' : 'transparent', cursor: 'pointer', textAlign: 'left', width: '100%', fontFamily: 'inherit' }}>
|
||
<div style={{ width: 17, height: 17, borderRadius: '50%', flexShrink: 0, marginTop: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 8, background: isActive ? flow.color : isDone ? T.accent + '30' : 'rgba(255,255,255,.06)', border: `1.5px solid ${isActive ? flow.color : isDone ? T.accent : T.chromeBdr}`, color: isDone ? T.accent : isActive ? '#fff' : T.dim }}>
|
||
{isDone ? '✓' : i + 1}
|
||
</div>
|
||
<div style={{ flex: 1, minWidth: 0 }}>
|
||
<div style={{ fontSize: 11, fontWeight: isActive ? 600 : 400, color: isActive ? T.text : T.muted, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{s.label}</div>
|
||
{isActive && (
|
||
<>
|
||
<div style={{ fontSize: 9, color: T.dim, marginTop: 2, lineHeight: 1.4 }}>{s.caption}</div>
|
||
<div style={{ height: 2, background: 'rgba(255,255,255,.07)', borderRadius: 1, overflow: 'hidden', marginTop: 4 }}>
|
||
{isPlaying && (
|
||
<motion.div style={{ height: '100%', background: flow.color, borderRadius: 1 }}
|
||
animate={{ width: `${progress * 100}%` }} transition={{ duration: .1 }} />
|
||
)}
|
||
</div>
|
||
</>
|
||
)}
|
||
</div>
|
||
<span style={{ fontSize: 9, color: T.dim, flexShrink: 0 }}>{s.durationMs / 1000}s</span>
|
||
</button>
|
||
)
|
||
})}
|
||
</div>
|
||
{step.camera && (
|
||
<div style={{ background: 'rgba(255,255,255,.04)', border: `1px solid ${T.chromeBdr}`, borderRadius: 8, padding: '8px 10px' }}>
|
||
<div style={{ fontSize: 9, color: T.accent, fontWeight: 700, marginBottom: 2, letterSpacing: '.5px' }}>CAMERA</div>
|
||
<div style={{ fontSize: 9, color: T.dim, lineHeight: 1.5 }}>{step.camera}</div>
|
||
</div>
|
||
)}
|
||
</div>
|
||
|
||
{/* Centre — phone natural size + vertical controls to its right */}
|
||
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden', padding: '16px 12px', gap: 10 }}>
|
||
|
||
{/* Phone — fixed natural size, full height of available space up to 700px */}
|
||
<div style={{
|
||
width: 300,
|
||
height: '100%',
|
||
maxHeight: 700,
|
||
flexShrink: 0,
|
||
position: 'relative',
|
||
borderRadius: 34,
|
||
border: '9px solid #1c2a31',
|
||
background: T.bg,
|
||
backgroundImage: T.bgGrad,
|
||
overflow: 'hidden',
|
||
boxShadow: `0 24px 56px rgba(0,0,0,.65), 0 0 0 1px ${flow.color}33`,
|
||
}}>
|
||
{/* Status bar */}
|
||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '10px 18px 4px', fontSize: 10, color: T.muted }}>
|
||
<span style={{ fontWeight: 600 }}>9:41</span>
|
||
<span style={{ fontSize: 8, fontWeight: 800, color: flow.color, background: flow.color + '22', padding: '1px 6px', borderRadius: 4, letterSpacing: '.5px' }}>DEMO</span>
|
||
<span>▲ 100%</span>
|
||
</div>
|
||
|
||
{/* Content */}
|
||
<div style={{ position: 'absolute', top: 34, bottom: 56, left: 0, right: 0, overflowY: 'auto', padding: '6px 13px 8px', WebkitOverflowScrolling: 'touch' }}>
|
||
<AnimatePresence mode="wait">
|
||
<motion.div key={`${flowId}-${stepIndex}`}
|
||
initial={{ opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0, x: 8 }}
|
||
transition={{ duration: .2, ease: EASE_OUT }}
|
||
style={{ height: '100%' }}>
|
||
{SceneComponent ? <SceneComponent /> : <div style={{ color: T.dim, textAlign: 'center', padding: 40 }}>—</div>}
|
||
</motion.div>
|
||
</AnimatePresence>
|
||
</div>
|
||
|
||
{/* Tab bar */}
|
||
<div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 56, background: T.surfaceStr, borderTop: `1px solid ${T.border}`, display: 'flex', alignItems: 'center', justifyContent: 'space-around', paddingBottom: 2 }}>
|
||
{([
|
||
{ Icon: IconHome, label: 'Home', active: ['home','alert-toast','resolved'].includes(step.screen) },
|
||
{ Icon: IconUsers, label: 'Family', active: ['emma-profile','notif-panel'].includes(step.screen) },
|
||
{ Icon: IconApps, label: 'Devices', active: ['device-ps5','devices-list','scan-running'].includes(step.screen) },
|
||
{ Icon: IconSliders, label: 'Controls', active: ['timeline','ip-detail','scope'].includes(step.screen) },
|
||
{ Icon: IconBell, label: 'Alerts', active: false },
|
||
] as const).map(tab => (
|
||
<div key={tab.label} style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, fontSize: 9, color: tab.active ? T.accent : T.dim, cursor: 'pointer' }}>
|
||
<tab.Icon size={18} style={{ color: tab.active ? T.accent : T.dim }} />
|
||
{tab.label}
|
||
</div>
|
||
))}
|
||
</div>
|
||
</div>
|
||
|
||
{/* Vertical control strip */}
|
||
<div style={{ width: 54, height: '100%', maxHeight: 700, flexShrink: 0 }}>
|
||
<ControlBar player={player} />
|
||
</div>
|
||
</div>
|
||
|
||
{/* Right — info (scrolls internally) */}
|
||
<div style={{ width: 210, borderLeft: `1px solid ${T.chromeBdr}`, padding: '14px 12px', display: 'flex', flexDirection: 'column', gap: 12, flexShrink: 0, overflowY: 'auto', background: 'rgba(255,255,255,0.03)' }}>
|
||
<div>
|
||
<div style={{ fontSize: 9, color: T.dim, fontWeight: 700, letterSpacing: '.6px', textTransform: 'uppercase', marginBottom: 4 }}>Scene</div>
|
||
<div style={{ fontSize: 12, fontWeight: 600, color: T.text, marginBottom: 3 }}>{step.label}</div>
|
||
<div style={{ fontSize: 10, color: T.dim, lineHeight: 1.5 }}>{step.caption}</div>
|
||
</div>
|
||
<div style={{ height: 1, background: T.chromeBdr }} />
|
||
<div>
|
||
<div style={{ fontSize: 9, color: T.dim, fontWeight: 700, letterSpacing: '.6px', textTransform: 'uppercase', marginBottom: 4 }}>Timing</div>
|
||
<div style={{ fontSize: 12, color: T.text2 }}>{step.durationMs / 1000}s this scene</div>
|
||
<div style={{ fontSize: 10, color: T.dim, marginTop: 2 }}>{flow.durationSec}s total · Flow {flow.id}</div>
|
||
</div>
|
||
<div style={{ height: 1, background: T.chromeBdr }} />
|
||
<div>
|
||
<div style={{ fontSize: 9, color: T.dim, fontWeight: 700, letterSpacing: '.6px', textTransform: 'uppercase', marginBottom: 4 }}>Recording tip</div>
|
||
<div style={{ fontSize: 10, color: T.dim, lineHeight: 1.6 }}>
|
||
Press ▶ to auto-advance. Record at 60fps 1080p. Direct URL: <code style={{ color: T.accent, fontSize: 9 }}>?flow={flowId}</code>
|
||
</div>
|
||
</div>
|
||
<div style={{ marginTop: 'auto', padding: '10px 12px', background: flow.color + '12', border: `1px solid ${flow.color}33`, borderRadius: 10 }}>
|
||
<div style={{ fontSize: 11, fontWeight: 700, color: flow.color }}>Flow {flow.id} · {flow.durationSec}s</div>
|
||
<div style={{ fontSize: 9, color: T.dim, marginTop: 2, lineHeight: 1.5 }}>{flow.subtitle}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|