import React, { useState, useEffect } from 'react'; import { User as UserIcon, LogOut, Search, Folder } from 'lucide-react'; import { useAuth } from '../context/AuthContext'; import { LoginModal } from './LoginModal'; import { SearchModal } from './SearchModal'; import { useNavigate, useLocation } from 'react-router-dom'; import { Course } from '../types'; import { Logo } from './Logo'; interface NavbarProps { onPlay: (course: Course) => void; } export const Navbar: React.FC = ({ onPlay }) => { const [scrolled, setScrolled] = useState(false); const [showLoginModal, setShowLoginModal] = useState(false); const [showSearchModal, setShowSearchModal] = useState(false); const { user, logout } = useAuth(); const navigate = useNavigate(); const location = useLocation(); useEffect(() => { const handleScroll = () => { setScrolled(window.scrollY > 20); }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); const handleLogout = () => { logout(); navigate('/'); }; const isMaterialsPage = location.pathname === '/materiais'; const isHomePage = location.pathname === '/'; return ( <> setShowLoginModal(false)} /> setShowSearchModal(false)} onPlay={onPlay} /> ); };