import { useEffect, useMemo, useRef, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Card, CardContent } from '@shared/components/ui/card'; import { Badge } from '@shared/components/ui/badge'; import { Smartphone, MapPin, Bell, Wifi, WifiOff, Shield, AlertTriangle, Navigation } from 'lucide-react'; import { BaseMap, createMarkerLayer, createPolylineLayer, useMapLayers, type MapHandle, type MarkerData } from '@lib/map'; import { useEventStore } from '@stores/eventStore'; import { formatTime } from '@shared/utils/dateFormat'; /* SFR-15: 단속요원 이용 모바일 대응 서비스 */ const PUSH_SETTINGS = [ { name: 'EEZ 침범 경보', enabled: true }, { name: '다크베셀 탐지', enabled: true }, { name: '불법환적 의심', enabled: true }, { name: '순찰경로 업데이트', enabled: false }, { name: '기상 특보', enabled: true }, ]; // 모바일 지도에 표시할 마커 const MOBILE_MARKERS = [ { lat: 37.20, lng: 124.63, name: '鲁荣渔56555', type: 'alert', color: '#ef4444' }, { lat: 37.75, lng: 125.02, name: '미상선박-A', type: 'dark', color: '#f97316' }, { lat: 36.80, lng: 124.37, name: '冀黄港渔05001', type: 'suspect', color: '#eab308' }, { lat: 37.45, lng: 125.30, name: '3009함(아군)', type: 'patrol', color: '#a855f7' }, ]; export function MobileService() { const { t } = useTranslation('fieldOps'); const mapRef = useRef(null); const { events, load } = useEventStore(); useEffect(() => { load(); }, [load]); const buildLayers = useCallback(() => [ createPolylineLayer('eez-simple', [ [38.5, 124.0], [37.0, 123.0], [36.0, 122.5], [35.0, 123.0], ], { color: '#ef4444', width: 1, opacity: 0.3, dashArray: [4, 4] }), createMarkerLayer('mobile-markers', MOBILE_MARKERS.map(m => ({ lat: m.lat, lng: m.lng, color: m.color, } as MarkerData)), '#3b82f6', 800), ], []); useMapLayers(mapRef, buildLayers, []); const ALERTS = useMemo( () => events.slice(0, 3).map((e) => ({ time: formatTime(e.time).slice(0, 5), title: e.type === 'EEZ 침범' || e.level === 'CRITICAL' ? `[긴급] ${e.title}` : e.title, detail: e.area ?? e.detail, level: e.level, })), [events], ); return (

{t('mobileService.title')}

{t('mobileService.desc')}

{/* 모바일 프리뷰 */}
{/* 상태바 */}
해경 모바일 앱
{/* 긴급 경보 */}
[긴급] EEZ 침범 탐지
N37°12' E124°38' · 08:47
{/* 지도 영역 — MapLibre GL */}
{/* 미니 범례 */}
침범 다크 아군
{/* KPI 그리드 */}
{[['위험도', '87점'], ['의심선박', '3척'], ['추천경로', '2건'], ['경보', '5건']].map(([k, v]) => (
{v}
{k}
))}
{/* 최근 알림 */}
{ALERTS.slice(0, 2).map((a, i) => (
{a.title}
))}
{/* 홈바 */}
{/* 기능 설명 + 푸시 설정 */}
모바일 주요 기능
{[{ icon: AlertTriangle, name: '예측 정보 수신', desc: '불법행위 위험도, 의심 선박·어구 정보' }, { icon: Navigation, name: '경로 추천', desc: 'AI 순찰 경로 수신 및 네비게이션' }, { icon: MapPin, name: '지도 조회', desc: '해상 위치 확인·해양환경정보 간단 조회' }, { icon: WifiOff, name: '오프라인 지원', desc: '통신 불안정 시 지도·객체 임시 저장' }, ].map(f => (
{f.name}
{f.desc}
))}
푸시 알림 설정
{PUSH_SETTINGS.map(p => (
{p.name}
))}
); }