Add family safe-zone location demo, wire into Mobile SDK demo slider
Cinematic 30s player showing safe-zone creation and leave-zone alerts, matching the existing threat-demo pattern. Added as a 6th rotating slide in ThreatDemosSlider (live on /mobile-sdk and /threat-demos), plus a standalone /location-demo route for recording. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,562 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
|
import {
|
||||||
|
IconHome, IconUsers, IconApps, IconSliders, IconBell,
|
||||||
|
IconPin, IconSchool, IconChild, IconCheck, IconAlert, IconPlus, IconMap,
|
||||||
|
} from '../components/Icons'
|
||||||
|
import '../demo.css'
|
||||||
|
|
||||||
|
const EASE_OUT = [0.23, 1, 0.32, 1] as const
|
||||||
|
const SPRING = { type: 'spring', stiffness: 340, damping: 28 } as const
|
||||||
|
const PHONE_SCALE = 0.88
|
||||||
|
|
||||||
|
const T = {
|
||||||
|
bg: '#013B49',
|
||||||
|
bgGrad: 'radial-gradient(140% 90% at 50% 0%, #075466 0%, #013B49 55%, #01303b 100%)',
|
||||||
|
surface2: 'rgba(255,255,255,0.07)',
|
||||||
|
surface3: 'rgba(255,255,255,0.10)',
|
||||||
|
surfaceStr: '#0a4856',
|
||||||
|
border: 'rgba(255,255,255,0.09)',
|
||||||
|
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.16)',
|
||||||
|
warn: '#ffb56b',
|
||||||
|
warnSoft: 'rgba(255,181,107,0.16)',
|
||||||
|
success: '#4ec99a',
|
||||||
|
successSoft: 'rgba(78,201,154,0.16)',
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Timeline (30s total) ─────────────────────────────────────────────────────
|
||||||
|
// P1 Live map (calm) → P2 Draw a safe zone → P3 Zone saved → P4 Jack leaves the
|
||||||
|
// zone → P5 Alert detail → P6 Resolution → P7 Book-a-demo end card
|
||||||
|
const PHASES = {
|
||||||
|
p1: 3500,
|
||||||
|
p2: 8500,
|
||||||
|
p3: 11500,
|
||||||
|
p4: 18500,
|
||||||
|
p5: 23500,
|
||||||
|
p6: 27000,
|
||||||
|
total: 30000,
|
||||||
|
}
|
||||||
|
|
||||||
|
function phaseOf(elapsed: number): number {
|
||||||
|
if (elapsed < PHASES.p1) return 1
|
||||||
|
if (elapsed < PHASES.p2) return 2
|
||||||
|
if (elapsed < PHASES.p3) return 3
|
||||||
|
if (elapsed < PHASES.p4) return 4
|
||||||
|
if (elapsed < PHASES.p5) return 5
|
||||||
|
if (elapsed < PHASES.p6) return 6
|
||||||
|
return 7
|
||||||
|
}
|
||||||
|
|
||||||
|
const PHASE_LABEL = ['', 'Live Map', 'Safe Zone', 'Zone Saved', 'Leaving Zone', 'Alert', 'Resolved', 'Book a Demo']
|
||||||
|
|
||||||
|
const VO_CUES = [
|
||||||
|
{ at: 300, text: 'Parents can see exactly where their family is, right from the app.' },
|
||||||
|
{ at: 3800, text: 'Creating a safe zone takes seconds — drop a pin, and draw the boundary.' },
|
||||||
|
{ at: 8800, text: 'Once it’s saved, we keep watch over that boundary, day and night.' },
|
||||||
|
{ at: 11800, text: 'The moment Jack leaves the Park zone, we notify the parent immediately.' },
|
||||||
|
{ at: 23800, text: 'One tap shows exactly where he is — peace of mind, one message away. Book a demo today.' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const TABS = [
|
||||||
|
{ Icon: IconHome, label: 'Home' },
|
||||||
|
{ Icon: IconUsers, label: 'Family' },
|
||||||
|
{ Icon: IconMap, label: 'Map' },
|
||||||
|
{ Icon: IconSliders, label: 'Controls' },
|
||||||
|
{ Icon: IconBell, label: 'Alerts' },
|
||||||
|
] as const
|
||||||
|
|
||||||
|
function HexLogo({ size = 52 }: { 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 EndCard() {
|
||||||
|
return (
|
||||||
|
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.5 }}
|
||||||
|
style={{ position: 'absolute', inset: 0, zIndex: 60, background: T.bg, backgroundImage: T.bgGrad, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 16, padding: '0 24px', textAlign: 'center' }}>
|
||||||
|
<motion.div initial={{ scale: 0.6, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} transition={SPRING} style={{ position: 'relative' }}>
|
||||||
|
<motion.div animate={{ scale: [1, 1.3, 1], opacity: [0.25, 0.05, 0.25] }} transition={{ duration: 3, repeat: Infinity }}
|
||||||
|
style={{ position: 'absolute', inset: -16, borderRadius: '50%', background: T.accent, filter: 'blur(12px)' }} />
|
||||||
|
<div style={{ position: 'relative' }}><HexLogo size={52} /></div>
|
||||||
|
</motion.div>
|
||||||
|
<div>
|
||||||
|
<div style={{ fontSize: 20, fontWeight: 700, color: T.text, letterSpacing: '-.4px' }}>BlackDice</div>
|
||||||
|
<div style={{ fontSize: 11, color: T.muted, marginTop: 4, letterSpacing: '.3px' }}>Powered by BlackDice</div>
|
||||||
|
</div>
|
||||||
|
<motion.div initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.35 }}
|
||||||
|
style={{ background: T.accent, color: '#fff', fontSize: 13, fontWeight: 600, padding: '11px 28px', borderRadius: 100, boxShadow: `0 10px 28px ${T.accent}55` }}>
|
||||||
|
Book a Demo
|
||||||
|
</motion.div>
|
||||||
|
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 0.6 }}
|
||||||
|
style={{ fontSize: 10.5, color: T.muted, letterSpacing: '.4px' }}>blackdice.com</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Map scene (phases 1–4) ───────────────────────────────────────────────────
|
||||||
|
function MapScene({ elapsed, phase }: { elapsed: number; phase: number }) {
|
||||||
|
const drawing = phase === 2
|
||||||
|
const pinDropped = elapsed >= 4100
|
||||||
|
const circleOut = elapsed >= 4900
|
||||||
|
const labelTyped = elapsed >= 6300
|
||||||
|
const saveShown = elapsed >= 7500
|
||||||
|
const saveTapped = elapsed >= 8000
|
||||||
|
const zoneSaved = elapsed >= PHASES.p2
|
||||||
|
const walking = elapsed >= 11800
|
||||||
|
const breached = elapsed >= 14800
|
||||||
|
const alerted = elapsed >= 15200
|
||||||
|
|
||||||
|
const dotLeft = walking ? '61%' : '60%'
|
||||||
|
const dotTop = walking ? '75%' : '57%'
|
||||||
|
|
||||||
|
const zoneName = 'Park'
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ position: 'absolute', inset: 0, overflow: 'hidden' }}>
|
||||||
|
{/* stylised map base */}
|
||||||
|
<svg viewBox="0 0 275 600" width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
|
||||||
|
<rect width="275" height="600" fill={T.bg} />
|
||||||
|
<path d="M-10 90 C 70 40, 140 55, 275 130" stroke="rgba(111,169,247,.20)" strokeWidth="16" fill="none" />
|
||||||
|
<g stroke="rgba(255,255,255,.05)" strokeWidth="1">
|
||||||
|
<line x1="0" y1="220" x2="275" y2="230" />
|
||||||
|
<line x1="0" y1="470" x2="275" y2="460" />
|
||||||
|
<line x1="60" y1="0" x2="70" y2="600" />
|
||||||
|
<line x1="205" y1="0" x2="195" y2="600" />
|
||||||
|
</g>
|
||||||
|
<g fill="rgba(255,255,255,.035)">
|
||||||
|
<rect x="18" y="240" width="34" height="26" rx="3" />
|
||||||
|
<rect x="90" y="255" width="40" height="30" rx="3" />
|
||||||
|
<rect x="210" y="200" width="30" height="40" rx="3" />
|
||||||
|
<rect x="30" y="490" width="46" height="28" rx="3" />
|
||||||
|
</g>
|
||||||
|
<ellipse cx="165" cy="340" rx="98" ry="82" fill="rgba(78,201,154,0.09)" />
|
||||||
|
|
||||||
|
{/* safe-zone boundary */}
|
||||||
|
<motion.circle
|
||||||
|
cx="165" cy="340"
|
||||||
|
initial={{ r: 0, opacity: 0 }}
|
||||||
|
animate={{ r: circleOut || zoneSaved ? 55 : 0, opacity: circleOut || zoneSaved ? 1 : 0 }}
|
||||||
|
transition={{ duration: 1.1, ease: EASE_OUT }}
|
||||||
|
fill={T.accentSoft}
|
||||||
|
stroke={breached ? T.warn : T.accent}
|
||||||
|
strokeWidth={2}
|
||||||
|
strokeDasharray={zoneSaved && !drawing ? undefined : '5 4'}
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
{/* Home pin */}
|
||||||
|
<motion.div initial={{ opacity: 0, y: -6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.2 }}
|
||||||
|
style={{ position: 'absolute', left: '25%', top: '25%', transform: 'translate(-50%,-100%)', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2 }}>
|
||||||
|
<div style={{ width: 26, height: 26, borderRadius: '50%', background: T.surfaceStr, border: `1.5px solid ${T.accent}`, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 4px 12px rgba(0,0,0,.4)' }}>
|
||||||
|
<IconHome size={13} style={{ color: T.accent }} />
|
||||||
|
</div>
|
||||||
|
<span style={{ fontSize: 8.5, color: T.text2, background: 'rgba(0,0,0,.4)', borderRadius: 5, padding: '1px 5px' }}>Home</span>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
{/* School pin */}
|
||||||
|
<motion.div initial={{ opacity: 0, y: -6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.3 }}
|
||||||
|
style={{ position: 'absolute', left: '73%', top: '18%', transform: 'translate(-50%,-100%)', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2 }}>
|
||||||
|
<div style={{ width: 24, height: 24, borderRadius: '50%', background: T.surfaceStr, border: `1.5px solid ${T.dim}`, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 4px 12px rgba(0,0,0,.4)' }}>
|
||||||
|
<IconSchool size={12} style={{ color: T.text2 }} />
|
||||||
|
</div>
|
||||||
|
<span style={{ fontSize: 8.5, color: T.muted, background: 'rgba(0,0,0,.4)', borderRadius: 5, padding: '1px 5px' }}>School</span>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
{/* drop-pin during drawing */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{drawing && pinDropped && (
|
||||||
|
<motion.div key="drop" initial={{ opacity: 0, y: -18, scale: 0.6 }} animate={{ opacity: 1, y: 0, scale: 1 }} transition={SPRING}
|
||||||
|
style={{ position: 'absolute', left: '60%', top: '57%', transform: 'translate(-50%,-100%)', zIndex: 5 }}>
|
||||||
|
<IconPin size={26} style={{ color: T.accent, filter: `drop-shadow(0 4px 8px ${T.accentGlow})` }} />
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{/* Jack (family member) dot */}
|
||||||
|
{(phase >= 3) && (
|
||||||
|
<motion.div
|
||||||
|
animate={{ left: dotLeft, top: dotTop }}
|
||||||
|
transition={{ duration: 3, ease: 'easeInOut' }}
|
||||||
|
style={{ position: 'absolute', transform: 'translate(-50%,-50%)', zIndex: 6 }}>
|
||||||
|
<motion.div animate={breached ? { scale: [1, 1.35, 1] } : {}} transition={{ duration: 0.9, repeat: breached ? Infinity : 0 }}
|
||||||
|
style={{ width: 22, height: 22, borderRadius: '50%', background: breached ? T.warn : T.accent, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: `0 0 0 4px ${breached ? T.warnSoft : T.accentSoft}` }}>
|
||||||
|
<IconChild size={12} style={{ color: '#fff' }} />
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Header chip */}
|
||||||
|
<div style={{ position: 'absolute', top: 46, left: 14, right: 14, display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
|
<span style={{ fontSize: 13, fontWeight: 700, color: T.text, background: 'rgba(0,0,0,.32)', backdropFilter: 'blur(8px)', borderRadius: 10, padding: '5px 10px' }}>
|
||||||
|
{drawing ? 'Add a safe zone' : 'Family · Live map'}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Zone label input while drawing */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{drawing && circleOut && (
|
||||||
|
<motion.div key="label" initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0 }}
|
||||||
|
style={{ position: 'absolute', left: '50%', top: '78%', transform: 'translateX(-50%)', background: T.surfaceStr, border: `1px solid ${T.border}`, borderRadius: 10, padding: '7px 12px', display: 'flex', alignItems: 'center', gap: 6, minWidth: 120 }}>
|
||||||
|
<IconPin size={12} style={{ color: T.accent, flexShrink: 0 }} />
|
||||||
|
<span style={{ fontSize: 12, color: T.text }}>
|
||||||
|
{labelTyped
|
||||||
|
? zoneName.split('').map((c, i) => (
|
||||||
|
<motion.span key={i} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: i * 0.06 }}>{c}</motion.span>
|
||||||
|
))
|
||||||
|
: <span style={{ color: T.dim }}>Zone name…</span>}
|
||||||
|
</span>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{/* Save button while drawing */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{drawing && saveShown && (
|
||||||
|
<motion.div key="save" initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -6 }}
|
||||||
|
transition={{ ease: EASE_OUT }}
|
||||||
|
style={{ position: 'absolute', left: 14, right: 14, bottom: 72, zIndex: 15 }}>
|
||||||
|
<motion.div animate={saveTapped ? { scale: [1, 0.94, 1] } : {}} transition={{ duration: 0.4 }}
|
||||||
|
style={{ background: T.accent, color: '#fff', fontSize: 13, fontWeight: 600, borderRadius: 12, padding: '11px 0', textAlign: 'center', boxShadow: `0 8px 22px ${T.accent}55` }}>
|
||||||
|
Save safe zone
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{/* Saved confirmation card (phase 3) */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{phase === 3 && (
|
||||||
|
<motion.div key="saved" initial={{ opacity: 0, y: 14 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0 }} transition={{ ease: EASE_OUT }}
|
||||||
|
style={{ position: 'absolute', left: 14, right: 14, bottom: 72, zIndex: 15, background: T.surfaceStr, border: `1px solid ${T.border}`, borderRadius: 14, padding: '11px 13px', boxShadow: '0 8px 26px rgba(0,0,0,.4)' }}>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 }}>
|
||||||
|
<div style={{ width: 22, height: 22, borderRadius: '50%', background: T.success, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||||||
|
<IconCheck size={12} style={{ color: '#fff' }} />
|
||||||
|
</div>
|
||||||
|
<span style={{ fontSize: 12.5, fontWeight: 600, color: T.text }}>Park · 200m radius</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ fontSize: 10.5, color: T.muted, paddingLeft: 30 }}>Monitoring on · Arrive & leave alerts</div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{/* Time chip during the leaving-zone phase */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{phase === 4 && (
|
||||||
|
<motion.div key="time" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}
|
||||||
|
style={{ position: 'absolute', top: 78, left: 14, fontSize: 10, color: T.muted, background: 'rgba(0,0,0,.32)', borderRadius: 8, padding: '3px 8px' }}>
|
||||||
|
Later · 2:47 PM
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
|
||||||
|
{/* Notification banner */}
|
||||||
|
<AnimatePresence>
|
||||||
|
{alerted && phase === 4 && (
|
||||||
|
<motion.div key="notif" initial={{ y: -18, opacity: 0, scale: 0.97 }} animate={{ y: 0, opacity: 1, scale: 1 }} transition={SPRING}
|
||||||
|
style={{ position: 'absolute', top: 78, left: 14, right: 14, background: T.warnSoft, border: `1px solid ${T.warn}55`, borderRadius: 12, padding: '11px 12px', display: 'flex', alignItems: 'flex-start', gap: 10, boxShadow: '0 6px 22px rgba(0,0,0,.35)' }}>
|
||||||
|
<motion.div animate={{ scale: [1, 1.08, 1] }} transition={{ duration: 1.4, repeat: Infinity }}
|
||||||
|
style={{ width: 32, height: 32, borderRadius: 9, background: T.warn, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
|
||||||
|
<IconPin size={17} style={{ color: '#fff' }} />
|
||||||
|
</motion.div>
|
||||||
|
<div style={{ flex: 1, fontSize: 12, lineHeight: 1.45 }}>
|
||||||
|
<strong style={{ color: T.text, display: 'block', marginBottom: 1 }}>Jack left Park</strong>
|
||||||
|
<span style={{ color: T.text2 }}>202 Meadow Rd · 2:47 PM</span>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function DetailContent({ tapped }: { tapped: boolean }) {
|
||||||
|
return (
|
||||||
|
<motion.div initial={{ opacity: 0, x: 14 }} animate={{ opacity: 1, x: 0 }} transition={{ ease: EASE_OUT }} style={{ padding: '52px 13px 0' }}>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 14 }}>
|
||||||
|
<span style={{ fontSize: 18, color: T.muted }}>‹</span>
|
||||||
|
<span style={{ fontSize: 15, fontWeight: 600, color: T.text }}>Alert details</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ background: T.warnSoft, borderRadius: 14, padding: '16px 14px', textAlign: 'center', marginBottom: 12 }}>
|
||||||
|
<div style={{ width: 48, height: 48, borderRadius: 13, background: T.warn, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px' }}>
|
||||||
|
<IconPin size={24} style={{ color: '#fff' }} />
|
||||||
|
</div>
|
||||||
|
<div style={{ fontSize: 14, fontWeight: 700, color: T.text }}>Jack left Park</div>
|
||||||
|
<div style={{ fontSize: 11, color: T.warn, marginTop: 3 }}>2:47 PM · 0.4 mi from zone centre</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ background: T.surface2, border: `1px solid ${T.border}`, borderRadius: 14, padding: '4px 14px', marginBottom: 12 }}>
|
||||||
|
{[
|
||||||
|
'Left the Park safe-zone boundary',
|
||||||
|
'Live location updating every 30 seconds',
|
||||||
|
'You’ll be notified again if he returns',
|
||||||
|
].map((line, i) => (
|
||||||
|
<motion.div key={line} initial={{ opacity: 0, x: -6 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: 0.15 + i * 0.1 }}
|
||||||
|
style={{ display: 'flex', alignItems: 'flex-start', gap: 9, padding: '9px 0', borderTop: i === 0 ? 'none' : `1px solid ${T.border}`, fontSize: 11.5, color: T.text2, lineHeight: 1.4 }}>
|
||||||
|
<span style={{ width: 5, height: 5, borderRadius: '50%', background: T.warn, marginTop: 5, flexShrink: 0 }} />{line}
|
||||||
|
</motion.div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||||
|
<motion.div animate={tapped ? { scale: [1, 0.96, 1] } : {}} transition={{ duration: 0.4 }}
|
||||||
|
style={{ fontSize: 13, fontWeight: 600, borderRadius: 12, padding: '11px 14px', border: 'none', background: T.warn, color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 7, boxShadow: `0 6px 20px ${T.warn}55` }}>
|
||||||
|
💬 Message Jack
|
||||||
|
</motion.div>
|
||||||
|
<div style={{ fontSize: 13, fontWeight: 600, borderRadius: 12, padding: '11px 14px', border: `1px solid ${T.border}`, color: T.text2, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 7 }}>
|
||||||
|
📍 View live location
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResolutionContent() {
|
||||||
|
return (
|
||||||
|
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} style={{ paddingTop: 58, padding: '58px 13px 0' }}>
|
||||||
|
<motion.div initial={{ scale: 0.94 }} animate={{ scale: 1 }} transition={SPRING}
|
||||||
|
style={{ background: T.successSoft, borderRadius: 16, padding: '20px 14px', textAlign: 'center', marginBottom: 12 }}>
|
||||||
|
<motion.div initial={{ scale: 0, rotate: -20 }} animate={{ scale: 1, rotate: 0 }} transition={{ ...SPRING, delay: 0.1 }}
|
||||||
|
style={{ width: 54, height: 54, borderRadius: '50%', background: T.success, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 12px' }}>
|
||||||
|
<IconCheck size={26} style={{ color: '#fff' }} />
|
||||||
|
</motion.div>
|
||||||
|
<div style={{ fontSize: 15, fontWeight: 700, color: T.text }}>Message sent</div>
|
||||||
|
<div style={{ fontSize: 11.5, color: T.success, marginTop: 4 }}>Jack confirmed he’s walking home</div>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.2 }}
|
||||||
|
style={{ background: T.surface2, border: `1px solid ${T.border}`, borderRadius: 14, padding: '12px 14px', fontSize: 12, color: T.text2, display: 'flex', alignItems: 'center', gap: 9 }}>
|
||||||
|
<span style={{ color: T.success }}>›</span>Jack · 🟢 will re-enter Home zone in 8 min
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function LocationPhone({ elapsed, phase }: { elapsed: number; phase: number }) {
|
||||||
|
const tapped = elapsed >= PHASES.p4 + 2600
|
||||||
|
return (
|
||||||
|
<div style={{
|
||||||
|
width: 275, height: 600, flexShrink: 0, position: 'relative',
|
||||||
|
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)`,
|
||||||
|
}}>
|
||||||
|
<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)' }}>
|
||||||
|
{phase <= 4 && <MapScene elapsed={elapsed} phase={phase} />}
|
||||||
|
{phase === 5 && <div style={{ position: 'absolute', inset: 0, overflowY: 'auto' }}><DetailContent tapped={tapped} /></div>}
|
||||||
|
{phase >= 6 && phase < 7 && <div style={{ position: 'absolute', inset: 0, overflowY: 'auto' }}><ResolutionContent /></div>}
|
||||||
|
|
||||||
|
{/* status bar */}
|
||||||
|
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '16px 26px 8px', fontSize: 11, color: T.text, fontWeight: 600, zIndex: 20 }}>
|
||||||
|
<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 }} />
|
||||||
|
|
||||||
|
{phase <= 4 && (
|
||||||
|
<div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 58, background: 'rgba(10,72,86,.72)', backdropFilter: 'blur(10px)', borderTop: `1px solid ${T.border}`, display: 'flex', alignItems: 'center', justifyContent: 'space-around', paddingBottom: 6, zIndex: 20 }}>
|
||||||
|
{TABS.map((t, i) => (
|
||||||
|
<div key={t.label} style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, fontSize: 9, color: i === 2 ? T.accent : T.dim }}>
|
||||||
|
<t.Icon size={18} style={{ color: i === 2 ? T.accent : T.dim }} />{t.label}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{phase === 1 && (
|
||||||
|
<motion.div initial={{ scale: 0, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} transition={{ delay: 2.6, ...SPRING }}
|
||||||
|
style={{ position: 'absolute', right: 14, bottom: 70, width: 40, height: 40, borderRadius: '50%', background: T.accent, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: `0 8px 20px ${T.accent}66` }}>
|
||||||
|
<IconPlus size={18} style={{ color: '#fff' }} />
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{phase >= 7 && <EndCard />}
|
||||||
|
|
||||||
|
<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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Cinematic player ─────────────────────────────────────────────────────────
|
||||||
|
export function LocationCinematic({ autoPlay = false, chrome = true, bare = false }: {
|
||||||
|
autoPlay?: boolean; chrome?: boolean; bare?: boolean
|
||||||
|
}) {
|
||||||
|
const [elapsed, setElapsed] = useState(0)
|
||||||
|
const [started, setStarted] = useState(false)
|
||||||
|
const [muted, setMuted] = useState(false)
|
||||||
|
const rafRef = useRef(0)
|
||||||
|
const t0Ref = useRef(0)
|
||||||
|
const spokenIdx = useRef(0)
|
||||||
|
|
||||||
|
const phase = phaseOf(elapsed)
|
||||||
|
const cancelSpeech = () => { try { window.speechSynthesis && window.speechSynthesis.cancel() } catch { /* noop */ } }
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
setStarted(true)
|
||||||
|
t0Ref.current = performance.now() - elapsed
|
||||||
|
const tick = () => {
|
||||||
|
const now = performance.now() - t0Ref.current
|
||||||
|
setElapsed(now)
|
||||||
|
if (now < PHASES.total) rafRef.current = requestAnimationFrame(tick)
|
||||||
|
else setStarted(false)
|
||||||
|
}
|
||||||
|
rafRef.current = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
function pause() { setStarted(false); cancelAnimationFrame(rafRef.current); cancelSpeech() }
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoPlay) return
|
||||||
|
const id = setTimeout(() => start(), 450)
|
||||||
|
return () => clearTimeout(id)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => () => { cancelAnimationFrame(rafRef.current); cancelSpeech() }, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (muted) cancelSpeech()
|
||||||
|
}, [muted])
|
||||||
|
|
||||||
|
// Voiceover — fires each cue once elapsed crosses its `at` threshold
|
||||||
|
useEffect(() => {
|
||||||
|
if (!started || muted) return
|
||||||
|
if (spokenIdx.current >= VO_CUES.length) return
|
||||||
|
const cue = VO_CUES[spokenIdx.current]
|
||||||
|
if (elapsed < cue.at) return
|
||||||
|
spokenIdx.current += 1
|
||||||
|
const synth = window.speechSynthesis
|
||||||
|
if (!synth) return
|
||||||
|
|
||||||
|
const speakNow = () => {
|
||||||
|
synth.cancel()
|
||||||
|
const u = new SpeechSynthesisUtterance(cue.text)
|
||||||
|
u.lang = 'en-GB'; u.rate = 0.82; u.pitch = 0.84; u.volume = 0.75
|
||||||
|
u.onerror = () => {}
|
||||||
|
const vs = synth.getVoices()
|
||||||
|
const v = vs.find((x) => /en-GB/i.test(x.lang) && /natural|neural|online/i.test(x.name) && /libby|sonia|hazel|serena/i.test(x.name))
|
||||||
|
|| vs.find((x) => /en-GB/i.test(x.lang) && /natural|neural|online/i.test(x.name))
|
||||||
|
|| vs.find((x) => /en-GB/i.test(x.lang) && /libby|sonia|hazel|serena/i.test(x.name))
|
||||||
|
|| vs.find((x) => /en-GB/i.test(x.lang) && /female|google uk english female|samantha/i.test(x.name))
|
||||||
|
|| vs.find((x) => /en-GB/i.test(x.lang))
|
||||||
|
|| vs.find((x) => /^en/i.test(x.lang))
|
||||||
|
if (v) u.voice = v
|
||||||
|
synth.speak(u)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (synth.getVoices().length === 0) {
|
||||||
|
const onReady = () => { synth.removeEventListener('voiceschanged', onReady); speakNow() }
|
||||||
|
synth.addEventListener('voiceschanged', onReady)
|
||||||
|
} else {
|
||||||
|
speakNow()
|
||||||
|
}
|
||||||
|
}, [elapsed, started, muted])
|
||||||
|
|
||||||
|
const curVo = VO_CUES.slice().reverse().find((c) => elapsed >= c.at)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bd-demo-root" style={{
|
||||||
|
position: 'absolute', inset: 0, overflow: 'hidden',
|
||||||
|
background: bare ? 'transparent' : 'radial-gradient(130% 90% at 50% 0%, #075466 0%, #013B49 38%, #021b22 72%, #0a1a22 100%)',
|
||||||
|
fontFamily: "'Ubuntu', -apple-system, system-ui, sans-serif", WebkitFontSmoothing: 'antialiased',
|
||||||
|
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
|
||||||
|
}}>
|
||||||
|
{!bare && (
|
||||||
|
<div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', background: 'radial-gradient(120% 80% at 50% 45%, transparent 50%, rgba(0,0,0,.5) 100%)' }} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{chrome && (
|
||||||
|
<div 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 }}>SDK · LOCATION</span>
|
||||||
|
<span style={{ width: 14, height: 1, background: 'rgba(255,255,255,.2)' }} />
|
||||||
|
<span style={{ fontSize: 11, color: 'rgba(255,255,255,.65)' }}>{PHASE_LABEL[phase]}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{started && chrome && (
|
||||||
|
<div style={{ position: 'absolute', top: 18, right: 22, display: 'flex', alignItems: 'center', gap: 6, background: 'rgba(0,0,0,.5)', border: '1px solid rgba(255,255,255,.1)', borderRadius: 100, padding: '6px 12px', zIndex: 60 }}>
|
||||||
|
<motion.span animate={{ opacity: [1, 0, 1] }} transition={{ duration: 1.2, repeat: Infinity }} style={{ width: 8, height: 8, borderRadius: '50%', background: '#ef4444', display: 'inline-block' }} />
|
||||||
|
<span style={{ fontSize: 10, fontWeight: 700, color: '#fff' }}>REC</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div style={{ flex: 1, minHeight: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 1, padding: '8px 0' }}>
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 14 }}>
|
||||||
|
<motion.div style={{ perspective: 1300 }}>
|
||||||
|
<motion.div animate={{ rotateY: -3, rotateX: 2 }} transition={{ duration: 1.1, ease: EASE_OUT }} style={{ transformStyle: 'preserve-3d' }}>
|
||||||
|
<motion.div animate={{ y: [0, -7, 0] }} transition={{ duration: 5, repeat: Infinity, ease: 'easeInOut' }}
|
||||||
|
onClick={() => (started ? pause() : start())}
|
||||||
|
style={{ position: 'relative', width: 275 * PHONE_SCALE, height: 600 * PHONE_SCALE, cursor: 'pointer' }}>
|
||||||
|
<div style={{ position: 'absolute', inset: '8% 14%', borderRadius: '50%', background: T.accent, opacity: 0.16, filter: 'blur(55px)', zIndex: 0 }} />
|
||||||
|
<div style={{ transform: `scale(${PHONE_SCALE})`, transformOrigin: 'top left' }}>
|
||||||
|
<LocationPhone elapsed={elapsed} phase={phase} />
|
||||||
|
</div>
|
||||||
|
<motion.button whileTap={{ scale: 0.92 }}
|
||||||
|
onClick={(e) => { e.stopPropagation(); setMuted((m) => !m) }}
|
||||||
|
title={muted ? 'Unmute' : 'Mute'}
|
||||||
|
style={{
|
||||||
|
position: 'absolute', top: 16, right: 16, zIndex: 55,
|
||||||
|
width: 32, height: 32, borderRadius: '50%',
|
||||||
|
background: 'rgba(0,0,0,.45)', backdropFilter: 'blur(10px)',
|
||||||
|
border: `1px solid ${muted ? 'rgba(255,255,255,.16)' : T.accentGlow}`,
|
||||||
|
color: muted ? 'rgba(255,255,255,.7)' : T.accent, fontSize: 13,
|
||||||
|
cursor: 'pointer', fontFamily: 'inherit',
|
||||||
|
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||||
|
}}>
|
||||||
|
{muted ? '🔇' : '🔊'}
|
||||||
|
</motion.button>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
<div style={{ position: 'relative', width: 320, maxWidth: '86vw', height: 46 }}>
|
||||||
|
<AnimatePresence mode="wait">
|
||||||
|
<motion.div key={phase} initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }} transition={{ duration: 0.5, ease: EASE_OUT }}
|
||||||
|
style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'flex-start', justifyContent: 'center', textAlign: 'center' }}>
|
||||||
|
<span style={{ fontSize: 14.5, color: 'rgba(255,255,255,.9)', lineHeight: 1.5 }}>{curVo?.text}</span>
|
||||||
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default export: full-screen single player (mirrors /threat-demo/:id)
|
||||||
|
export default function LocationDemo() {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
return (
|
||||||
|
<div style={{ position: 'relative', height: '100vh' }}>
|
||||||
|
<button
|
||||||
|
onClick={() => navigate('/')}
|
||||||
|
style={{
|
||||||
|
position: 'fixed', top: 18, left: 24, zIndex: 80,
|
||||||
|
display: 'inline-flex', alignItems: 'center', gap: 7,
|
||||||
|
fontFamily: "'Ubuntu', system-ui, sans-serif", fontSize: 13, fontWeight: 500,
|
||||||
|
color: 'rgba(255,255,255,.75)', background: 'rgba(0,0,0,.45)', backdropFilter: 'blur(10px)',
|
||||||
|
border: '1px solid rgba(255,255,255,.12)', borderRadius: 100, padding: '7px 14px', cursor: 'pointer',
|
||||||
|
}}>
|
||||||
|
← Back to site
|
||||||
|
</button>
|
||||||
|
<LocationCinematic />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,12 +1,34 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { AnimatePresence, motion } from 'framer-motion'
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
import { THREAT_SCENARIOS } from './scenarios'
|
import { THREAT_SCENARIOS, type ThreatScenario } from './scenarios'
|
||||||
import { ThreatCinematic } from './ThreatDemo'
|
import { ThreatCinematic } from './ThreatDemo'
|
||||||
|
import { LocationCinematic } from '../location/LocationDemo'
|
||||||
import '../demo.css'
|
import '../demo.css'
|
||||||
|
|
||||||
const ACCENT = '#3BB586'
|
const ACCENT = '#3BB586'
|
||||||
|
|
||||||
|
// The slider mixes the threat-detection scenarios with the location/geofencing
|
||||||
|
// demo, which has its own timeline and player rather than a ThreatScenario shape.
|
||||||
|
type DemoSlide =
|
||||||
|
| { kind: 'threat'; scenario: ThreatScenario }
|
||||||
|
| { kind: 'location' }
|
||||||
|
|
||||||
|
const DEMO_SLIDES: DemoSlide[] = [
|
||||||
|
...THREAT_SCENARIOS.map((scenario) => ({ kind: 'threat' as const, scenario })),
|
||||||
|
{ kind: 'location' },
|
||||||
|
]
|
||||||
|
|
||||||
|
function slideId(s: DemoSlide): string {
|
||||||
|
return s.kind === 'threat' ? s.scenario.id : 'location'
|
||||||
|
}
|
||||||
|
function slideTitle(s: DemoSlide): string {
|
||||||
|
return s.kind === 'threat' ? s.scenario.title : 'Family Safe Zones'
|
||||||
|
}
|
||||||
|
function slideProduct(s: DemoSlide): string {
|
||||||
|
return s.kind === 'threat' ? s.scenario.product : 'Mobile SDK'
|
||||||
|
}
|
||||||
|
|
||||||
// Isolated so useNavigate() is only ever invoked when this is actually mounted
|
// Isolated so useNavigate() is only ever invoked when this is actually mounted
|
||||||
// under a <Router> — the embedded (no-router) instance never renders it.
|
// under a <Router> — the embedded (no-router) instance never renders it.
|
||||||
function BackToSiteButton() {
|
function BackToSiteButton() {
|
||||||
@@ -19,8 +41,8 @@ function BackToSiteButton() {
|
|||||||
export default function ThreatDemosSlider({ embedded = false }: { embedded?: boolean } = {}) {
|
export default function ThreatDemosSlider({ embedded = false }: { embedded?: boolean } = {}) {
|
||||||
const [idx, setIdx] = useState(0)
|
const [idx, setIdx] = useState(0)
|
||||||
const [dir, setDir] = useState(1)
|
const [dir, setDir] = useState(1)
|
||||||
const scenario = THREAT_SCENARIOS[idx]
|
const slide = DEMO_SLIDES[idx]
|
||||||
const n = THREAT_SCENARIOS.length
|
const n = DEMO_SLIDES.length
|
||||||
|
|
||||||
const go = (next: number) => {
|
const go = (next: number) => {
|
||||||
setDir(next > idx ? 1 : -1)
|
setDir(next > idx ? 1 : -1)
|
||||||
@@ -35,8 +57,8 @@ export default function ThreatDemosSlider({ embedded = false }: { embedded?: boo
|
|||||||
<div style={{ flexShrink: 0, height: 60, display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '0 20px', borderBottom: '1px solid rgba(255,255,255,.06)', background: 'rgba(1,14,20,.7)', backdropFilter: 'blur(10px)', zIndex: 80 }}>
|
<div style={{ flexShrink: 0, height: 60, display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '0 20px', borderBottom: '1px solid rgba(255,255,255,.06)', background: 'rgba(1,14,20,.7)', backdropFilter: 'blur(10px)', zIndex: 80 }}>
|
||||||
<BackToSiteButton />
|
<BackToSiteButton />
|
||||||
<div style={{ textAlign: 'center', color: '#e8f4f3', minWidth: 0 }}>
|
<div style={{ textAlign: 'center', color: '#e8f4f3', minWidth: 0 }}>
|
||||||
<div style={{ fontSize: 14, fontWeight: 600, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{scenario.title}</div>
|
<div style={{ fontSize: 14, fontWeight: 600, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{slideTitle(slide)}</div>
|
||||||
<div style={{ fontSize: 10.5, color: '#8aa5ab' }}>{idx + 1} / {n} · {scenario.product}</div>
|
<div style={{ fontSize: 10.5, color: '#8aa5ab' }}>{idx + 1} / {n} · {slideProduct(slide)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, background: 'rgba(0,0,0,.4)', border: '1px solid rgba(255,255,255,.1)', borderRadius: 100, padding: '5px 11px', flexShrink: 0 }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: 6, background: 'rgba(0,0,0,.4)', border: '1px solid rgba(255,255,255,.1)', borderRadius: 100, padding: '5px 11px', flexShrink: 0 }}>
|
||||||
<motion.span animate={{ opacity: [1, 0, 1] }} transition={{ duration: 1.2, repeat: Infinity }} style={{ width: 7, height: 7, borderRadius: '50%', background: '#ef4444', display: 'inline-block' }} />
|
<motion.span animate={{ opacity: [1, 0, 1] }} transition={{ duration: 1.2, repeat: Infinity }} style={{ width: 7, height: 7, borderRadius: '50%', background: '#ef4444', display: 'inline-block' }} />
|
||||||
@@ -49,14 +71,16 @@ export default function ThreatDemosSlider({ embedded = false }: { embedded?: boo
|
|||||||
<div style={{ position: 'relative', flex: 1, minHeight: 0, overflow: 'hidden' }}>
|
<div style={{ position: 'relative', flex: 1, minHeight: 0, overflow: 'hidden' }}>
|
||||||
<AnimatePresence initial={false} custom={dir} mode="popLayout">
|
<AnimatePresence initial={false} custom={dir} mode="popLayout">
|
||||||
<motion.div
|
<motion.div
|
||||||
key={scenario.id}
|
key={slideId(slide)}
|
||||||
custom={dir}
|
custom={dir}
|
||||||
initial={{ x: dir > 0 ? '100%' : '-100%' }}
|
initial={{ x: dir > 0 ? '100%' : '-100%' }}
|
||||||
animate={{ x: 0 }}
|
animate={{ x: 0 }}
|
||||||
exit={{ x: dir > 0 ? '-100%' : '100%' }}
|
exit={{ x: dir > 0 ? '-100%' : '100%' }}
|
||||||
transition={{ type: 'spring', stiffness: 260, damping: 30 }}
|
transition={{ type: 'spring', stiffness: 260, damping: 30 }}
|
||||||
style={{ position: 'absolute', inset: 0 }}>
|
style={{ position: 'absolute', inset: 0 }}>
|
||||||
<ThreatCinematic scenario={scenario} autoPlay={!embedded} chrome={false} />
|
{slide.kind === 'threat'
|
||||||
|
? <ThreatCinematic scenario={slide.scenario} autoPlay={!embedded} chrome={false} />
|
||||||
|
: <LocationCinematic autoPlay={!embedded} chrome={false} />}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
|
||||||
@@ -67,8 +91,8 @@ export default function ThreatDemosSlider({ embedded = false }: { embedded?: boo
|
|||||||
|
|
||||||
{/* ── Bottom: scenario tabs (reserved) — moves above the stage on mobile via .bd-demo-tabs media query ── */}
|
{/* ── Bottom: scenario tabs (reserved) — moves above the stage on mobile via .bd-demo-tabs media query ── */}
|
||||||
<div className="bd-demo-tabs" style={{ flexShrink: 0, minHeight: 56, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8, flexWrap: 'wrap', padding: '10px 16px', borderTop: '1px solid rgba(255,255,255,.06)', background: 'rgba(1,14,20,.7)', backdropFilter: 'blur(10px)', zIndex: 80 }}>
|
<div className="bd-demo-tabs" style={{ flexShrink: 0, minHeight: 56, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8, flexWrap: 'wrap', padding: '10px 16px', borderTop: '1px solid rgba(255,255,255,.06)', background: 'rgba(1,14,20,.7)', backdropFilter: 'blur(10px)', zIndex: 80 }}>
|
||||||
{THREAT_SCENARIOS.map((s, i) => (
|
{DEMO_SLIDES.map((s, i) => (
|
||||||
<button key={s.id} onClick={() => go(i)}
|
<button key={slideId(s)} onClick={() => go(i)}
|
||||||
style={{
|
style={{
|
||||||
fontFamily: 'inherit', fontSize: 11, fontWeight: 500, cursor: 'pointer',
|
fontFamily: 'inherit', fontSize: 11, fontWeight: 500, cursor: 'pointer',
|
||||||
padding: '6px 12px', borderRadius: 100,
|
padding: '6px 12px', borderRadius: 100,
|
||||||
@@ -76,7 +100,7 @@ export default function ThreatDemosSlider({ embedded = false }: { embedded?: boo
|
|||||||
background: i === idx ? 'rgba(59,181,134,0.18)' : 'rgba(255,255,255,.03)',
|
background: i === idx ? 'rgba(59,181,134,0.18)' : 'rgba(255,255,255,.03)',
|
||||||
color: i === idx ? ACCENT : 'rgba(255,255,255,.6)', whiteSpace: 'nowrap',
|
color: i === idx ? ACCENT : 'rgba(255,255,255,.6)', whiteSpace: 'nowrap',
|
||||||
}}>
|
}}>
|
||||||
{s.title}
|
{slideTitle(s)}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const DemoScreen = React.lazy(() => import('./demo/DemoScreen'))
|
|||||||
const DemoVideoPage = React.lazy(() => import('./demo/DemoVideoPage'))
|
const DemoVideoPage = React.lazy(() => import('./demo/DemoVideoPage'))
|
||||||
const ThreatDemosSlider = React.lazy(() => import('./demo/threats/ThreatDemosSlider'))
|
const ThreatDemosSlider = React.lazy(() => import('./demo/threats/ThreatDemosSlider'))
|
||||||
const ThreatDemoPlayerPage = React.lazy(() => import('./demo/threats/ThreatDemoPlayerPage'))
|
const ThreatDemoPlayerPage = React.lazy(() => import('./demo/threats/ThreatDemoPlayerPage'))
|
||||||
|
const LocationDemo = React.lazy(() => import('./demo/location/LocationDemo'))
|
||||||
const AdminApp = React.lazy(() => import('./cms/admin/AdminApp'))
|
const AdminApp = React.lazy(() => import('./cms/admin/AdminApp'))
|
||||||
|
|
||||||
function ArticleRoute() {
|
function ArticleRoute() {
|
||||||
@@ -26,6 +27,8 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|||||||
{/* Threat-detection demo slider + per-scenario players */}
|
{/* Threat-detection demo slider + per-scenario players */}
|
||||||
<Route path="/threat-demos" element={<ThreatDemosSlider />} />
|
<Route path="/threat-demos" element={<ThreatDemosSlider />} />
|
||||||
<Route path="/threat-demo/:id" element={<ThreatDemoPlayerPage />} />
|
<Route path="/threat-demo/:id" element={<ThreatDemoPlayerPage />} />
|
||||||
|
{/* Location / geofencing demo — safe-zone creation + leave-zone alert */}
|
||||||
|
<Route path="/location-demo" element={<LocationDemo />} />
|
||||||
{/* Cinematic product video — its own page */}
|
{/* Cinematic product video — its own page */}
|
||||||
<Route path="/demo-video" element={<DemoVideoPage />} />
|
<Route path="/demo-video" element={<DemoVideoPage />} />
|
||||||
{/* Full interactive demo player (Flows A–D, ?mode=video) */}
|
{/* Full interactive demo player (Flows A–D, ?mode=video) */}
|
||||||
|
|||||||
Reference in New Issue
Block a user