Elffuss BraidHub

kikocis/osiris public

020dfbb0c4c8 · 58.2 KiBRawPermalink
1'use client';
2
3import { useEffect, useState, useRef, useCallback, useMemo } from 'react';
4import dynamic from 'next/dynamic';
5import { motion, AnimatePresence } from 'framer-motion';
6import { Layers, BarChart3, Newspaper, Search, Share2, Map as MapIcon, X, Globe, MapPinned, Radar, Satellite, Moon, ExternalLink, AlertTriangle, Building2, RadioTower, Activity, Shield, Database, Wifi } from 'lucide-react';
7import IntelFeed from '@/components/IntelFeed';
8import MarketsPanel from '@/components/MarketsPanel';
9import SearchBar from '@/components/SearchBar';
10import ScaleBar from '@/components/ScaleBar';
11import ErrorBoundary from '@/components/ErrorBoundary';
12import SharePanel from '@/components/SharePanel';
13import ViewPresets from '@/components/ViewPresets';
14import KeyboardShortcuts from '@/components/KeyboardShortcuts';
15import GlobalStatusBar from '@/components/GlobalStatusBar';
16import LiveAlerts from '@/components/LiveAlerts';
17
18const OsirisMap = dynamic(() => import('@/components/OsirisMap'), { ssr: false });
19const LayerPanel = dynamic(() => import('@/components/LayerPanel'));
20const CameraViewer = dynamic(() => import('@/components/CameraViewer'));
21const OsintPanel = dynamic(() => import('@/components/OsintPanel'));
22
23function useIsMobile() {
24 const [isMobile, setIsMobile] = useState(false);
25 useEffect(() => {
26 const check = () => {
27 const w = window.innerWidth;
28 const h = window.innerHeight;
29 // Mobile if narrow, OR landscape phone (short height + moderate width)
30 setIsMobile(w < 768 || (h < 500 && w < 1024));
31 };
32 check();
33 window.addEventListener('resize', check);
34 window.addEventListener('orientationchange', check);
35 return () => {
36 window.removeEventListener('resize', check);
37 window.removeEventListener('orientationchange', check);
38 };
39 }, []);
40 return isMobile;
41}
42const UptimeClock = () => {
43 const [uptime, setUptime] = useState('00:00:00');
44 const startTime = useRef(Date.now());
45 useEffect(() => {
46 const iv = setInterval(() => {
47 const e = Math.floor((Date.now() - startTime.current) / 1000);
48 setUptime(`${String(Math.floor(e/3600)).padStart(2,'0')}:${String(Math.floor((e%3600)/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`);
49 }, 1000);
50 return () => clearInterval(iv);
51 }, []);
52 return <span className="hidden lg:inline">UPTIME: <span className="text-[var(--gold-primary)]">{uptime}</span></span>;
53};
54
55const ZuluClock = () => {
56 const [time, setTime] = useState('');
57 useEffect(() => {
58 const iv = setInterval(() => {
59 const now = new Date();
60 setTime(`ZULU ${String(now.getUTCHours()).padStart(2,'0')}:${String(now.getUTCMinutes()).padStart(2,'0')}:${String(now.getUTCSeconds()).padStart(2,'0')}Z`);
61 }, 1000);
62 return () => clearInterval(iv);
63 }, []);
64 return <span className="text-[var(--cyan-primary)] font-bold tabular-nums">{time || 'ZULU --:--:--Z'}</span>;
65};
66
67const DataThroughput = () => {
68 const [throughput, setThroughput] = useState('0.0');
69 useEffect(() => {
70 const iv = setInterval(() => {
71 // Simulated realistic data throughput between 1.2 and 4.8 MB/s
72 setThroughput((1.2 + Math.random() * 3.6).toFixed(1));
73 }, 2500);
74 return () => clearInterval(iv);
75 }, []);
76 return <span className="text-[var(--alert-green)] font-bold tabular-nums">{throughput} MB/s</span>;
77};
78
79export default function Dashboard() {
80 const dataRef = useRef<any>({});
81 const [dataVersion, setDataVersion] = useState(0);
82 const data = dataRef.current;
83
84 const [backendStatus, setBackendStatus] = useState<'connecting' | 'connected' | 'error'>('connecting');
85 const [mapView, setMapView] = useState({ zoom: 2.5, latitude: 20 });
86 const [flyToLocation, setFlyToLocation] = useState<{ lat: number; lng: number; ts: number } | null>(null);
87 const [mouseCoords, setMouseCoords] = useState<{ lat: number; lng: number } | null>(null);
88 const [locationLabel, setLocationLabel] = useState('');
89 const [regionDossier, setRegionDossier] = useState<any>(null);
90 const [dossierLoading, setDossierLoading] = useState(false);
91 const [showSplash, setShowSplash] = useState(true);
92 const [activeCamera, setActiveCamera] = useState<any>(null);
93 const [spaceWeather, setSpaceWeather] = useState<any>(null);
94 const [showLayers, setShowLayers] = useState(true);
95 const [showMarkets, setShowMarkets] = useState(true);
96 const [showIntel, setShowIntel] = useState(true);
97 const [isFullscreen, setIsFullscreen] = useState(false);
98 const [mobilePanel, setMobilePanel] = useState<'layers'|'markets'|'intel'|'search'|'recon'|null>(null);
99 const [mapProjection, setMapProjection] = useState<'globe'|'mercator'>('globe');
100 const [mapStyle, setMapStyle] = useState<'dark'|'satellite'>('dark');
101 const [sweepData, setSweepData] = useState<any>(null);
102 const [scanTargets, setScanTargets] = useState<any[]>([]);
103
104 const isMobile = useIsMobile();
105 const startTime = useRef(Date.now());
106 const geocodeCache = useRef<Map<string, string>>(new Map());
107 const geocodeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
108 const lastGeocodedPos = useRef<{ lat: number; lng: number } | null>(null);
109
110 // ── DEFAULT: Most layers OFF — fast initial load ──
111 const [activeLayers, setActiveLayers] = useState({
112 flights: false,
113 private: false,
114 jets: false,
115 military: false,
116 maritime: true,
117 satellites: false,
118 balloons: false,
119 cctv: true,
120 live_news: true,
121 news_intel: true,
122 earthquakes: true,
123 fires: false,
124 weather: false,
125 radiation: false,
126 infrastructure: false,
127 global_incidents: true,
128 telegram_intel: false,
129 war_alerts: false,
130 gps_jamming: false,
131 day_night: true,
132 });
133 const [liveFeedUrl, setLiveFeedUrl] = useState<string | null>(null);
134 const [liveFeedName, setLiveFeedName] = useState('');
135 const [liveFeedEmbedAllowed, setLiveFeedEmbedAllowed] = useState(true);
136
137 // Splash screen
138 useEffect(() => {
139 const splashTimer = setTimeout(() => setShowSplash(false), 2500);
140 return () => clearTimeout(splashTimer);
141 }, []);
142
143 // URL state: parse on mount
144 useEffect(() => {
145 if (typeof window === 'undefined') return;
146 const p = new URLSearchParams(window.location.search);
147 const lat = parseFloat(p.get('lat') || '');
148 const lon = parseFloat(p.get('lon') || '');
149 const zoom = parseFloat(p.get('zoom') || '');
150 if (!isNaN(lat) && !isNaN(lon)) {
151 setFlyToLocation({ lat, lng: lon, ts: Date.now() });
152 if (!isNaN(zoom)) setMapView(v => ({ ...v, zoom }));
153 }
154 const layers = p.get('layers');
155 if (layers) {
156 const active = layers.split(',');
157 setActiveLayers(prev => {
158 const next = { ...prev };
159 Object.keys(next).forEach(k => { (next as any)[k] = active.includes(k); });
160 return next;
161 });
162 }
163 }, []);
164
165 // URL state: update URL on view change (debounced)
166 const urlTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
167 useEffect(() => {
168 if (typeof window === 'undefined') return;
169 if (urlTimer.current) clearTimeout(urlTimer.current);
170 urlTimer.current = setTimeout(() => {
171 const p = new URLSearchParams();
172 p.set('lat', (mouseCoords?.lat ?? mapView.latitude ?? 20).toFixed(4));
173 p.set('lon', (mouseCoords?.lng ?? 0).toFixed(4));
174 p.set('zoom', mapView.zoom.toFixed(2));
175 const active = Object.entries(activeLayers).filter(([,v]) => v).map(([k]) => k).join(',');
176 p.set('layers', active);
177 const url = `${window.location.pathname}?${p.toString()}`;
178 window.history.replaceState(null, '', url);
179 }, 1500);
180 }, [mapView, activeLayers, mouseCoords]);
181
182 // Keyboard shortcuts
183 useEffect(() => {
184 const handler = (e: KeyboardEvent) => {
185 if (['INPUT', 'TEXTAREA'].includes((e.target as Element)?.tagName)) return;
186 if (e.key === 'f' && !e.ctrlKey) {
187 if (document.fullscreenElement) document.exitFullscreen();
188 else document.documentElement.requestFullscreen();
189 setIsFullscreen(!!document.fullscreenElement);
190 }
191 if (e.key === 'l') setShowLayers(p => !p);
192 if (e.key === 'm') setShowMarkets(p => !p);
193 if (e.key === 'i') setShowIntel(p => !p);
194 if (e.key === 'r') setFlyToLocation({ lat: 20, lng: 0, ts: Date.now() });
195 if (e.key === 'g') setMapProjection(p => p === 'globe' ? 'mercator' : 'globe');
196 };
197 window.addEventListener('keydown', handler);
198 return () => window.removeEventListener('keydown', handler);
199 }, []);
200
201 // Mouse coords + reverse geocode
202 const handleMouseCoords = useCallback((coords: { lat: number; lng: number }) => {
203 setMouseCoords(coords);
204 if (geocodeTimer.current) clearTimeout(geocodeTimer.current);
205 geocodeTimer.current = setTimeout(async () => {
206 if (lastGeocodedPos.current) {
207 const d = Math.abs(coords.lat - lastGeocodedPos.current.lat) + Math.abs(coords.lng - lastGeocodedPos.current.lng);
208 if (d < 0.5) return; // increased threshold — fewer geocode calls
209 }
210 const gk = `${coords.lat.toFixed(1)},${coords.lng.toFixed(1)}`; // coarser grid = more cache hits
211 if (geocodeCache.current.has(gk)) { setLocationLabel(geocodeCache.current.get(gk)!); lastGeocodedPos.current = coords; return; }
212 try {
213 const res = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.lat}&lon=${coords.lng}&format=json&zoom=10&addressdetails=1`, { headers: { 'Accept-Language': 'en' } });
214 if (res.ok) {
215 const d = await res.json();
216 const a = d.address || {};
217 const label = [a.city||a.town||a.village||a.county, a.state||a.region, a.country].filter(Boolean).join(', ') || 'Unknown';
218 if (geocodeCache.current.size > 500) { const it = geocodeCache.current.keys(); for (let i=0;i<100;i++) { const k = it.next().value; if(k) geocodeCache.current.delete(k); }}
219 geocodeCache.current.set(gk, label);
220 setLocationLabel(label);
221 lastGeocodedPos.current = coords;
222 }
223 } catch (e) { console.warn('[OSIRIS] Suppressed error:', e instanceof Error ? e.message : e); }
224 }, 3000); // 3s debounce (was 1.5s)
225 }, []);
226
227 // Region dossier (right-click)
228 const handleRightClick = useCallback(async (coords: { lat: number; lng: number }) => {
229 setDossierLoading(true); setRegionDossier(null);
230 try {
231 const res = await fetch(`/api/region-dossier?lat=${coords.lat}&lng=${coords.lng}`);
232 if (res.ok) setRegionDossier(await res.json());
233 } catch (e) { console.warn('[OSIRIS] Suppressed error:', e instanceof Error ? e.message : e); } finally { setDossierLoading(false); }
234 }, []);
235
236 // Entity click handler (hoisted from JSX to comply with Rules of Hooks — Fixes #113)
237 const handleEntityClick = useCallback((entity: any) => {
238 if (entity?.type === 'cctv') setActiveCamera(entity);
239 if (entity?.type === 'live_news' && entity.url) {
240 setLiveFeedUrl(entity.url);
241 setLiveFeedName(entity.name);
242 setLiveFeedEmbedAllowed(entity.embed_allowed !== false);
243 }
244 }, []);
245
246 // ── SHARED FETCH UTILITY (Fixes #107 — single definition, not 3 copies) ──
247 const fetchEndpoint = useCallback(async (url: string, transform?: (d: any) => any, options?: RequestInit) => {
248 if (typeof document !== 'undefined' && document.hidden) return;
249 try {
250 const res = await fetch(url, options);
251 if (res.ok) {
252 const json = await res.json();
253 const d = transform ? transform(json) : json;
254 dataRef.current = { ...dataRef.current, ...d };
255 setDataVersion(v => v + 1);
256 setBackendStatus('connected');
257 }
258 } catch (e) {
259 console.warn('[OSIRIS] Suppressed error:', e instanceof Error ? e.message : e);
260 setBackendStatus('error');
261 }
262 }, []);
263
264 // ── PROGRESSIVE DATA LOADING (request-optimized) ──
265 useEffect(() => {
266 // Priority 1: Core feeds (always needed for panels)
267 fetchEndpoint('/api/earthquakes');
268 fetchEndpoint('/api/news');
269 const marketTimer = setTimeout(() => fetchEndpoint('/api/markets', d => ({ markets: d })), 800);
270
271 // Priority 2: Space Weather (needed for MarketsPanel)
272 const spaceTimer = setTimeout(async () => {
273 try {
274 const r = await fetch('/api/space-weather');
275 if (r.ok) setSpaceWeather(await r.json());
276 } catch (e) { console.warn('[OSIRIS] Suppressed error:', e instanceof Error ? e.message : e); }
277 }, 5000);
278
279 // Polling — OPTIMIZED intervals to minimize edge requests
280 const intervals = [
281 setInterval(() => fetchEndpoint('/api/earthquakes'), 900000), // 15 min (was 5)
282 setInterval(() => fetchEndpoint('/api/news'), 1800000), // 30 min (was 10)
283 setInterval(() => fetchEndpoint('/api/markets', d => ({ markets: d })), 900000), // 15 min (was 5)
284 ];
285 return () => {
286 clearTimeout(marketTimer);
287 clearTimeout(spaceTimer);
288 intervals.forEach(clearInterval);
289 };
290 }, [fetchEndpoint]);
291
292 // ── LAYER-AWARE DATA LOADING — only fetch when layer is toggled ON ──
293 const layerFetchedRef = useRef<Set<string>>(new Set());
294 useEffect(() => {
295
296 // Flights
297 if (activeLayers.flights || activeLayers.military || activeLayers.jets || activeLayers.private) {
298 if (!layerFetchedRef.current.has('flights')) {
299 fetchEndpoint('/api/flights');
300 layerFetchedRef.current.add('flights');
301 }
302 }
303 // Satellites
304 if (activeLayers.satellites && !layerFetchedRef.current.has('satellites')) {
305 fetchEndpoint('/api/satellites');
306 layerFetchedRef.current.add('satellites');
307 }
308 // Fires
309 if (activeLayers.fires && !layerFetchedRef.current.has('fires')) {
310 fetchEndpoint('/api/fires');
311 layerFetchedRef.current.add('fires');
312 }
313 // CCTV
314 if (activeLayers.cctv && !layerFetchedRef.current.has('cctv')) {
315 fetchEndpoint('/api/cctv?region=all');
316 layerFetchedRef.current.add('cctv');
317 }
318 // Maritime
319 if (activeLayers.maritime && !layerFetchedRef.current.has('maritime')) {
320 fetchEndpoint('/api/maritime', d => ({ maritime_ports: d.ports, maritime_chokepoints: d.chokepoints, maritime_ships: d.ships }));
321 layerFetchedRef.current.add('maritime');
322 }
323 // Balloons
324 if (activeLayers.balloons && !layerFetchedRef.current.has('balloons')) {
325 fetchEndpoint('/api/balloons', d => ({ balloons: d.balloons }));
326 layerFetchedRef.current.add('balloons');
327 }
328 // Radiation
329 if (activeLayers.radiation && !layerFetchedRef.current.has('radiation')) {
330 fetchEndpoint('/api/radiation', d => ({ radiation: d.stations }));
331 layerFetchedRef.current.add('radiation');
332 }
333 // Live News
334 if (activeLayers.live_news && !layerFetchedRef.current.has('live_news')) {
335 fetchEndpoint('/api/live-news', d => ({ live_feeds: d.feeds }));
336 layerFetchedRef.current.add('live_news');
337 }
338 // Weather
339 if (activeLayers.weather && !layerFetchedRef.current.has('weather')) {
340 fetchEndpoint('/api/weather', d => ({ weather_events: d.events }));
341 layerFetchedRef.current.add('weather');
342 }
343 // Infrastructure
344 if (activeLayers.infrastructure && !layerFetchedRef.current.has('infrastructure')) {
345 fetchEndpoint('/api/infrastructure', d => ({ infrastructure: d.infrastructure }));
346 layerFetchedRef.current.add('infrastructure');
347 }
348 // Global Incidents (GDELT)
349 if (activeLayers.global_incidents && !layerFetchedRef.current.has('gdelt')) {
350 fetchEndpoint('/api/gdelt', d => ({ gdelt: d.events }));
351 layerFetchedRef.current.add('gdelt');
352 }
353 // Telegram OSINT public-channel feed
354 if (activeLayers.telegram_intel && !layerFetchedRef.current.has('telegram')) {
355 fetchEndpoint('/api/telegram-feed', d => ({ telegram: d.events }));
356 layerFetchedRef.current.add('telegram');
357 }
358
359 }, [activeLayers]);
360
361 // ── LAYER-AWARE POLLING — only poll data for active layers ──
362 useEffect(() => {
363 const intervals: ReturnType<typeof setInterval>[] = [];
364 if (activeLayers.flights || activeLayers.military || activeLayers.jets || activeLayers.private) {
365 intervals.push(setInterval(() => fetchEndpoint('/api/flights'), 300000)); // 5 min (was 2 min)
366 }
367
368 if (activeLayers.balloons) {
369 intervals.push(setInterval(() => fetchEndpoint('/api/balloons', d => ({ balloons: d.balloons })), 300000)); // 5m
370 }
371 if (activeLayers.radiation) {
372 intervals.push(setInterval(() => fetchEndpoint('/api/radiation', d => ({ radiation: d.stations })), 300000)); // 5m
373 }
374 if (activeLayers.maritime) {
375 intervals.push(setInterval(() => fetchEndpoint('/api/maritime', d => ({ maritime_ports: d.ports, maritime_chokepoints: d.chokepoints, maritime_ships: d.ships })), 60000)); // 1m
376 }
377 // Fires: no polling needed (data changes very slowly, initial fetch is enough)
378 return () => intervals.forEach(clearInterval);
379 }, [activeLayers, fetchEndpoint]);
380
381 // CCTV: loaded once on layer toggle via layerFetchedRef (no viewport polling)
382
383 // Reactive layer fetch: handled by layerFetchedRef above (no duplicate)
384
385 const totalFlights = useMemo(() => (
386 (data.commercial_flights?.length||0)+(data.private_flights?.length||0)+(data.private_jets?.length||0)+(data.military_flights?.length||0)
387 ), [data.commercial_flights, data.private_flights, data.private_jets, data.military_flights]);
388
389
390 return (
391 <main className="fixed inset-0 w-full h-full bg-[var(--bg-void)] overflow-hidden">
392
393 {/* ── SPLASH ── */}
394 <AnimatePresence>
395 {showSplash && (
396 <motion.div
397 initial={{ opacity: 1 }}
398 exit={{ opacity: 0 }}
399 transition={{ duration: 0.8, ease: 'easeInOut' }}
400 className="absolute inset-0 z-[999] flex flex-col items-center justify-center overflow-hidden"
401 style={{ background: 'radial-gradient(ellipse at center, #0a0a14 0%, var(--bg-void) 70%)' }}
402 >
403 {/* ── Scanline CRT overlay ── */}
404 <div className="absolute inset-0 pointer-events-none z-[1]" style={{
405 backgroundImage: 'repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(212,175,55,0.015) 2px, rgba(212,175,55,0.015) 4px)',
406 animation: 'splashScanDrift 8s linear infinite',
407 }} />
408
409 {/* ── V4.2 badge — top-left ── */}
410 <motion.div
411 initial={{ opacity: 0 }}
412 animate={{ opacity: 0.6 }}
413 transition={{ delay: 0.8, duration: 0.5 }}
414 className="absolute top-6 left-6 z-[2] font-mono text-[10px] tracking-[0.3em] text-[var(--gold-primary)]"
415 >
416 V4.2
417 </motion.div>
418
419
420
421 {/* ── Geometric tactical logo ── */}
422 <div className="relative w-40 h-40 mb-8 flex items-center justify-center z-[2]">
423 {/* Outer ring — slow clockwise */}
424 <motion.div
425 initial={{ opacity: 0, scale: 0.6, rotate: 0 }}
426 animate={{ opacity: 1, scale: 1, rotate: 360 }}
427 transition={{ opacity: { duration: 0.6 }, scale: { duration: 0.8, ease: 'easeOut' }, rotate: { duration: 20, repeat: Infinity, ease: 'linear' } }}
428 className="absolute inset-0 rounded-full"
429 style={{ border: '1px solid rgba(212,175,55,0.2)' }}
430 >
431 <div className="absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 w-2 h-2 rounded-full" style={{ background: 'var(--gold-primary)', boxShadow: '0 0 12px var(--gold-primary), 0 0 24px rgba(212,175,55,0.3)' }} />
432 <div className="absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 w-1 h-1 rounded-full" style={{ background: 'rgba(212,175,55,0.5)', boxShadow: '0 0 6px rgba(212,175,55,0.3)' }} />
433 </motion.div>
434
435 {/* Middle ring — faster counter-clockwise */}
436 <motion.div
437 initial={{ opacity: 0, scale: 0.4, rotate: 0 }}
438 animate={{ opacity: 1, scale: 1, rotate: -360 }}
439 transition={{ opacity: { duration: 0.6, delay: 0.15 }, scale: { duration: 0.8, delay: 0.15, ease: 'easeOut' }, rotate: { duration: 12, repeat: Infinity, ease: 'linear' } }}
440 className="absolute rounded-full"
441 style={{ inset: '18px', border: '1px solid rgba(0,229,255,0.15)' }}
442 >
443 <div className="absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full" style={{ background: 'var(--cyan-primary)', boxShadow: '0 0 10px var(--cyan-primary), 0 0 20px rgba(0,229,255,0.2)' }} />
444 <div className="absolute bottom-0 left-1/4 translate-y-1/2 w-1 h-1 rounded-full" style={{ background: 'rgba(0,229,255,0.4)' }} />
445 </motion.div>
446
447 {/* Inner ring — fastest clockwise */}
448 <motion.div
449 initial={{ opacity: 0, scale: 0.2, rotate: 0 }}
450 animate={{ opacity: 1, scale: 1, rotate: 360 }}
451 transition={{ opacity: { duration: 0.6, delay: 0.3 }, scale: { duration: 0.8, delay: 0.3, ease: 'easeOut' }, rotate: { duration: 7, repeat: Infinity, ease: 'linear' } }}
452 className="absolute rounded-full"
453 style={{ inset: '40px', border: '1px solid rgba(212,175,55,0.25)' }}
454 >
455 <div className="absolute top-0 left-1/4 -translate-y-1/2 w-1.5 h-1.5 rounded-full" style={{ background: 'var(--gold-primary)', boxShadow: '0 0 8px var(--gold-primary)' }} />
456 </motion.div>
457
458 {/* Core circle + crosshair */}
459 <motion.div
460 initial={{ opacity: 0, scale: 0 }}
461 animate={{ opacity: 1, scale: 1 }}
462 transition={{ delay: 0.4, duration: 0.6, ease: [0.34, 1.56, 0.64, 1] }}
463 className="relative w-12 h-12 rounded-full flex items-center justify-center"
464 style={{ border: '2px solid var(--gold-primary)', boxShadow: '0 0 20px rgba(212,175,55,0.15), inset 0 0 20px rgba(212,175,55,0.05)' }}
465 >
466 <motion.div
467 animate={{ opacity: [0.3, 0.8, 0.3] }}
468 transition={{ duration: 2, repeat: Infinity, ease: 'easeInOut' }}
469 className="w-5 h-5 rounded-full"
470 style={{ background: 'radial-gradient(circle, rgba(212,175,55,0.4) 0%, rgba(212,175,55,0.05) 70%)' }}
471 />
472 {/* Crosshair lines */}
473 <div className="absolute w-[1px] h-full" style={{ background: 'linear-gradient(to bottom, transparent, rgba(212,175,55,0.3), transparent)' }} />
474 <div className="absolute w-full h-[1px]" style={{ background: 'linear-gradient(to right, transparent, rgba(212,175,55,0.3), transparent)' }} />
475 </motion.div>
476
477 {/* Faint pulsing radar sweep */}
478 <motion.div
479 initial={{ opacity: 0 }}
480 animate={{ opacity: [0, 0.15, 0], rotate: [0, 360] }}
481 transition={{ opacity: { duration: 3, repeat: Infinity }, rotate: { duration: 3, repeat: Infinity, ease: 'linear' }, delay: 0.6 }}
482 className="absolute inset-[10px] rounded-full"
483 style={{ background: 'conic-gradient(from 0deg, transparent 0deg, rgba(212,175,55,0.15) 40deg, transparent 80deg)' }}
484 />
485 </div>
486
487 {/* ── OSIRIS title — letter-by-letter stagger ── */}
488 <div className="flex items-center gap-[2px] mb-3 z-[2]">
489 {'OSIRIS'.split('').map((letter, i) => (
490 <motion.span
491 key={i}
492 initial={{ opacity: 0, y: 20, filter: 'blur(8px)' }}
493 animate={{ opacity: 1, y: 0, filter: 'blur(0px)' }}
494 transition={{ delay: 0.5 + i * 0.08, duration: 0.5, ease: 'easeOut' }}
495 className="text-4xl md:text-5xl font-bold tracking-[0.5em] font-mono"
496 style={{ color: 'var(--text-heading)', textShadow: '0 0 30px rgba(212,175,55,0.2)' }}
497 >
498 {letter}
499 </motion.span>
500 ))}
501 </div>
502
503 {/* ── Subtitle — typewriter reveal ── */}
504 <div className="overflow-hidden mb-8 z-[2]">
505 <motion.div
506 initial={{ width: 0 }}
507 animate={{ width: '100%' }}
508 transition={{ delay: 1.2, duration: 0.8, ease: 'easeInOut' }}
509 className="overflow-hidden whitespace-nowrap"
510 >
511 <p className="text-[10px] md:text-[11px] font-mono tracking-[0.5em] text-[var(--gold-primary)]" style={{ opacity: 0.8 }}>
512 GLOBAL INTELLIGENCE PLATFORM
513 </p>
514 </motion.div>
515 </div>
516
517 {/* ── Multi-stage progress bar ── */}
518 <div className="w-64 md:w-80 z-[2]">
519 {/* Thin progress track */}
520 <div className="relative w-full h-[2px] rounded-full overflow-hidden" style={{ background: 'rgba(212,175,55,0.1)' }}>
521 <motion.div
522 initial={{ width: '0%' }}
523 animate={{ width: ['0%', '25%', '50%', '78%', '100%'] }}
524 transition={{ duration: 2.2, delay: 0.5, times: [0, 0.25, 0.5, 0.75, 1], ease: 'easeInOut' }}
525 className="absolute inset-y-0 left-0 rounded-full"
526 style={{ background: 'linear-gradient(90deg, var(--gold-primary), var(--cyan-primary), var(--gold-primary))', boxShadow: '0 0 12px rgba(212,175,55,0.4)' }}
527 />
528 </div>
529
530 {/* Status messages — cycling */}
531 <div className="mt-3 h-4 flex items-center justify-center">
532 {[
533 { text: 'ESTABLISHING SECURE CONNECTION...', delay: 0.5 },
534 { text: 'INITIALIZING FEEDS...', delay: 1.1 },
535 { text: 'CALIBRATING SENSORS...', delay: 1.7 },
536 { text: 'SYSTEM READY', delay: 2.2 },
537 ].map((stage, i) => (
538 <motion.span
539 key={i}
540 initial={{ opacity: 0 }}
541 animate={{ opacity: [0, 1, 1, 0] }}
542 transition={{ delay: stage.delay, duration: 0.6, times: [0, 0.1, 0.7, 1] }}
543 className="absolute text-[9px] font-mono tracking-[0.25em]"
544 style={{ color: i === 3 ? 'var(--cyan-primary)' : 'var(--text-muted)' }}
545 >
546 {stage.text}
547 </motion.span>
548 ))}
549 </div>
550 </div>
551
552 {/* ── Decorative grid lines ── */}
553 <div className="absolute inset-0 pointer-events-none z-[0]" style={{ opacity: 0.03 }}>
554 <div className="absolute inset-0" style={{
555 backgroundImage: 'linear-gradient(rgba(212,175,55,0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(212,175,55,0.5) 1px, transparent 1px)',
556 backgroundSize: '60px 60px',
557 }} />
558 </div>
559
560 {/* ── Corner frame accents ── */}
561 {[
562 { t: '10px', l: '10px', bw: '2px 0 0 2px' },
563 { t: '10px', r: '10px', bw: '2px 2px 0 0' },
564 { b: '10px', l: '10px', bw: '0 0 2px 2px' },
565 { b: '10px', r: '10px', bw: '0 2px 2px 0' },
566 ].map((pos, i) => (
567 <motion.div
568 key={i}
569 initial={{ opacity: 0 }}
570 animate={{ opacity: 0.3 }}
571 transition={{ delay: 0.8 + i * 0.1, duration: 0.5 }}
572 className="absolute w-8 h-8 z-[2]"
573 style={{ top: pos.t, bottom: pos.b, left: pos.l, right: pos.r, borderWidth: pos.bw, borderStyle: 'solid', borderColor: 'var(--gold-primary)' }}
574 />
575 ))}
576
577
578
579 {/* ── Inline keyframe for scanline drift ── */}
580 <style>{`
581 @keyframes splashScanDrift {
582 0% { background-position: 0 0; }
583 100% { background-position: 0 100vh; }
584 }
585 `}</style>
586 </motion.div>
587 )}
588 </AnimatePresence>
589
590
591
592 {/* ── MAP ── */}
593 <ErrorBoundary name="Map">
594 <OsirisMap
595 data={data}
596 activeLayers={activeLayers}
597 projection={mapProjection}
598 mapStyle={mapStyle === 'satellite' ? 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' : 'dark'}
599 onEntityClick={handleEntityClick}
600 onMouseCoords={handleMouseCoords}
601 onRightClick={handleRightClick}
602 onViewStateChange={setMapView}
603 flyToLocation={flyToLocation}
604 sweepData={sweepData}
605 scanTargets={scanTargets}
606 />
607 </ErrorBoundary>
608
609
610 {/* ── MAP VIEW CONTROLS (3D/2D + SATELLITE TOGGLE) ── */}
611 <motion.div
612 initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 3.5 }}
613 className="absolute bottom-[75px] md:bottom-6 left-3 md:left-[315px] z-[200] flex items-center gap-2 pointer-events-none"
614 >
615 {/* 3D/2D Toggle */}
616 <button
617 onClick={() => setMapProjection(p => p === 'globe' ? 'mercator' : 'globe')}
618 className="glass-panel p-2.5 pointer-events-auto hover:border-[var(--gold-primary)]/40 transition-colors group relative"
619 title={mapProjection === 'globe' ? 'Switch to 2D Map' : 'Switch to 3D Globe'}
620 >
621 {mapProjection === 'globe' ? (
622 <MapPinned className="w-4 h-4 text-[var(--gold-primary)] group-hover:scale-110 transition-transform" />
623 ) : (
624 <Globe className="w-4 h-4 text-[var(--cyan-primary)] group-hover:scale-110 transition-transform" />
625 )}
626 <span className="absolute bottom-full mb-2 left-1/2 -translate-x-1/2 text-[9px] font-mono text-[var(--text-muted)] whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity glass-panel px-2 py-1 z-[300]">
627 {mapProjection === 'globe' ? '2D MAP' : '3D GLOBE'}
628 </span>
629 </button>
630
631 {/* Map Style Toggle */}
632 <button
633 onClick={() => setMapStyle(s => s === 'dark' ? 'satellite' : 'dark')}
634 className="glass-panel p-2.5 pointer-events-auto hover:border-[var(--gold-primary)]/40 transition-colors group relative"
635 title={mapStyle === 'dark' ? 'Satellite View' : 'Night View'}
636 >
637 {mapStyle === 'dark' ? (
638 <Satellite className="w-4 h-4 text-[var(--alert-green)] group-hover:scale-110 transition-transform" />
639 ) : (
640 <Moon className="w-4 h-4 text-[var(--cyan-primary)] group-hover:scale-110 transition-transform" />
641 )}
642 <span className="absolute bottom-full mb-2 left-1/2 -translate-x-1/2 text-[9px] font-mono text-[var(--text-muted)] whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity glass-panel px-2 py-1 z-[300]">
643 {mapStyle === 'dark' ? 'SATELLITE' : 'NIGHT MODE'}
644 </span>
645 </button>
646 </motion.div>
647
648 {/* ── HEADER ── */}
649 <motion.div initial={{ opacity: 0, y: -20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 1, delay: 2.5 }} className={`absolute top-3 left-3 md:top-5 md:left-5 z-[200] pointer-events-none flex items-center gap-2 md:gap-3`}>
650 <div className="w-7 h-7 md:w-9 md:h-9 flex items-center justify-center relative">
651 {/* Ambient glow ring — slow rotating */}
652 <div className="absolute inset-[-4px] md:inset-[-5px] rounded-full border border-[var(--gold-primary)]/20" style={{ animation: 'osiris-rotate 12s linear infinite' }}>
653 <div className="absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-1 rounded-full bg-[var(--gold-primary)] shadow-[0_0_6px_var(--gold-primary)]" />
654 </div>
655 <div className="absolute inset-[-8px] md:inset-[-10px] rounded-full border border-[var(--gold-primary)]/10" style={{ animation: 'osiris-rotate 20s linear infinite reverse' }}>
656 <div className="absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 w-0.5 h-0.5 rounded-full bg-[var(--gold-primary)]/60" />
657 </div>
658 <div className="w-5 h-5 md:w-7 md:h-7 rounded-full border-2 border-[var(--gold-primary)] flex items-center justify-center animate-glow-pulse">
659 <div className="w-2.5 h-2.5 md:w-3.5 md:h-3.5 rounded-full bg-[var(--gold-primary)]/30 border border-[var(--gold-primary)]/60" />
660 </div>
661 <div className="absolute w-[1px] h-full bg-[var(--gold-primary)]/30" />
662 <div className="absolute w-full h-[1px] bg-[var(--gold-primary)]/30" />
663 </div>
664 {/* Horizontal rule extending from logo */}
665 <div className="hidden md:block absolute top-1/2 left-[52px] w-[200px] h-[1px] bg-gradient-to-r from-[var(--gold-primary)]/40 via-[var(--gold-primary)]/15 to-transparent" />
666 <div className="flex flex-col">
667 <div className="flex items-center gap-2">
668 <h1 className="text-base md:text-xl font-bold tracking-[0.4em] md:tracking-[0.5em] text-[var(--text-heading)] font-mono">OSIRIS</h1>
669 <span className="hidden md:inline-flex items-center gap-1 px-1.5 py-[1px] rounded-sm border border-[var(--cyan-primary)]/40 bg-[var(--cyan-primary)]/10 text-[7px] font-mono font-bold tracking-[0.15em] text-[var(--cyan-primary)] uppercase" style={{ lineHeight: '1.4' }}>
670 <Globe className="w-2.5 h-2.5" />
671 OPEN SOURCE
672 </span>
673 </div>
674 <span className="text-[8px] md:text-[9px] text-[var(--gold-primary)] font-mono tracking-[0.2em] md:tracking-[0.3em] opacity-80">GLOBAL INTELLIGENCE COMMAND</span>
675 </div>
676 </motion.div>
677
678 {/* ── TOP-RIGHT STATUS (desktop) — C2 DISPLAY ── */}
679 <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 3 }} className="status-bar-desktop absolute top-3 right-3 md:top-4 md:right-5 z-[200] pointer-events-none flex items-center gap-1.5 md:gap-3 text-[9px] md:text-[10px] font-mono tracking-widest text-[var(--text-muted)]">
680
681 {/* Zulu Clock */}
682 <span className="hidden lg:inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm border border-[var(--border-primary)] bg-black/30">
683 <ZuluClock />
684 </span>
685
686 <span className="hidden lg:inline text-[var(--border-primary)]">│</span>
687
688 <span className="flex items-center gap-1">SYS: <span className={backendStatus === 'connected' ? 'text-[var(--alert-green)]' : 'text-[var(--alert-red)]'}>{backendStatus.toUpperCase()}</span></span>
689
690 {spaceWeather && <span className="hidden lg:inline">SOLAR: <span style={{ color: spaceWeather.storm_color, fontWeight: 700 }}>Kp{spaceWeather.kp_index}</span></span>}
691
692 {/* Active Data Feeds */}
693 <span className="hidden lg:inline-flex items-center gap-1">
694 <Wifi className="w-3 h-3 text-[var(--cyan-primary)]" />
695 <span className="text-[var(--cyan-primary)] font-bold">{Object.values(activeLayers).filter(Boolean).length}</span>
696 <span className="text-[var(--text-muted)]/60">FEEDS</span>
697 </span>
698
699 <UptimeClock />
700
701 <a href='https://ko-fi.com/M8D41ZYW4Z' target='_blank' className="pointer-events-auto hover:opacity-80 transition-opacity ml-1 flex items-center">
702 <span className="px-3 py-1 rounded-sm border border-[var(--gold-primary)]/40 bg-[var(--gold-primary)]/10 text-[var(--gold-primary)] text-[11px] font-bold tracking-[0.2em]">SUPPORT PROJECT</span>
703 </a>
704 </motion.div>
705
706 {/* ── MOBILE: Compact top status ── */}
707 {isMobile && (
708 <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 2.5 }} className="absolute top-3 right-3 z-[200] pointer-events-auto flex items-center gap-2">
709 <a href='https://ko-fi.com/M8D41ZYW4Z' target='_blank' className="glass-panel px-2 py-1 flex items-center gap-1.5 text-[7px] font-mono tracking-widest hover:opacity-80 transition-opacity border-[var(--gold-primary)]/40 bg-[var(--gold-primary)]/10">
710 <div className="w-1 h-1 rounded-full bg-[var(--gold-primary)] animate-osiris-pulse" />
711 <span className="text-[var(--gold-primary)] font-bold">SUPPORT PROJECT</span>
712 </a>
713 </motion.div>
714 )}
715
716
717
718 {/* ── LEFT HUD (desktop): Layers + Stats + Markets + Intel ── */}
719 <div className="desktop-panel absolute left-5 top-20 bottom-24 w-72 flex flex-col gap-3 z-[200] pointer-events-none overflow-y-auto styled-scrollbar pr-1">
720 {showLayers && (
721 <>
722 <LayerPanel data={data} activeLayers={activeLayers} setActiveLayers={setActiveLayers} />
723 <motion.div initial={{ opacity: 0, x: -20 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: 0.5 }} className="glass-panel px-3 py-2.5 pointer-events-auto">
724 <div className="grid grid-cols-5 gap-2 text-center">
725 <div><div className="hud-label">AIRCRAFT</div><div className="hud-value text-[10px] animate-data-pulse">{totalFlights.toLocaleString()}</div></div>
726 <div><div className="hud-label">SATS</div><div className="hud-value text-[10px]">{(data.satellites?.length||0).toLocaleString()}</div></div>
727 <div><div className="hud-label">CCTV</div><div className="hud-value text-[10px]">{(data.cameras?.length||0).toLocaleString()}</div></div>
728 <div><div className="hud-label">WEATHER</div><div className="hud-value text-[10px]" style={{ color: '#E040FB' }}>{(data.weather_events?.length||0)}</div></div>
729 <div><div className="hud-label">NUCLEAR</div><div className="hud-value text-[10px]" style={{ color: '#76FF03' }}>{(data.infrastructure?.length||0)}</div></div>
730 </div>
731 </motion.div>
732 <ViewPresets onNavigate={(lat, lng, zoom) => { setFlyToLocation({ lat, lng, ts: Date.now() }); setMapView(v => ({ ...v, zoom })); }} />
733 </>
734 )}
735 {showMarkets && <MarketsPanel data={data} spaceWeather={spaceWeather} />}
736 {showIntel && <IntelFeed data={data} onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })} />}
737 </div>
738
739 {/* ── RIGHT HUD (desktop): Search + RECON + Live Alerts ── */}
740 <div className="desktop-panel absolute right-5 top-20 bottom-24 w-80 flex flex-col gap-3 z-[200] pointer-events-auto overflow-y-auto styled-scrollbar pr-1">
741 <div className="flex gap-2 items-start">
742 <div className="flex-1"><SearchBar onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })} /></div>
743 <div className="relative"><SharePanel mapView={mapView} activeLayers={activeLayers} mouseCoords={mouseCoords} /></div>
744 </div>
745 <OsintPanel onSweepVisualize={setSweepData} onScanGeolocate={(target, data) => {
746 setScanTargets(prev => {
747 const existing = prev.filter(t => t.id !== target);
748 return [{ id: target, timestamp: Date.now(), ...data }, ...existing].slice(0, 10);
749 });
750 setFlyToLocation({ lat: data.lat, lng: data.lng, ts: Date.now() });
751 }} />
752 <LiveAlerts data={data} onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })} onWatchFeed={(url, name) => { setLiveFeedUrl(url); setLiveFeedName(name); }} />
753 </div>
754
755 {/* ── LIVE FEED VIEWER OVERLAY ── */}
756 <AnimatePresence>
757 {liveFeedUrl && (
758 <motion.div
759 initial={{ opacity: 0, scale: 0.9 }}
760 animate={{ opacity: 1, scale: 1 }}
761 exit={{ opacity: 0, scale: 0.9 }}
762 className="fixed inset-0 z-[500] flex items-center justify-center bg-black/70 backdrop-blur-sm"
763 onClick={() => setLiveFeedUrl(null)}
764 >
765 <motion.div
766 initial={{ y: 20 }}
767 animate={{ y: 0 }}
768 className="w-[90vw] max-w-[900px] flex flex-col relative rounded-xl overflow-hidden border border-[var(--border-primary)] shadow-2xl bg-black"
769 onClick={e => e.stopPropagation()}
770 >
771 {/* Header */}
772 <div className="flex items-center justify-between px-4 py-2.5 bg-[#111] border-b border-[var(--border-primary)]">
773 <div className="flex items-center gap-2">
774 <div className="w-2 h-2 rounded-full bg-[#FF4081] animate-osiris-pulse" />
775 <span className="text-[12px] font-mono font-bold text-white tracking-wider">{liveFeedName}</span>
776 <span className="px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 font-mono text-[9px] font-bold">LIVE STREAM</span>
777 {!liveFeedEmbedAllowed && (
778 <span className="px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 font-mono text-[9px]">EXTERNAL ONLY</span>
779 )}
780 </div>
781 <div className="flex items-center gap-3">
782 <a
783 href={
784 liveFeedUrl.includes('channel=')
785 ? `https://www.youtube.com/channel/${liveFeedUrl.split('channel=')[1].split('&')[0]}/live`
786 : liveFeedUrl.includes('/embed/')
787 ? `https://www.youtube.com/watch?v=${liveFeedUrl.split('/embed/')[1].split('?')[0]}`
788 : liveFeedUrl
789 }
790 target="_blank"
791 rel="noopener noreferrer"
792 className="flex items-center gap-1.5 px-2.5 py-1 rounded bg-[var(--border-primary)] hover:bg-[var(--gold-primary)] hover:text-black text-white transition-colors text-[11px] font-mono"
793 >
794 <span>Open in YouTube</span>
795 <ExternalLink className="w-3 h-3" />
796 </a>
797 <button onClick={() => setLiveFeedUrl(null)} className="text-white/70 hover:text-white transition-colors p-1">
798 <X className="w-5 h-5" />
799 </button>
800 </div>
801 </div>
802
803 {/* Body — iframe or external card */}
804 {liveFeedEmbedAllowed ? (
805 <div className="w-full aspect-video relative bg-black">
806 <iframe
807 src={liveFeedUrl}
808 className="w-full h-full absolute inset-0"
809 allow="autoplay; encrypted-media"
810 allowFullScreen
811 />
812 </div>
813 ) : (
814 <div className="w-full aspect-video flex items-center justify-center bg-black/95">
815 <div className="text-center px-8">
816 <div className="w-14 h-14 rounded-full bg-[#39FF14]/10 border border-[#39FF14]/20 flex items-center justify-center mx-auto mb-4">
817 <ExternalLink className="w-6 h-6 text-[#39FF14]" />
818 </div>
819 <p className="text-[13px] font-mono font-bold text-white tracking-widest mb-2">EMBED RESTRICTED</p>
820 <p className="text-[11px] font-mono text-white/50 mb-6 max-w-xs">
821 {liveFeedName} does not allow third-party embedding. Click below to open the live stream directly.
822 </p>
823 <a
824 href={
825 liveFeedUrl.includes('channel=')
826 ? `https://www.youtube.com/channel/${liveFeedUrl.split('channel=')[1].split('&')[0]}/live`
827 : liveFeedUrl.includes('/embed/')
828 ? `https://www.youtube.com/watch?v=${liveFeedUrl.split('/embed/')[1].split('?')[0]}`
829 : liveFeedUrl
830 }
831 target="_blank"
832 rel="noopener noreferrer"
833 className="inline-flex items-center gap-2 px-6 py-2.5 rounded border border-[#39FF14]/40 text-[#39FF14] font-mono text-[12px] hover:bg-[#39FF14]/10 transition-colors tracking-wider"
834 >
835 <ExternalLink className="w-4 h-4" />
836 OPEN LIVE STREAM
837 </a>
838 </div>
839 </div>
840 )}
841
842 {/* Footer — only show for embeddable feeds */}
843 {liveFeedEmbedAllowed && (
844 <div className="bg-[#111]/90 px-4 py-2.5 border-t border-[var(--border-primary)] flex items-center gap-2.5">
845 <AlertTriangle className="w-4 h-4 text-[var(--gold-primary)] shrink-0" />
846 <span className="text-[11px] font-mono text-white/70 leading-relaxed">
847 If you see &ldquo;Video unavailable&rdquo;, use <strong className="text-[var(--gold-primary)]">Open in YouTube</strong> above.
848 </span>
849 </div>
850 )}
851 </motion.div>
852 </motion.div>
853 )}
854 </AnimatePresence>
855
856 {/* ═══ MOBILE UI ═══ */}
857 {isMobile && (
858 <>
859 {/* Mobile Bottom Navigation */}
860 <div className="mobile-nav">
861 <div className="glass-panel mobile-nav-inner">
862 {[
863 { id: 'layers' as const, icon: Layers, label: 'LAYERS' },
864 { id: 'markets' as const, icon: BarChart3, label: 'MARKETS' },
865 { id: 'intel' as const, icon: Newspaper, label: 'INTEL' },
866 { id: 'recon' as const, icon: Radar, label: 'RECON' },
867 { id: 'search' as const, icon: Search, label: 'SEARCH' },
868 ].map(tab => (
869 <button key={tab.id} onClick={() => setMobilePanel(mobilePanel === tab.id ? null : tab.id)}
870 className={`mobile-nav-btn ${mobilePanel === tab.id ? 'active' : ''}`}>
871 <tab.icon className={`w-4 h-4 ${tab.id === 'recon' ? 'text-[var(--cyan-primary)]' : ''}`} />
872 <span className={tab.id === 'recon' ? 'text-[var(--cyan-primary)]' : ''}>{tab.label}</span>
873 </button>
874 ))}
875 </div>
876 </div>
877
878 {/* Mobile Drawer */}
879 <AnimatePresence>
880 {mobilePanel && (
881 <motion.div
882 initial={{ y: '100%' }} animate={{ y: 0 }} exit={{ y: '100%' }}
883 transition={{ type: 'spring', damping: 30, stiffness: 300 }}
884 className="fixed bottom-[52px] left-0 right-0 z-[400] glass-panel rounded-b-none overflow-y-auto styled-scrollbar"
885 style={{ maxHeight: 'min(55vh, calc(100dvh - 100px))', paddingBottom: 'env(safe-area-inset-bottom, 4px)' }}
886 >
887 <div className="mobile-drawer-handle" />
888 <div className="px-3 pb-3">
889 <div className="flex items-center justify-between mb-2">
890 <span className="hud-text text-[9px] text-[var(--text-primary)]">
891 {mobilePanel === 'layers' ? 'LAYERS & STATS' : mobilePanel === 'markets' ? 'MARKETS & INTEL' : mobilePanel === 'intel' ? 'INTEL FEED' : mobilePanel === 'recon' ? 'OSIRIS RECON' : 'SEARCH'}
892 </span>
893 <button onClick={() => setMobilePanel(null)} className="text-[var(--text-muted)] p-1"><X className="w-4 h-4" /></button>
894 </div>
895 {mobilePanel === 'layers' && (
896 <>
897 <div className="glass-panel-sm p-2 mb-2">
898 <div className="grid grid-cols-5 gap-1 text-center">
899 <div><div className="hud-label" style={{fontSize:'6px'}}>AIR</div><div className="hud-value text-[9px]">{totalFlights.toLocaleString()}</div></div>
900 <div><div className="hud-label" style={{fontSize:'6px'}}>SAT</div><div className="hud-value text-[9px]">{(data.satellites?.length||0)}</div></div>
901 <div><div className="hud-label" style={{fontSize:'6px'}}>CAM</div><div className="hud-value text-[9px]">{(data.cameras?.length||0)}</div></div>
902 <div><div className="hud-label" style={{fontSize:'6px'}}>WX</div><div className="hud-value text-[9px]" style={{color:'#E040FB'}}>{(data.weather_events?.length||0)}</div></div>
903 <div><div className="hud-label" style={{fontSize:'6px'}}>NUC</div><div className="hud-value text-[9px]" style={{color:'#76FF03'}}>{(data.infrastructure?.length||0)}</div></div>
904 </div>
905 </div>
906 <LayerPanel data={data} activeLayers={activeLayers} setActiveLayers={setActiveLayers} />
907 <div className="mt-2">
908 <ViewPresets onNavigate={(lat, lng, zoom) => { setFlyToLocation({ lat, lng, ts: Date.now() }); setMapView(v => ({ ...v, zoom })); setMobilePanel(null); }} />
909 </div>
910 </>
911 )}
912 {mobilePanel === 'markets' && <MarketsPanel data={data} spaceWeather={spaceWeather} />}
913 {mobilePanel === 'intel' && <IntelFeed data={data} onLocate={(lat, lng) => { setFlyToLocation({ lat, lng, ts: Date.now() }); setMobilePanel(null); }} />}
914 {mobilePanel === 'search' && (
915 <div className="space-y-2">
916 <SearchBar onLocate={(lat, lng) => { setFlyToLocation({ lat, lng, ts: Date.now() }); setMobilePanel(null); }} />
917 <SharePanel mapView={mapView} activeLayers={activeLayers} mouseCoords={mouseCoords} />
918 </div>
919 )}
920 {mobilePanel === 'recon' && (
921 <div className="space-y-2">
922 <OsintPanel isOpen={true} onClose={() => setMobilePanel(null)} isMobile={true} onSweepVisualize={setSweepData} />
923 </div>
924 )}
925 </div>
926 </motion.div>
927 )}
928 </AnimatePresence>
929 </>
930 )}
931
932 {/* ── BOTTOM CENTER (desktop) ── */}
933 {!isMobile && (
934 <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 3, duration: 0.8 }} className="desktop-only absolute bottom-5 left-1/2 -translate-x-1/2 z-[200] pointer-events-auto">
935 <div className="glass-panel px-5 py-2.5 flex items-center gap-0 osiris-glow relative overflow-hidden" style={{ borderImage: 'linear-gradient(90deg, rgba(212,175,55,0.05), rgba(212,175,55,0.2), rgba(212,175,55,0.05)) 1', borderImageSlice: 1, borderWidth: '1px', borderStyle: 'solid' }}>
936
937 {/* Animated scan line sweeping across the bar */}
938 <div className="absolute inset-0 pointer-events-none overflow-hidden" aria-hidden="true">
939 <div className="absolute top-0 bottom-0 w-[60px] bg-gradient-to-r from-transparent via-[var(--gold-primary)]/[0.07] to-transparent" style={{ animation: 'hud-scanline 4s ease-in-out infinite' }} />
940 </div>
941
942 {/* COORDINATES */}
943 <div className="flex flex-col items-center min-w-[110px] px-3">
944 <div className="hud-label">COORDINATES</div>
945 <div className="text-[10px] font-mono font-bold text-[var(--gold-primary)] tracking-wide tabular-nums">{mouseCoords ? `${mouseCoords.lat.toFixed(4)}, ${mouseCoords.lng.toFixed(4)}` : '—'}</div>
946 </div>
947
948 <div className="w-px h-8 bg-gradient-to-b from-transparent via-[var(--border-primary)] to-transparent flex-shrink-0" />
949
950 {/* LOCATION */}
951 <div className="flex flex-col items-center min-w-[160px] max-w-[280px] px-3">
952 <div className="hud-label">LOCATION</div>
953 <div className="text-[9px] text-[var(--text-secondary)] font-mono truncate max-w-[280px]">{locationLabel || 'Hover over map...'}</div>
954 </div>
955
956 <div className="w-px h-8 bg-gradient-to-b from-transparent via-[var(--border-primary)] to-transparent flex-shrink-0" />
957
958 {/* ZOOM */}
959 <div className="flex flex-col items-center px-3">
960 <div className="hud-label">ZOOM</div>
961 <div className="text-[10px] font-mono font-bold text-[var(--gold-primary)] tabular-nums">{mapView.zoom.toFixed(1)}</div>
962 </div>
963
964 <div className="w-px h-8 bg-gradient-to-b from-transparent via-[var(--border-primary)] to-transparent flex-shrink-0" />
965
966 {/* ACTIVE LAYERS */}
967 <div className="flex flex-col items-center px-3 min-w-[60px]">
968 <div className="hud-label">ACTIVE LAYERS</div>
969 <div className="flex items-center gap-1">
970 <Layers className="w-3 h-3 text-[var(--gold-primary)]" />
971 <span className="text-[10px] font-mono font-bold text-[var(--gold-primary)] tabular-nums">{Object.values(activeLayers).filter(Boolean).length}</span>
972 </div>
973 </div>
974
975 <div className="w-px h-8 bg-gradient-to-b from-transparent via-[var(--border-primary)] to-transparent flex-shrink-0" />
976
977 {/* DATA FEEDS */}
978 <div className="flex flex-col items-center px-3 min-w-[60px]">
979 <div className="hud-label">FEEDS</div>
980 <div className="flex items-center gap-1">
981 <Activity className="w-3 h-3 text-[var(--cyan-primary)]" />
982 <span className="text-[10px] font-mono font-bold text-[var(--cyan-primary)] tabular-nums">{Object.values(activeLayers).filter(Boolean).length}</span>
983 </div>
984 </div>
985
986 <div className="w-px h-8 bg-gradient-to-b from-transparent via-[var(--border-primary)] to-transparent flex-shrink-0" />
987
988 {/* THROUGHPUT */}
989 <div className="flex flex-col items-center px-3 min-w-[70px]">
990 <div className="hud-label">THROUGHPUT</div>
991 <div className="flex items-center gap-1">
992 <Database className="w-3 h-3 text-[var(--alert-green)]" />
993 <DataThroughput />
994 </div>
995 </div>
996
997 </div>
998 </motion.div>
999 )}
1000
1001 {/* ── Scale Bar (desktop) ── */}
1002 <div className="desktop-only absolute bottom-[4.5rem] left-[20rem] z-[201] pointer-events-none">
1003 <ScaleBar zoom={mapView.zoom} latitude={mapView.latitude} />
1004 </div>
1005
1006 {/* ── Region Dossier ── */}
1007 {(regionDossier || dossierLoading) && (
1008 <motion.div initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} className="absolute top-16 md:top-20 left-2 right-2 md:left-1/2 md:right-auto md:-translate-x-1/2 z-[300] md:w-[480px] max-h-[65vh] overflow-y-auto styled-scrollbar">
1009 <div className="glass-panel p-5 osiris-glow">
1010 <div className="flex items-center justify-between mb-3">
1011 <h2 className="text-sm font-mono font-bold text-[var(--gold-primary)] tracking-wider">REGION DOSSIER</h2>
1012 <button onClick={() => { setRegionDossier(null); setDossierLoading(false); }} className="text-[var(--text-muted)] hover:text-[var(--text-primary)] text-xs">✕</button>
1013 </div>
1014 {dossierLoading ? (
1015 <div className="text-center py-8">
1016 <div className="w-5 h-5 border-2 border-[var(--gold-primary)] border-t-transparent rounded-full animate-spin mx-auto mb-2" />
1017 <span className="text-[8px] font-mono text-[var(--text-muted)] tracking-widest">COMPILING INTEL...</span>
1018 </div>
1019 ) : regionDossier && (
1020 <div className="space-y-3">
1021 <div><div className="hud-label mb-0.5">LOCATION</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.location?.display_name}</div></div>
1022 {regionDossier.country && (
1023 <div className="grid grid-cols-2 gap-2">
1024 <div><div className="hud-label mb-0.5">COUNTRY</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.flag} {regionDossier.country.name}</div></div>
1025 <div><div className="hud-label mb-0.5">CAPITAL</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.capital}</div></div>
1026 <div><div className="hud-label mb-0.5">POPULATION</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.population?.toLocaleString()}</div></div>
1027 <div><div className="hud-label mb-0.5">REGION</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.subregion || regionDossier.country.region}</div></div>
1028 <div><div className="hud-label mb-0.5">LANGUAGES</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.languages?.join(', ')}</div></div>
1029 <div><div className="hud-label mb-0.5">AREA</div><div className="text-xs text-[var(--text-primary)]">{regionDossier.country.area?.toLocaleString()} km²</div></div>
1030 </div>
1031 )}
1032 {regionDossier.head_of_state && (<div><div className="hud-label mb-0.5">HEAD OF STATE</div><div className="text-xs text-[var(--gold-primary)]">{regionDossier.head_of_state.name}</div><div className="text-[8px] text-[var(--text-muted)]">{regionDossier.head_of_state.position}</div></div>)}
1033 {regionDossier.wikipedia && (<div><div className="hud-label mb-1">INTELLIGENCE BRIEF</div><div className="flex gap-3">{regionDossier.wikipedia.thumbnail && <img src={regionDossier.wikipedia.thumbnail} alt="" className="w-14 h-14 rounded object-cover flex-shrink-0" />}<p className="text-[8px] text-[var(--text-secondary)] leading-relaxed">{regionDossier.wikipedia.extract}</p></div></div>)}
1034 </div>
1035 )}
1036 </div>
1037 </motion.div>
1038 )}
1039
1040 {/* ── Camera Viewer ── */}
1041 <CameraViewer
1042 camera={activeCamera}
1043 onClose={() => setActiveCamera(null)}
1044 onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })}
1045 />
1046
1047 {/* ── OVERLAYS ── */}
1048 <div className="vignette absolute inset-0 pointer-events-none z-[2]" />
1049 <div className="crt-scanlines absolute inset-0 pointer-events-none z-[3] opacity-[0.02]" />
1050 {/* Corner frames */}
1051 {['top-0 left-0','top-0 right-0','bottom-0 left-0','bottom-0 right-0'].map((pos, i) => (
1052 <div key={i} className={`absolute ${pos} w-16 h-16 pointer-events-none z-[1]`}>
1053 <div className={`absolute ${pos.includes('top') ? 'top-0' : 'bottom-0'} ${pos.includes('left') ? 'left-0' : 'right-0'} w-full h-[1px] bg-gradient-to-${pos.includes('left') ? 'r' : 'l'} from-[var(--gold-primary)]/30 to-transparent`} />
1054 <div className={`absolute ${pos.includes('top') ? 'top-0' : 'bottom-0'} ${pos.includes('left') ? 'left-0' : 'right-0'} w-[1px] h-full bg-gradient-to-${pos.includes('top') ? 'b' : 't'} from-[var(--gold-primary)]/30 to-transparent`} />
1055 </div>
1056 ))}
1057
1058 {/* Keyboard Shortcuts Overlay */}
1059 <KeyboardShortcuts />
1060
1061 {/* ── GLOBAL STATUS TICKER (bottom) ── */}
1062 <GlobalStatusBar />
1063
1064 {/* Shortcut hint */}
1065 <div className="desktop-only absolute bottom-[26px] right-5 z-[200] pointer-events-none text-[6px] font-mono text-[var(--text-muted)]/40 tracking-widest">
1066 [?] SHORTCUTS · [F] FULLSCREEN · [S] SHARE · [R] RESET VIEW
1067 </div>
1068
1069
1070 </main>
1071 );
1072}