import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { AuthProvider, useAuth } from '@/app/auth/AuthContext'; import { MainLayout } from '@/app/layout/MainLayout'; import { LoginPage } from '@features/auth'; /* SFR-01 */ import { AccessControl } from '@features/admin'; /* SFR-02 */ import { SystemConfig, NoticeManagement } from '@features/admin'; /* SFR-03 */ import { DataHub } from '@features/admin'; /* SFR-04 */ import { AIModelManagement } from '@features/ai-operations'; /* SFR-05 */ import { RiskMap } from '@features/risk-assessment'; /* SFR-06 */ import { EnforcementPlan } from '@features/risk-assessment'; /* SFR-07 */ import { PatrolRoute } from '@features/patrol'; /* SFR-08 */ import { FleetOptimization } from '@features/patrol'; /* SFR-09 */ import { DarkVesselDetection } from '@features/detection'; /* SFR-10 */ import { GearDetection } from '@features/detection'; /* SFR-11 */ import { EnforcementHistory } from '@features/enforcement'; /* SFR-12 */ import { MonitoringDashboard } from '@features/monitoring'; /* SFR-13 */ import { Statistics } from '@features/statistics'; /* SFR-14 */ import { ExternalService } from '@features/statistics'; /* SFR-15 */ import { MobileService } from '@features/field-ops'; /* SFR-16 */ import { ShipAgent } from '@features/field-ops'; /* SFR-17 */ import { AIAlert } from '@features/field-ops'; /* SFR-18+19 */ import { MLOpsPage } from '@features/ai-operations'; /* SFR-20 */ import { AIAssistant } from '@features/ai-operations'; /* SFR-20 LLM운영 */ import { LLMOpsPage } from '@features/ai-operations'; /* 기존 */ import { Dashboard } from '@features/dashboard'; import { LiveMapView, MapControl } from '@features/surveillance'; import { EventList } from '@features/enforcement'; import { VesselDetail } from '@features/vessel'; import { ChinaFishing } from '@features/detection'; import { ReportManagement } from '@features/statistics'; import { AdminPanel } from '@features/admin'; // Phase 4: 모선 워크플로우 import { ParentReview } from '@features/parent-inference/ParentReview'; import { ParentExclusion } from '@features/parent-inference/ParentExclusion'; import { LabelSession } from '@features/parent-inference/LabelSession'; // Phase 4: 관리자 로그 import { AuditLogs } from '@features/admin/AuditLogs'; import { AccessLogs } from '@features/admin/AccessLogs'; import { LoginHistoryView } from '@features/admin/LoginHistoryView'; /** * 권한 가드. * - user 미인증 시 /login으로 리다이렉트 * - resource 지정 시 hasPermission 체크 → 거부 시 403 표시 */ function ProtectedRoute({ children, resource, operation = 'READ', }: { children: React.ReactNode; resource?: string; operation?: string; }) { const { user, loading, hasPermission } = useAuth(); if (loading) return null; if (!user) return ; if (resource && !hasPermission(resource, operation)) { return (
🚫

접근 권한이 없습니다

이 페이지에 접근하려면 {resource}::{operation} 권한이 필요합니다.

); } return <>{children}; } export default function App() { return ( } /> }> } /> {/* SFR-12 대시보드 */} } /> } /> {/* SFR-05~06 위험도·단속계획 */} } /> } /> {/* SFR-09~10 탐지 */} } /> } /> } /> {/* SFR-07~08 순찰경로 */} } /> } /> {/* SFR-11 이력 */} } /> } /> {/* SFR-15~17 현장 대응 */} } /> } /> } /> {/* SFR-13~14 통계·외부연계 */} } /> } /> } /> {/* SFR-04 AI 모델 */} } /> {/* SFR-18~20 AI 운영 */} } /> } /> } /> {/* SFR-03 데이터허브 */} } /> {/* SFR-02 환경설정 */} } /> } /> {/* SFR-01 권한·시스템 */} } /> } /> {/* Phase 4: 관리자 로그 */} } /> } /> } /> {/* Phase 4: 모선 워크플로우 */} } /> } /> } /> {/* 기존 유지 */} } /> } /> } /> ); }