From a61557f0cc2ee1c2a1e8def762e06689b73316a5 Mon Sep 17 00:00:00 2001 From: Felix Zett Date: Sat, 20 Sep 2025 17:25:36 +0200 Subject: [PATCH] refactor: hamburger for navigation component --- frontend/src/App.tsx | 169 ++++++++++++++++++++++++++----------------- 1 file changed, 101 insertions(+), 68 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 42af6c7..6bf766d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,6 +8,107 @@ import TagsPage from "./pages/TagsPage"; const APP_TITLE = "da packste dich weg"; +function Navigation() { + const location = useLocation(); + const navItems = [ + { to: "/trips", label: "Trips" }, + { to: "/items", label: "Items" }, + { to: "/tags", label: "Tags" }, + ]; + const [menuOpen, setMenuOpen] = useState(false); + + const navigate = useNavigate(); + async function goToCurrentTrip() { + try { + const id = await getNextTripId(); + navigate(`/trips/${id}`); + } catch { + alert("Kein anstehender Trip gefunden"); + } + } + + const isTripDetail = /^\/trips\/[^/]+$/.test(location.pathname); + + return ( + + ); +} + function NextTripRedirect({ trips }: { trips: any[] }) { const [nextTripId, setNextTripId] = React.useState(null); const [error, setError] = React.useState(null); @@ -23,74 +124,6 @@ function NextTripRedirect({ trips }: { trips: any[] }) { return ; } -function Navigation() { - const location = useLocation(); - const navItems = [ - { to: "/trips", label: "Trips" }, - { to: "/items", label: "Items" }, - { to: "/tags", label: "Tags" }, - ]; - - // Navigation für den Titel-Link - const navigate = useNavigate(); - async function goToCurrentTrip() { - try { - const id = await getNextTripId(); - navigate(`/trips/${id}`); - } catch { - alert("Kein anstehender Trip gefunden"); - } - } - - // Prüfe, ob ein einzelner Trip angezeigt wird - const isTripDetail = /^\/trips\/[^/]+$/.test(location.pathname); - - return ( - - ); -} - export default function App() { const [trips, setTrips] = useState([]); const [dbError, setDbError] = useState(null);