более менее сделан фронтенд, ЛК не работает и система оплаты тоже

This commit is contained in:
Georgiy Syralev
2025-09-16 18:14:47 +03:00
parent 40de29041d
commit f65991c114
31 changed files with 1134 additions and 390 deletions

View File

@@ -1,57 +1,46 @@
import { Link } from 'react-router-dom';
import { useState, useEffect } from 'react';
import useAuth from '../context/useAuth';
const Header = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
const { isLoggedIn, logout } = useAuth();
useEffect(() => {
const checkLoginStatus = () => {
setIsLoggedIn(localStorage.getItem('isLoggedIn') === 'true');
};
checkLoginStatus();
window.addEventListener('storage', checkLoginStatus);
return () => {
window.removeEventListener('storage', checkLoginStatus);
};
}, []);
const handleLogout = () => {
logout();
};
return (
<nav className="bg-white shadow-lg fixed w-full z-10 top-0">
<div className="container mx-auto px-6 py-3">
<div className="flex justify-between items-center">
<div className="text-xl font-bold text-gray-800">
<Link to="/" className="font-mono text-2xl">ospab.host</Link>
</div>
<div className="flex items-center space-x-4">
<Link to="/tariffs" 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>
{isLoggedIn ? (
<>
<Link to="/dashboard" className="text-gray-600 hover:text-ospab-primary transition-colors">Личный кабинет</Link>
<Link
to="/logout"
className="px-4 py-2 rounded-full text-white font-bold transition-colors transform hover:scale-105 bg-gray-500 hover:bg-red-500"
>
Выйти
</Link>
</>
) : (
<>
<Link to="/login" className="text-gray-600 hover:text-ospab-primary transition-colors">Войти</Link>
<Link
to="/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"
>
Зарегистрироваться
</Link>
</>
)}
</div>
<header className="fixed top-0 left-0 right-0 z-50 bg-white shadow-md">
<div className="container mx-auto px-4 py-4 flex justify-between items-center">
<div className="text-xl font-bold text-gray-800">
<Link to="/" className="font-mono text-2xl">ospab.host</Link>
</div>
<div className="flex items-center space-x-4">
<Link to="/tariffs" 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>
{isLoggedIn ? (
<>
<Link to="/dashboard" className="text-gray-600 hover:text-ospab-primary transition-colors">Личный кабинет</Link>
<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"
>
Выйти
</button>
</>
) : (
<>
<Link to="/login" className="text-gray-600 hover:text-ospab-primary transition-colors">Войти</Link>
<Link
to="/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"
>
Зарегистрироваться
</Link>
</>
)}
</div>
</div>
</nav>
</header>
);
};