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 = ['EXE', 'ARB', 'LIQ', 'NET', 'SYS'] const pairs = ['BTC-USDT', 'ETH-PERP', 'SOL-USDT', 'BNB-BUSD'] const actions = ['BUY', 'SELL', 'SHORT', 'LONG'] const type = types[Math.floor(Math.random() * types.length)] let msg = '' let color = '' switch (type) { case 'EXE': msg = `BOT-${Math.floor(Math.random() * 99)} ${actions[Math.floor(Math.random() * 4)]} ${pairs[Math.floor(Math.random() * 4)]} @ ${Math.floor(Math.random() * 60000)}` color = 'text-green-500' break; case 'ARB': msg = `Spread detected: BINANCE <> BYBIT (${(Math.random()).toFixed(3)}%)` color = 'text-nofx-gold' break; case 'LIQ': msg = `Liquidation Alert: ${pairs[Math.floor(Math.random() * 4)]} $${Math.floor(Math.random() * 100)}k REKT` color = 'text-red-500' break; case 'NET': msg = `Block propagation latency < ${Math.floor(Math.random() * 10)}ms` color = 'text-zinc-500' break; default: msg = `System optimization cycle complete. Allocating resources.` color = 'text-blue-400' } 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}
))}
) }