From 4397617cf106cecb3c50d89ec4f867d02bf5e251 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Mon, 27 Jul 2026 19:24:19 -0500 Subject: [PATCH] Add mobile navigation menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nav links (Library/Series/Shelf/Music/Wishlist/Admin) were hidden below the md breakpoint with no mobile alternative — there was no way to navigate the app at all on a phone besides the logo link and search/settings icons. Adds a hamburger toggle and slide-down menu with the same links plus Upload/Settings/Sign Out, closing automatically on navigation. --- frontend/src/components/Navbar.jsx | 45 +++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 9934ff6..a53b014 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -1,7 +1,7 @@ -import { Link, NavLink, useNavigate } from "react-router-dom"; +import { Link, NavLink, useNavigate, useLocation } from "react-router-dom"; import { useAuth } from "../lib/auth"; import { useProfile } from "../lib/profile"; -import { Search, LogOut, Upload, Settings as SettingsIcon } from "lucide-react"; +import { Search, LogOut, Upload, Settings as SettingsIcon, Menu, X } from "lucide-react"; import { useState, useEffect } from "react"; import api from "../lib/api"; @@ -9,8 +9,10 @@ export const Navbar = () => { const { user, logout } = useAuth(); const { active } = useProfile(); const nav = useNavigate(); + const location = useLocation(); const [scrolled, setScrolled] = useState(false); const [version, setVersion] = useState(""); + const [mobileOpen, setMobileOpen] = useState(false); useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 20); @@ -22,11 +24,17 @@ export const Navbar = () => { api.get("/version").then(({ data }) => setVersion(data.version)).catch(() => {}); }, []); + // Close the mobile menu on navigation so it never lingers open over the next page. + useEffect(() => { setMobileOpen(false); }, [location.pathname]); + const linkClass = ({ isActive }) => `text-sm tracking-wide transition-colors duration-300 ${isActive ? "text-white" : "text-[#8A8A8A] hover:text-white"}`; + const mobileLinkClass = ({ isActive }) => + `block py-3 text-base tracking-wide transition-colors duration-300 ${isActive ? "text-white" : "text-[#8A8A8A]"}`; + return ( -
+
@@ -68,15 +76,44 @@ export const Navbar = () => {
)} - + ) : ( Sign in )} + + {user && mobileOpen && ( + + )}
); };