2026-02-25 09:29:45 +00:00
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
import { useApp } from '../context/AppContext';
|
2026-03-15 15:05:19 +00:00
|
|
|
import { useAuth } from '../hooks/useAuth';
|
|
|
|
|
import { TaskboardLogo } from './TaskboardLogo';
|
2026-02-24 08:52:57 +00:00
|
|
|
|
|
|
|
|
export function Navbar() {
|
2026-02-25 09:29:45 +00:00
|
|
|
const { user } = useApp();
|
2026-03-15 15:05:19 +00:00
|
|
|
const { logout } = useAuth();
|
2026-02-24 08:52:57 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<nav className="bg-gray-800 border-b border-gray-700 shadow-md">
|
|
|
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
|
|
|
<div className="flex items-center justify-between h-16">
|
2026-03-15 15:05:19 +00:00
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<Link to="/boards" className="hover:opacity-80 transition-opacity">
|
|
|
|
|
<TaskboardLogo className="h-8 w-auto" />
|
|
|
|
|
</Link>
|
2026-02-25 09:29:45 +00:00
|
|
|
<Link
|
2026-03-15 15:05:19 +00:00
|
|
|
to="/boards"
|
2026-02-25 09:29:45 +00:00
|
|
|
className="text-xl font-bold text-white hover:text-blue-400 transition-colors"
|
|
|
|
|
>
|
2026-03-15 15:05:19 +00:00
|
|
|
Taskboard
|
2026-02-24 08:52:57 +00:00
|
|
|
</Link>
|
|
|
|
|
<div className="ml-10 flex items-baseline space-x-4">
|
|
|
|
|
<Link
|
2026-03-15 15:05:19 +00:00
|
|
|
to="/home"
|
2026-02-24 08:52:57 +00:00
|
|
|
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
|
|
|
|
|
>
|
|
|
|
|
Home
|
|
|
|
|
</Link>
|
2026-03-15 15:05:19 +00:00
|
|
|
|
2026-02-24 08:52:57 +00:00
|
|
|
{user && (
|
2026-03-15 15:05:19 +00:00
|
|
|
<Link
|
|
|
|
|
to="/boards"
|
|
|
|
|
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
|
|
|
|
|
>
|
|
|
|
|
Boards
|
|
|
|
|
</Link>
|
2026-02-24 08:52:57 +00:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-15 15:05:19 +00:00
|
|
|
<div className="flex items-center gap-3">
|
2026-02-24 08:52:57 +00:00
|
|
|
{user ? (
|
2026-03-15 15:05:19 +00:00
|
|
|
<>
|
|
|
|
|
<span className="text-gray-300 px-3 py-2">{user.username}</span>
|
|
|
|
|
<button
|
|
|
|
|
onClick={logout}
|
|
|
|
|
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
|
|
|
|
|
>
|
|
|
|
|
Logout
|
|
|
|
|
</button>
|
|
|
|
|
</>
|
2026-02-24 08:52:57 +00:00
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<Link
|
|
|
|
|
to="/login"
|
|
|
|
|
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
|
|
|
|
|
>
|
|
|
|
|
Login
|
|
|
|
|
</Link>
|
|
|
|
|
<Link
|
|
|
|
|
to="/register"
|
|
|
|
|
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors"
|
|
|
|
|
>
|
|
|
|
|
Register
|
|
|
|
|
</Link>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
2026-02-25 09:29:45 +00:00
|
|
|
);
|
|
|
|
|
}
|