Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
cea13af
1
Parent(s): 93c6fa3
feat: add LanguageSwitcher to Header with RU/EN/KY translations
Browse files
frontend/app/providers.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persist
|
|
| 6 |
import { useState, useEffect } from 'react'
|
| 7 |
import { AuthProvider } from '@/contexts/AuthContext'
|
| 8 |
import { ToastProvider } from '@/contexts/ToastContext'
|
|
|
|
| 9 |
|
| 10 |
// Create persister for localStorage (only on client)
|
| 11 |
const createPersister = () => {
|
|
@@ -41,11 +42,13 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|
| 41 |
if (!persister) {
|
| 42 |
return (
|
| 43 |
<QueryClientProvider client={queryClient}>
|
| 44 |
-
<
|
| 45 |
-
<
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
</QueryClientProvider>
|
| 50 |
)
|
| 51 |
}
|
|
@@ -59,11 +62,13 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|
| 59 |
buster: 'v1', // Change this to invalidate all caches
|
| 60 |
}}
|
| 61 |
>
|
| 62 |
-
<
|
| 63 |
-
<
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
</PersistQueryClientProvider>
|
| 68 |
)
|
| 69 |
}
|
|
|
|
| 6 |
import { useState, useEffect } from 'react'
|
| 7 |
import { AuthProvider } from '@/contexts/AuthContext'
|
| 8 |
import { ToastProvider } from '@/contexts/ToastContext'
|
| 9 |
+
import { LanguageProvider } from '@/lib/i18n'
|
| 10 |
|
| 11 |
// Create persister for localStorage (only on client)
|
| 12 |
const createPersister = () => {
|
|
|
|
| 42 |
if (!persister) {
|
| 43 |
return (
|
| 44 |
<QueryClientProvider client={queryClient}>
|
| 45 |
+
<LanguageProvider>
|
| 46 |
+
<AuthProvider>
|
| 47 |
+
<ToastProvider>
|
| 48 |
+
{children}
|
| 49 |
+
</ToastProvider>
|
| 50 |
+
</AuthProvider>
|
| 51 |
+
</LanguageProvider>
|
| 52 |
</QueryClientProvider>
|
| 53 |
)
|
| 54 |
}
|
|
|
|
| 62 |
buster: 'v1', // Change this to invalidate all caches
|
| 63 |
}}
|
| 64 |
>
|
| 65 |
+
<LanguageProvider>
|
| 66 |
+
<AuthProvider>
|
| 67 |
+
<ToastProvider>
|
| 68 |
+
{children}
|
| 69 |
+
</ToastProvider>
|
| 70 |
+
</AuthProvider>
|
| 71 |
+
</LanguageProvider>
|
| 72 |
</PersistQueryClientProvider>
|
| 73 |
)
|
| 74 |
}
|
frontend/components/Header.tsx
CHANGED
|
@@ -6,9 +6,12 @@ import { LogOut, ChevronDown, Building2, Settings, User } from 'lucide-react'
|
|
| 6 |
import { cn } from '@/lib/utils'
|
| 7 |
import { api } from '@/lib/api'
|
| 8 |
import Link from 'next/link'
|
|
|
|
|
|
|
| 9 |
|
| 10 |
export function Header() {
|
| 11 |
const { user, logout } = useAuth()
|
|
|
|
| 12 |
const [companyName, setCompanyName] = useState<string | null>(null)
|
| 13 |
const [showDropdown, setShowDropdown] = useState(false)
|
| 14 |
|
|
@@ -54,6 +57,9 @@ export function Header() {
|
|
| 54 |
return (
|
| 55 |
<header className="h-16 border-b border-white/10 bg-[#050510] flex items-center justify-end px-6 sticky top-0 z-30">
|
| 56 |
<div className="flex items-center gap-4">
|
|
|
|
|
|
|
|
|
|
| 57 |
{/* User Profile with Dropdown */}
|
| 58 |
<div className="relative">
|
| 59 |
<button
|
|
@@ -102,7 +108,7 @@ export function Header() {
|
|
| 102 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"
|
| 103 |
>
|
| 104 |
<User className="w-4 h-4" />
|
| 105 |
-
|
| 106 |
</Link>
|
| 107 |
<Link
|
| 108 |
href="/settings/brain"
|
|
@@ -110,7 +116,7 @@ export function Header() {
|
|
| 110 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"
|
| 111 |
>
|
| 112 |
<Settings className="w-4 h-4" />
|
| 113 |
-
|
| 114 |
</Link>
|
| 115 |
</div>
|
| 116 |
<div className="border-t border-white/10 py-1">
|
|
@@ -119,7 +125,7 @@ export function Header() {
|
|
| 119 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-red-400 hover:text-red-300 hover:bg-red-500/10 transition w-full text-left"
|
| 120 |
>
|
| 121 |
<LogOut className="w-4 h-4" />
|
| 122 |
-
|
| 123 |
</button>
|
| 124 |
</div>
|
| 125 |
</div>
|
|
|
|
| 6 |
import { cn } from '@/lib/utils'
|
| 7 |
import { api } from '@/lib/api'
|
| 8 |
import Link from 'next/link'
|
| 9 |
+
import { LanguageSwitcher } from './LanguageSwitcher'
|
| 10 |
+
import { useTranslation } from '@/lib/i18n'
|
| 11 |
|
| 12 |
export function Header() {
|
| 13 |
const { user, logout } = useAuth()
|
| 14 |
+
const { t } = useTranslation()
|
| 15 |
const [companyName, setCompanyName] = useState<string | null>(null)
|
| 16 |
const [showDropdown, setShowDropdown] = useState(false)
|
| 17 |
|
|
|
|
| 57 |
return (
|
| 58 |
<header className="h-16 border-b border-white/10 bg-[#050510] flex items-center justify-end px-6 sticky top-0 z-30">
|
| 59 |
<div className="flex items-center gap-4">
|
| 60 |
+
{/* Language Switcher */}
|
| 61 |
+
<LanguageSwitcher />
|
| 62 |
+
|
| 63 |
{/* User Profile with Dropdown */}
|
| 64 |
<div className="relative">
|
| 65 |
<button
|
|
|
|
| 108 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"
|
| 109 |
>
|
| 110 |
<User className="w-4 h-4" />
|
| 111 |
+
{t('header.profile')}
|
| 112 |
</Link>
|
| 113 |
<Link
|
| 114 |
href="/settings/brain"
|
|
|
|
| 116 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"
|
| 117 |
>
|
| 118 |
<Settings className="w-4 h-4" />
|
| 119 |
+
{t('header.settings')}
|
| 120 |
</Link>
|
| 121 |
</div>
|
| 122 |
<div className="border-t border-white/10 py-1">
|
|
|
|
| 125 |
className="flex items-center gap-3 px-4 py-2.5 text-sm text-red-400 hover:text-red-300 hover:bg-red-500/10 transition w-full text-left"
|
| 126 |
>
|
| 127 |
<LogOut className="w-4 h-4" />
|
| 128 |
+
{t('header.logout')}
|
| 129 |
</button>
|
| 130 |
</div>
|
| 131 |
</div>
|
frontend/lib/i18n/translations/en.ts
CHANGED
|
@@ -40,6 +40,13 @@ export const en = {
|
|
| 40 |
copied: 'Copied',
|
| 41 |
},
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Navigation / Sidebar
|
| 44 |
nav: {
|
| 45 |
dashboard: 'Dashboard',
|
|
|
|
| 40 |
copied: 'Copied',
|
| 41 |
},
|
| 42 |
|
| 43 |
+
// Header
|
| 44 |
+
header: {
|
| 45 |
+
profile: 'Profile',
|
| 46 |
+
settings: 'Settings',
|
| 47 |
+
logout: 'Logout',
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
// Navigation / Sidebar
|
| 51 |
nav: {
|
| 52 |
dashboard: 'Dashboard',
|
frontend/lib/i18n/translations/ky.ts
CHANGED
|
@@ -40,6 +40,13 @@ export const ky = {
|
|
| 40 |
copied: 'Көчүрүлдү',
|
| 41 |
},
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Navigation / Sidebar
|
| 44 |
nav: {
|
| 45 |
dashboard: 'Башкы бет',
|
|
|
|
| 40 |
copied: 'Көчүрүлдү',
|
| 41 |
},
|
| 42 |
|
| 43 |
+
// Header
|
| 44 |
+
header: {
|
| 45 |
+
profile: 'Профиль',
|
| 46 |
+
settings: 'Жөндөөлөр',
|
| 47 |
+
logout: 'Чыгуу',
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
// Navigation / Sidebar
|
| 51 |
nav: {
|
| 52 |
dashboard: 'Башкы бет',
|
frontend/lib/i18n/translations/ru.ts
CHANGED
|
@@ -40,6 +40,13 @@ export const ru = {
|
|
| 40 |
copied: 'Скопировано',
|
| 41 |
},
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Navigation / Sidebar
|
| 44 |
nav: {
|
| 45 |
dashboard: 'Главная',
|
|
|
|
| 40 |
copied: 'Скопировано',
|
| 41 |
},
|
| 42 |
|
| 43 |
+
// Header
|
| 44 |
+
header: {
|
| 45 |
+
profile: 'Профиль',
|
| 46 |
+
settings: 'Настройки',
|
| 47 |
+
logout: 'Выйти',
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
// Navigation / Sidebar
|
| 51 |
nav: {
|
| 52 |
dashboard: 'Главная',
|