import { Link, useLocation } from 'react-router-dom'; import { useThemeContext } from '../contexts/ThemeContext'; interface NavSection { key: string; title: string; paths: string[]; items: { path: string; label: string; icon: string }[]; } const sections: NavSection[] = [ { key: 'collector', title: 'S&P Collector', paths: ['/dashboard', '/jobs', '/executions', '/recollects', '/schedules', '/schedule-timeline'], items: [ { path: '/dashboard', label: 'λŒ€μ‹œλ³΄λ“œ', icon: 'πŸ“Š' }, { path: '/executions', label: 'μ‹€ν–‰ 이λ ₯', icon: 'πŸ“‹' }, { path: '/recollects', label: 'μž¬μˆ˜μ§‘ 이λ ₯', icon: 'πŸ”„' }, { path: '/jobs', label: 'μž‘μ—…', icon: 'βš™οΈ' }, { path: '/schedules', label: 'μŠ€μΌ€μ€„', icon: 'πŸ•' }, { path: '/schedule-timeline', label: 'νƒ€μž„λΌμΈ', icon: 'πŸ“…' }, ], }, { key: 'bypass', title: 'S&P Bypass', paths: ['/bypass-config'], items: [ { path: '/bypass-config', label: 'Bypass API', icon: 'πŸ”—' }, ], }, { key: 'risk', title: 'S&P Risk & Compliance', paths: ['/screening-guide', '/risk-compliance-history'], items: [ { path: '/screening-guide', label: 'Screening Guide', icon: 'βš–οΈ' }, { path: '/risk-compliance-history', label: 'Change History', icon: 'πŸ“œ' }, ], }, ]; function getCurrentSection(pathname: string): NavSection | null { for (const section of sections) { if (section.paths.some((p) => pathname === p || pathname.startsWith(p + '/'))) { return section; } } return null; } export default function Navbar() { const location = useLocation(); const { theme, toggle } = useThemeContext(); const currentSection = getCurrentSection(location.pathname); // 메인 ν™”λ©΄μ—μ„œλŠ” Navbar μˆ¨κΉ€ if (!currentSection) return null; const isActive = (path: string) => { if (path === '/dashboard') return location.pathname === '/dashboard'; return location.pathname === path || location.pathname.startsWith(path + '/'); }; return ( ); }