import React, { useState, useEffect } from 'react';
export default function OpsControlPanel({ onBack, onNavigateView }) {
const [isMobile, setIsMobile] = useState(window.innerWidth < 1024);
const [isEvSurge, setIsEvSurge] = useState(true);
const [demandThreshold, setDemandThreshold] = useState(65);
const [activeTab, setActiveTab] = useState('food');
const [isApiOnline, setIsApiOnline] = useState(true);
const [latency, setLatency] = useState(42);
const [fleetSize, setFleetSize] = useState(1402);
useEffect(() => {
const handleResize = () => {
setIsMobile(window.innerWidth < 1024);
};
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
// Jitter simulator
useEffect(() => {
const interval = setInterval(() => {
setLatency(prev => Math.max(10, Math.min(200, prev + Math.floor(Math.random() * 7) - 3)));
setFleetSize(prev => Math.max(1000, Math.min(2000, prev + Math.floor(Math.random() * 5) - 2)));
}, 2000);
return () => clearInterval(interval);
}, []);
if (isMobile) {
/* ─── MOBILE VIEW LAYOUT (district operations_control mockup) ─── */
return (
{/* Header */}
{/* Active Storm Surge Card */}
thunderstorm
Monsoon Surge Override
Fleet multiplier is active (1.5x)
setIsEvSurge(!isEvSurge)}
className={`w-9 h-5 rounded-full relative flex items-center px-0.5 cursor-pointer transition-all ${
isEvSurge ? 'bg-red-500' : 'bg-white/10'
}`}
>
{/* Tobit Demand Solver Stats */}
Tobit Demand Forecasting
COEFFICIENT
0.942
UNCERTAINTY
4.1%
{/* Platform API Integrations status */}
API Sync States
Swiggy Builders Club
Online
Zomato Engine
Online
Blinkit Darkstore
Online
);
}
/* ─── DESKTOP VIEW LAYOUT (hyperflow_operations_control_v3_high_fidelity) ─── */
return (
{/* Top Header */}
HyperFlow
Ops Core V3
{/* Main Container */}
{/* Left Side Navigation Panel */}
{/* Left Panel: Simulated phone view */}
SURGE OVERRIDE ACTIVE • STORM MULTIPLIER
{/* Simple Search bar */}
search
Search Biryani, Groceries...
{/* Sub-tabs */}
{/* Grocery grid */}
Instamart Essentials
apple
Fruits
local_drink
Dairy
lunch_dining
Bakery
kebab_dining
Meats
{/* Restaurant view */}
Popular Restaurants
Umami Central
Mughlai • 25 min SLA
{/* Right Panel: Advanced analytics & configuration */}
{/* API Status Banner */}
LATENCY: {latency}ms
FLEET: {fleetSize}
MONSOON JITTER INDEX: 1.1x
{/* Bento Grid */}
{/* Tobit Forecast */}
Tobit Latent Demand Solver
Demand projection and fleet placement model
query_stats
DEMAND MATRIX
0.942
MODEL DELAY
4.1%
{/* Monsoon Jitter chart */}
Monsoon ETA Jitter
Real-time ETA smoothing chart
timeline
{/* Visual SVG graph line */}
{/* Bottom Health Bar */}
API cluster nodes
18 / 18 HEALTHY
Memory utilization
1.2 TB / 4.0 TB
);
}