import { motion } from 'framer-motion' import { useState, useEffect } from 'react' interface LogEntry { id: number time: string type: string msg: string color: string } const generateLog = (id: number): LogEntry => { const types = ['EXEC', 'SIGNAL', 'RISK', 'MACRO', 'SYS'] const pairs = ['AAPL-USDC', 'NVDA-USDC', 'GOLD-USDC', 'EURUSD-USDC', 'OPENAI-IPO'] const actions = ['BUY', 'SELL', 'HEDGE', 'ROTATE'] const type = types[Math.floor(Math.random() * types.length)] let msg = '' let color = '' switch (type) { case 'EXEC': msg = `AGENT-${Math.floor(Math.random() * 99)} ${actions[Math.floor(Math.random() * 4)]} ${pairs[Math.floor(Math.random() * pairs.length)]} @ ${Math.floor(Math.random() * 600)}` color = 'text-nofx-success' break; case 'SIGNAL': msg = `US equities momentum signal confirmed (${(Math.random()).toFixed(3)} z-score)` color = 'text-nofx-gold' break; case 'RISK': msg = `Risk check passed: ${pairs[Math.floor(Math.random() * pairs.length)]} exposure within limits` color = 'text-nofx-danger' break; case 'MACRO': msg = `Macro feed latency < ${Math.floor(Math.random() * 10)}ms` color = 'text-nofx-text-muted' break; default: msg = `System optimization cycle complete. Allocating resources.` color = 'text-nofx-accent' } return { id, time: new Date().toLocaleTimeString('en-US', { hour12: false }) + '.' + Math.floor(Math.random() * 999), type, msg, color } } export default function LiveFeed() { const [logs, setLogs] = useState([]) useEffect(() => { // Initial population const initialLogs = Array.from({ length: 8 }).map((_, i) => generateLog(i)) setLogs(initialLogs) const interval = setInterval(() => { setLogs(prev => { const newLog = generateLog(Date.now()) return [newLog, ...prev.slice(0, 7)] }) }, 800) // Fast 800ms updates for HFT feel return () => clearInterval(interval) }, []) return (
{/* Left Status Bar (Static) */}
WS_CONN: STABLE
TPS: 48,291
{/* Right Scrolling Log - Vertical on mobile, Single line ticker on Desktop */}
{/* Desktop View: Single Line Fade */}
{logs.slice(0, 1).map((log) => ( [{log.time}] {log.type} {log.msg} ))}
{/* Mobile View: Vertical Stack */}
{logs.map((log) => (
{log.time.split('.')[0]} {log.type} {log.msg}
))}
) }