import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { Cpu, Wifi, WifiOff, Radio, Clock, Activity } from 'lucide-react'; const HeroHeader = ({ backendStatus = 'checking', totalDetections = 0 }) => { const [currentTime, setCurrentTime] = useState(new Date()); useEffect(() => { const t = setInterval(() => setCurrentTime(new Date()), 1000); return () => clearInterval(t); }, []); const fmt = (d) => d.toLocaleTimeString('en-US', { hour12: false }); const fmtDate = (d) => d.toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' }); const statusConfig = { online: { label: 'System Online', dotColor: '#22c55e', bg: 'rgba(34,197,94,0.12)', border: 'rgba(34,197,94,0.3)', textColor: '#86efac', Icon: Wifi }, offline: { label: 'Backend Offline', dotColor: '#ef4444', bg: 'rgba(239,68,68,0.12)', border: 'rgba(239,68,68,0.3)', textColor: '#fca5a5', Icon: WifiOff }, checking: { label: 'Connecting…', dotColor: '#fbbf24', bg: 'rgba(245,158,11,0.12)', border: 'rgba(245,158,11,0.3)', textColor: '#fcd34d', Icon: Radio }, }; const st = statusConfig[backendStatus] || statusConfig.checking; return (
{/* Top accent gradient line */}
{/* LEFT — Logo + Title */}
AI Traffic Command Center
YOLOv10 • Intelligent Signal Management • v2.0
{/* CENTER — Metrics */}
{[ { label: 'Model', value: 'YOLOv10', color: '#93c5fd' }, { label: 'Roads', value: '4', color: '#67e8f9' }, { label: 'Detected', value: String(totalDetections), color: '#86efac' }, ].map(m => (
{m.label}: {m.value}
))}
{/* RIGHT — Clock + Status */}
{/* Clock */}
{fmt(currentTime)}
{fmtDate(currentTime)}
{/* Status Pill */}
{st.label}
); }; export default HeroHeader;