import { useState, useCallback } from 'react'; import { useSearchParams } from 'react-router-dom'; import RiskTab from '../components/screening/RiskTab'; import ComplianceTab from '../components/screening/ComplianceTab'; import MethodologyTab from '../components/screening/MethodologyTab'; import { t } from '../constants/screeningTexts'; type ActiveTab = 'risk' | 'ship-compliance' | 'company-compliance' | 'methodology'; const VALID_TABS: ActiveTab[] = ['risk', 'ship-compliance', 'company-compliance', 'methodology']; const LANG_KEY = 'screening-lang'; export default function ScreeningGuide() { const [searchParams] = useSearchParams(); const initialTab = VALID_TABS.includes(searchParams.get('tab') as ActiveTab) ? (searchParams.get('tab') as ActiveTab) : 'risk'; const [activeTab, setActiveTab] = useState(initialTab); const [lang, setLangState] = useState(() => localStorage.getItem(LANG_KEY) || 'EN'); const setLang = useCallback((l: string) => { setLangState(l); localStorage.setItem(LANG_KEY, l); }, []); const tabs: { key: ActiveTab; label: string }[] = [ { key: 'risk', label: t(lang, 'tabRiskIndicators') }, { key: 'ship-compliance', label: t(lang, 'tabShipCompliance') }, { key: 'company-compliance', label: t(lang, 'tabCompanyCompliance') }, { key: 'methodology', label: t(lang, 'tabMethodology') }, ]; return (
{/* 헤더 */}

{t(lang, 'screeningGuideTitle')}

{t(lang, 'screeningGuideSubtitle')}

{/* 언어 토글 */}
{(['EN', 'KO'] as const).map((l) => ( ))}
{/* 언더라인 탭 */}
{tabs.map((tab) => ( ))}
{/* 탭 내용 */} {activeTab === 'risk' && } {activeTab === 'ship-compliance' && } {activeTab === 'company-compliance' && } {activeTab === 'methodology' && }
); }