/* ============================================================ NeuralScout — Dashboard preview ============================================================ */ function DashboardPreview() { const now = useTick(100); const t = (now % 8000) / 8000; // Chart data - animated bars const barData = React.useMemo(() => { const base = [42, 58, 71, 64, 82, 96, 110, 118, 104, 88, 72, 54]; return base; }, []); const liveIdx = Math.floor(t * barData.length); // Sparkline const sparkPts = React.useMemo(() => Array.from({length: 40}).map((_,i) => 30 + Math.sin(i * 0.4) * 12 + Math.sin(i * 0.15) * 6 + (i * 0.3)), []); const tickerVal = 1842 + Math.floor(t * 12); return (
{/* Top bar */}
Neuralscout / North Gate
Last 24h ▾
All cameras ▾
{/* Nav rail */}
{['⌂', '◉', '▦', '∿', '⚙'].map((c, i) => (
{c}
))}
{/* KPI row */}
{/* Chart card */}
Traffic
Hourly IN / OUT — last 12 hours
IN
OUT
{/* y grid */} {[0, 25, 50, 75, 100].map(y => (
))} {/* bars */}
{barData.map((v, i) => (
))}
{/* x labels */}
{['2a','4a','6a','8a','10a','12p','2p','4p','6p','8p','10p','now'].map((l,i) => (
{l}
))}
{/* Bottom row */}
{/* Sparkline card */}
Dwell heatmap · Zone A
3m 42s avg
`L ${(i/(sparkPts.length-1))*200} ${60-p}`).join(' ')} L 200 60 L 0 60 Z`} fill="url(#sparkGrad)"/> `L ${(i/(sparkPts.length-1))*200} ${60-p}`).join(' ')}`} stroke="var(--ns-lime)" strokeWidth="1.5" fill="none"/>
{/* Camera strip */}
Cameras · 12 active
{Array.from({length: 6}).map((_,i) => (
CAM_0{i+1}
{/* fake detection */}
))}
{/* Recent events */}
Recent events
{[ { c:'var(--ns-lime)', t:'12:42:19', e:'Vehicle IN · KR-8472' }, { c:'var(--ns-cyan)', t:'12:41:55', e:'Person COUNTED · Zone A' }, { c:'var(--ns-violet)', t:'12:41:12', e:'Face matched · Priya K.' }, { c:'var(--ns-amber)', t:'12:40:48', e:'Dwell exceeded · Zone B' }, { c:'var(--ns-lime)', t:'12:40:21', e:'Vehicle OUT · DL-9931' }, ].map((ev, i) => (
{ev.t} {ev.e}
))}
); } function KPI({label, value, delta, deltaColor}) { return (
{label}
{value}
{delta}
); } const dashStyles = { wrap: { background:'var(--ns-bg-1)', border:'1px solid var(--ns-line)', borderRadius:'var(--ns-r-3)', overflow:'hidden', display:'flex', flexDirection:'column', }, topbar: { padding:'12px 18px', display:'flex', justifyContent:'space-between', alignItems:'center', borderBottom:'1px solid var(--ns-line)', background:'var(--ns-bg-2)', }, filter: { fontFamily:'var(--ns-mono)', fontSize: 11, color:'var(--ns-fg-dim)', padding:'6px 10px', border:'1px solid var(--ns-line-2)', borderRadius: 3, }, body: { display:'flex', minHeight: 0 }, rail: { width: 52, background:'var(--ns-bg-2)', borderRight:'1px solid var(--ns-line)', padding:'16px 0', display:'flex', flexDirection:'column', gap: 6, alignItems:'center', }, railBtn: { width: 36, height: 36, display:'flex', alignItems:'center', justifyContent:'center', fontSize: 16, borderRadius: 4, cursor: 'default', }, main: { flex: 1, padding: 18, display:'flex', flexDirection:'column', gap: 14 }, kpiRow: { display:'grid', gridTemplateColumns:'repeat(4, 1fr)', gap: 10 }, kpi: { padding:'14px 16px', background:'var(--ns-bg-2)', border:'1px solid var(--ns-line)', borderRadius: 6, }, chartCard: { padding:'16px 18px', background:'var(--ns-bg-2)', border:'1px solid var(--ns-line)', borderRadius: 6, }, chartHead: { display:'flex', justifyContent:'space-between', alignItems:'center', marginBottom: 14 }, legendDot: { width: 8, height: 8, borderRadius:99, alignSelf:'center', marginRight: 4 }, chart: { position:'relative', height: 160, paddingBottom: 20 }, barsWrap: { position:'absolute', inset: 0, bottom: 20, display:'flex', gap: 4, alignItems:'flex-end' }, xLabels: { position:'absolute', left: 0, right: 0, bottom: 0, display:'flex' }, bottomRow: { display:'grid', gridTemplateColumns: '1fr 1.2fr 1.3fr', gap: 10 }, smallCard: { padding:'14px 16px', background:'var(--ns-bg-2)', border:'1px solid var(--ns-line)', borderRadius: 6, }, }; window.DashboardPreview = DashboardPreview;