diff --git a/ordinis-admin-ui/src/components/layout/TopBar.tsx b/ordinis-admin-ui/src/components/layout/TopBar.tsx index 7a2f3ef..4bfabb2 100644 --- a/ordinis-admin-ui/src/components/layout/TopBar.tsx +++ b/ordinis-admin-ui/src/components/layout/TopBar.tsx @@ -1,12 +1,19 @@ import { useTranslation } from 'react-i18next' import { Link, useLocation, useNavigate } from '@tanstack/react-router' import { useDictionaryDetail } from '@/api/queries' +import { LanguageSwitch } from '@/ui' import { AuthBadge } from '@/auth/AuthBadge' import { ThemeSwitch } from '@/components/layout/ThemeSwitch' +import { VersionBadge } from '@/components/version/VersionBadge' import { SearchInput } from '@/ui/components/search-input' import { Menu } from 'lucide-react' import { useEffect, useRef, useState } from 'react' +const LANG_OPTIONS = [ + { id: 'ru-RU', label: 'RU' }, + { id: 'en-US', label: 'EN' }, +] + /** * TopBar — sticky header (h=56) per handoff design. * @@ -17,7 +24,7 @@ import { useEffect, useRef, useState } from 'react' * - Right: VersionBadge · ThemeSwitch · LanguageSwitch · Docs · AuthBadge */ export function TopBar({ onMenuClick }: { onMenuClick?: () => void }) { - const { t } = useTranslation() + const { t, i18n } = useTranslation() const navigate = useNavigate() const [searchValue, setSearchValue] = useState('') const inputRef = useRef(null) @@ -115,42 +122,34 @@ export function TopBar({ onMenuClick }: { onMenuClick?: () => void }) { /> - {/* Right cluster — minimal per redesign prototype: - * - Lang toggle (single label, click flips) - * - Theme switch (Earth / Dark) - * - AuthBadge (sign-in / user avatar) - * Docs link и VersionBadge перенесены в sidebar footer — diagnostic info, - * не critical UX. */} + {/* Right cluster — user prefers full set: Docs link + VersionBadge + + * ThemeSwitch + LanguageSwitch + AuthBadge (logged-in avatar/sign-in). + * User explicitly: "Руководство · dev · {commit} · theme · RU EN · + * zimin.an · logout это оставь". */}
- + + {t('nav.docs')} + + + + + i18n.changeLanguage(id)} + />
) } -/** - * LanguageToggle — single-button toggle per redesign prototype (показывает - * текущий язык как label, click переключает на следующий). Замена tri/dual - * radio LanguageSwitch который занимал ~80px горизонтально. - */ -function LanguageToggle() { - const { i18n } = useTranslation() - const cur = i18n.language?.toLowerCase().startsWith('en') ? 'en' : 'ru' - const next = cur === 'ru' ? 'en-US' : 'ru-RU' - return ( - - ) -} - type Crumb = { label: string; to?: string; subtitle?: string } /**