diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx index dc263dd..d4802bb 100644 --- a/src/components/layout/MainLayout.tsx +++ b/src/components/layout/MainLayout.tsx @@ -35,6 +35,8 @@ import { } from '@/stores'; import { configApi, versionApi } from '@/services/api'; import { triggerHeaderRefresh } from '@/hooks/useHeaderRefresh'; +import { LANGUAGE_LABEL_KEYS, LANGUAGE_ORDER } from '@/utils/constants'; +import type { Language } from '@/types'; const sidebarIcons: Record = { dashboard: , @@ -189,7 +191,15 @@ export function MainLayout() { const theme = useThemeStore((state) => state.theme); const cycleTheme = useThemeStore((state) => state.cycleTheme); - const toggleLanguage = useLanguageStore((state) => state.toggleLanguage); + const language = useLanguageStore((state) => state.language); + const setLanguage = useLanguageStore((state) => state.setLanguage); + + const handleLanguageChange = useCallback( + (event: React.ChangeEvent) => { + setLanguage(event.target.value as Language); + }, + [setLanguage] + ); const [sidebarOpen, setSidebarOpen] = useState(false); const [sidebarCollapsed, setSidebarCollapsed] = useState(false); @@ -566,9 +576,23 @@ export function MainLayout() { > {headerIcons.update} - +
+ + +
+ {LANGUAGE_ORDER.map((lang) => ( + + ))} +
{t('login.subtitle')}
diff --git a/src/styles/layout.scss b/src/styles/layout.scss index 0ba8d9d..43feaf5 100644 --- a/src/styles/layout.scss +++ b/src/styles/layout.scss @@ -190,6 +190,41 @@ gap: $spacing-xs; flex-shrink: 0; + .language-select-wrapper { + display: inline-flex; + align-items: center; + gap: 6px; + color: var(--text-secondary); + + &:hover { + color: var(--text-primary); + } + } + + .language-select-icon { + display: inline-flex; + align-items: center; + justify-content: center; + } + + .language-select { + border: 1px solid var(--border-color); + border-radius: $radius-md; + padding: 10px 12px; + font-size: 14px; + background: var(--bg-primary); + color: var(--text-primary); + cursor: pointer; + height: 40px; + box-sizing: border-box; + + &:focus { + outline: none; + border-color: var(--primary-color); + box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); + } + } + svg { display: block; }