import { useState, useEffect } from 'react' interface DroneInfo { id: string name: string status: 'active' | 'returning' | 'standby' | 'charging' battery: number altitude: number speed: number sensor: string color: string } const drones: DroneInfo[] = [ { id: 'D-01', name: 'DJI M300 #1', status: 'active', battery: 78, altitude: 150, speed: 12, sensor: '광학 4K', color: 'var(--blue)' }, { id: 'D-02', name: 'DJI M300 #2', status: 'active', battery: 65, altitude: 200, speed: 8, sensor: 'IR 열화상', color: 'var(--red)' }, { id: 'D-03', name: 'Mavic 3E', status: 'active', battery: 82, altitude: 120, speed: 15, sensor: '광학 4K', color: 'var(--purple)' }, { id: 'D-04', name: 'DJI M30T', status: 'active', battery: 45, altitude: 180, speed: 10, sensor: '다중센서', color: 'var(--green)' }, { id: 'D-05', name: 'DJI M300 #3', status: 'returning', battery: 12, altitude: 80, speed: 18, sensor: '광학 4K', color: 'var(--orange)' }, { id: 'D-06', name: 'Mavic 3E #2', status: 'charging', battery: 35, altitude: 0, speed: 0, sensor: '광학 4K', color: 'var(--t3)' }, ] interface AlertItem { time: string type: 'warning' | 'info' | 'danger' message: string } const alerts: AlertItem[] = [ { time: '15:42', type: 'danger', message: 'D-05 배터리 부족 — 자동 복귀' }, { time: '15:38', type: 'warning', message: '오염원 신규 탐지 (34.82°N)' }, { time: '15:35', type: 'info', message: 'D-01~D-03 다시점 융합 완료' }, { time: '15:30', type: 'warning', message: 'AIS OFF 선박 2척 추가 탐지' }, { time: '15:25', type: 'info', message: 'D-04 센서 데이터 수집 시작' }, { time: '15:20', type: 'danger', message: '유류오염 확산 속도 증가 감지' }, { time: '15:15', type: 'info', message: '3D 재구성 시작 (불명선박-B)' }, ] export function RealtimeDrone() { const [reconProgress, setReconProgress] = useState(0) const [reconDone, setReconDone] = useState(false) const [selectedDrone, setSelectedDrone] = useState(null) useEffect(() => { if (reconDone) return const timer = setInterval(() => { setReconProgress(prev => { if (prev >= 100) { clearInterval(timer) setReconDone(true) return 100 } return prev + 2 }) }, 300) return () => clearInterval(timer) }, [reconDone]) const statusLabel = (s: string) => { if (s === 'active') return { text: '비행중', cls: 'text-status-green' } if (s === 'returning') return { text: '복귀중', cls: 'text-status-orange' } if (s === 'charging') return { text: '충전중', cls: 'text-text-3' } return { text: '대기', cls: 'text-text-3' } } const alertColor = (t: string) => t === 'danger' ? 'border-l-status-red bg-[rgba(239,68,68,0.05)]' : t === 'warning' ? 'border-l-status-orange bg-[rgba(249,115,22,0.05)]' : 'border-l-primary-blue bg-[rgba(59,130,246,0.05)]' return (
{/* Map Area */}
{/* Simulated map background */}
{/* Grid lines */}
{/* Coastline hint */}
{/* Drone position markers */} {drones.filter(d => d.status !== 'charging').map((d, i) => (
setSelectedDrone(d.id)} >
{d.id}
))} {/* Oil spill areas */}
{/* Overlay Stats */}
{[ { label: '탐지 객체', value: '847', unit: '건', color: 'text-primary-blue' }, { label: '식별 선박', value: '312', unit: '척', color: 'text-primary-cyan' }, { label: 'AIS OFF', value: '14', unit: '척', color: 'text-status-red' }, { label: '오염 탐지', value: '3', unit: '건', color: 'text-status-orange' }, ].map((s, i) => (
{s.label}
{s.value} {s.unit}
))}
{/* 3D Reconstruction Progress */}
🧊 3D 재구성 {reconProgress}%
{!reconDone ? (
D-01~D-03 다각도 영상 융합중...
) : (
✅ 완료 — 클릭하여 정밀분석
)}
{/* Live Feed Panel */} {selectedDrone && (() => { const drone = drones.find(d => d.id === selectedDrone) if (!drone) return null return (
{drone.id} 실시간 영상
{/* Simulated video feed */}
LIVE FEED
{/* HUD overlay */}
{drone.id} {drone.sensor}
34.82°N, 128.95°E
REC
ALT {drone.altitude}m · SPD {drone.speed}m/s · HDG 045°
비행 정보
{[ ['드론 ID', drone.id], ['기체', drone.name], ['배터리', `${drone.battery}%`], ['고도', `${drone.altitude}m`], ['속도', `${drone.speed}m/s`], ['센서', drone.sensor], ['상태', statusLabel(drone.status).text], ].map(([k, v], i) => (
{k} {v}
))}
) })()}
{/* Right Sidebar */}
{/* Drone Swarm Status */}
군집 드론 현황 · 4/6 운용
{drones.map(d => { const st = statusLabel(d.status) return (
d.status !== 'charging' && setSelectedDrone(d.id)} className={`flex items-center gap-2 px-2 py-1.5 rounded-sm cursor-pointer transition-colors ${ selectedDrone === d.id ? 'bg-[rgba(6,182,212,0.08)] border border-primary-cyan/20' : 'hover:bg-white/[0.02] border border-transparent' }`} >
{d.id}
{d.name}
{st.text}
{d.battery}%
) })}
{/* Multi-Angle Analysis */}
다각화 분석
{[ { icon: '🎯', label: '다시점 융합', value: '28건', sub: '360° 식별' }, { icon: '🧊', label: '3D 재구성', value: '12건', sub: '선박+오염원' }, { icon: '📡', label: '다센서 융합', value: '45건', sub: '광학+IR+SAR' }, { icon: '🛢️', label: '오염원 3D', value: '3건', sub: '유류+HNS' }, ].map((a, i) => (
{a.icon}
{a.label}
{a.value}
{a.sub}
))}
{/* Real-time Alerts */}
실시간 경보
{alerts.map((a, i) => (
{a.time} {a.message}
))}
) }