english version update

This commit is contained in:
Georgiy Syralev
2025-12-31 19:59:43 +03:00
parent b799f278a4
commit a2809a705f
57 changed files with 4263 additions and 1333 deletions

View File

@@ -3,10 +3,14 @@ import { useState } from 'react';
import useAuth from '../context/useAuth';
import logo from '../assets/logo.svg';
import NotificationBell from './NotificationBell';
import { useTranslation } from '../i18n';
import { useLocalePath } from '../middleware';
const Header = () => {
const { isLoggedIn, logout } = useAuth();
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const { t } = useTranslation();
const localePath = useLocalePath();
const handleLogout = () => {
logout();
@@ -18,36 +22,36 @@ const Header = () => {
<div className="container mx-auto px-4 py-4">
<div className="flex justify-between items-center">
<div className="flex items-center gap-1">
<Link to="/" className="flex items-center">
<img src={logo} alt="Логотип" className="h-10 lg:h-14 w-auto mr-2" width="56" height="56" />
<Link to={localePath('/')} className="flex items-center">
<img src={logo} alt="Logo" className="h-10 lg:h-14 w-auto mr-2" width="56" height="56" />
<span className="font-mono text-xl lg:text-2xl text-gray-800 font-bold">ospab.host</span>
</Link>
</div>
{/* Desktop Menu */}
<div className="hidden md:flex items-center space-x-4">
<Link to="/tariffs" className="text-gray-600 hover:text-ospab-primary transition-colors">Тарифы</Link>
<Link to="/blog" className="text-gray-600 hover:text-ospab-primary transition-colors">Блог</Link>
<Link to="/about" className="text-gray-600 hover:text-ospab-primary transition-colors">О нас</Link>
<Link to={localePath('/tariffs')} className="text-gray-600 hover:text-ospab-primary transition-colors">{t('nav.tariffs')}</Link>
<Link to={localePath('/blog')} className="text-gray-600 hover:text-ospab-primary transition-colors">{t('nav.blog')}</Link>
<Link to={localePath('/about')} className="text-gray-600 hover:text-ospab-primary transition-colors">{t('nav.about')}</Link>
{isLoggedIn ? (
<>
<Link to="/dashboard" className="text-gray-600 hover:text-ospab-primary transition-colors">Личный кабинет</Link>
<Link to={localePath('/dashboard')} className="text-gray-600 hover:text-ospab-primary transition-colors">{t('nav.dashboard')}</Link>
<NotificationBell />
<button
onClick={handleLogout}
className="px-4 py-2 rounded-full text-white font-bold transition-colors transform hover:scale-105 bg-gray-500 hover:bg-red-500"
>
Выйти
{t('nav.logout')}
</button>
</>
) : (
<>
<Link to="/login" className="text-gray-600 hover:text-ospab-primary transition-colors">Войти</Link>
<Link to={localePath('/login')} className="text-gray-600 hover:text-ospab-primary transition-colors">{t('nav.login')}</Link>
<Link
to="/register"
to={localePath('/register')}
className="px-4 py-2 rounded-full text-white font-bold transition-colors transform hover:scale-105 bg-ospab-primary hover:bg-ospab-accent"
>
Зарегистрироваться
{t('nav.register')}
</Link>
</>
)}
@@ -57,7 +61,7 @@ const Header = () => {
<button
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
className="md:hidden p-2 text-gray-800"
aria-label={isMobileMenuOpen ? "Закрыть меню" : "Открыть меню"}
aria-label={isMobileMenuOpen ? t('common.closeMenu') : t('common.openMenu')}
aria-expanded={isMobileMenuOpen}
>
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
@@ -74,57 +78,57 @@ const Header = () => {
{isMobileMenuOpen && (
<div className="md:hidden mt-4 pb-4 space-y-2 border-t border-gray-200 pt-4">
<Link
to="/tariffs"
to={localePath('/tariffs')}
className="block py-2 text-gray-600 hover:text-ospab-primary transition-colors"
onClick={() => setIsMobileMenuOpen(false)}
>
Тарифы
{t('nav.tariffs')}
</Link>
<Link
to="/blog"
to={localePath('/blog')}
className="block py-2 text-gray-600 hover:text-ospab-primary transition-colors"
onClick={() => setIsMobileMenuOpen(false)}
>
Блог
{t('nav.blog')}
</Link>
<Link
to="/about"
to={localePath('/about')}
className="block py-2 text-gray-600 hover:text-ospab-primary transition-colors"
onClick={() => setIsMobileMenuOpen(false)}
>
О нас
{t('nav.about')}
</Link>
{isLoggedIn ? (
<>
<Link
to="/dashboard"
to={localePath('/dashboard')}
className="block py-2 text-gray-600 hover:text-ospab-primary transition-colors"
onClick={() => setIsMobileMenuOpen(false)}
>
Личный кабинет
{t('nav.dashboard')}
</Link>
<button
onClick={handleLogout}
className="w-full text-left py-2 text-gray-600 hover:text-red-500 transition-colors"
>
Выйти
{t('nav.logout')}
</button>
</>
) : (
<>
<Link
to="/login"
to={localePath('/login')}
className="block py-2 text-gray-600 hover:text-ospab-primary transition-colors"
onClick={() => setIsMobileMenuOpen(false)}
>
Войти
{t('nav.login')}
</Link>
<Link
to="/register"
to={localePath('/register')}
className="block w-full text-center mt-2 px-4 py-2 rounded-full text-white font-bold bg-ospab-primary hover:bg-ospab-accent"
onClick={() => setIsMobileMenuOpen(false)}
>
Зарегистрироваться
{t('nav.register')}
</Link>
</>
)}