diff --git a/components/TopBar.tsx b/components/TopBar.tsx index bd02c25..dcf1e6e 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { ArrowLeft, ExternalLink, - Globe, History, Monitor, Moon, @@ -17,7 +16,6 @@ import { FeatureConfig, FEATURES } from '@/config/features'; import { storageUtil } from '@/utils/chromeStorage'; import { openExtensionPage } from '@/utils/chromeTabs'; import { useI18n } from '@/utils/chromeI18n'; -import { normalizeLanguage, SUPPORTED_LANGUAGES } from '@/utils/chromeI18n'; import { cn } from '@/lib/utils'; // 1. 引入 shadcn 核心工具函数 // 常量配置抽取(无需写在全局变量或 styles 对象里) @@ -27,7 +25,7 @@ const SEARCH_HISTORY_DISPLAY = 5; export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) { const { currentPage, goBack, navigateTo } = useRouter(); const { mode, setMode } = useThemeMode(); - const { t, i18n } = useI18n(['common', 'features']); + const { t } = useI18n(['common', 'features']); const [searchQuery, setSearchQuery] = useState(''); const [showResults, setShowResults] = useState(false); @@ -99,14 +97,6 @@ export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) setShowResults(false); }; - const toggleLanguage = async () => { - const currentLng = normalizeLanguage(i18n.language); - const currentIndex = SUPPORTED_LANGUAGES.indexOf(currentLng); - const nextLng = SUPPORTED_LANGUAGES[(currentIndex + 1) % SUPPORTED_LANGUAGES.length]; - await i18n.changeLanguage(nextLng); - await storageUtil.set('app/language', nextLng); - }; - const cycleThemeMode = () => { const nextMap = { light: 'dark', dark: 'system', system: 'light' } as const; setMode(nextMap[mode]); @@ -272,9 +262,6 @@ export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) {/* 右侧:操作区 */}
- - -