From 7e8422cbd7172cc3091a7300502014033442819d Mon Sep 17 00:00:00 2001 From: Lars Date: Sun, 5 Apr 2026 07:58:38 +0200 Subject: [PATCH] feat: Implement responsive desktop sidebar navigation and update app structure --- docs/issues/PHASE_PLAN_RESPONSIVE_UI.md | 8 +- frontend/src/App.jsx | 127 ++++++++------ frontend/src/app.css | 187 +++++++++++++++++++++ frontend/src/components/DesktopSidebar.jsx | 84 +++++++++ frontend/src/config/appNav.js | 43 +++++ 5 files changed, 397 insertions(+), 52 deletions(-) create mode 100644 frontend/src/components/DesktopSidebar.jsx create mode 100644 frontend/src/config/appNav.js diff --git a/docs/issues/PHASE_PLAN_RESPONSIVE_UI.md b/docs/issues/PHASE_PLAN_RESPONSIVE_UI.md index 1e60f56..332ae17 100644 --- a/docs/issues/PHASE_PLAN_RESPONSIVE_UI.md +++ b/docs/issues/PHASE_PLAN_RESPONSIVE_UI.md @@ -3,7 +3,7 @@ > **Gitea:** [#30 – Responsive UI](http://192.168.2.144:3000/Lars/mitai-jinkendo/issues/30) > **Spec:** `.claude/docs/functional/RESPONSIVE_UI.md` > **Breakpoint:** `<1024px` = Mobile (Bottom-Nav, bestehendes Verhalten), `≥1024px` = Desktop (Sidebar 220px) -> **Letzte Plan-Aktualisierung:** 2026-04-04 +> **Letzte Plan-Aktualisierung:** 2026-04-05 --- @@ -11,9 +11,9 @@ | Phase | Titel | Status | Datum / Notiz | |-------|--------|--------|----------------| -| P0 | Vorbereitung & Baseline | ☐ pending | | -| P1 | App-Shell: Sidebar + Breakpoint + gemeinsame Navigation | ☐ pending | | -| P2 | Globales Layout & Content-Bereich (CSS) | ☐ pending | | +| P0 | Vorbereitung & Baseline | ☑ erledigt | Spec `RESPONSIVE_UI.md` bereinigt | +| P1 | App-Shell: Sidebar + Breakpoint + gemeinsame Navigation | ☑ erledigt | `DesktopSidebar`, `config/appNav.js`, Admin `/admin/*`-Highlight | +| P2 | Globales Layout & Content-Bereich (CSS) | ☑ erledigt | Desktop: Header aus, Content max 1200px; Mobile unverändert Bottom-Nav | | P3 | Dashboard (Desktop-Grid) | ☐ pending | | | P4 | Verlauf (Tabs links / Content rechts) | ☐ pending | | | P5 | Analyse (Prompts links / Ergebnis rechts) | ☐ pending | | diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 5175e20..9e75963 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { BrowserRouter, Routes, Route, NavLink, useNavigate } from 'react-router-dom' -import { LayoutDashboard, PlusSquare, TrendingUp, BarChart2, Settings, LogOut } from 'lucide-react' +import { BrowserRouter, Routes, Route, NavLink, useLocation } from 'react-router-dom' +import { LogOut } from 'lucide-react' import { ProfileProvider, useProfile } from './context/ProfileContext' import { AuthProvider, useAuth } from './context/AuthContext' import { setProfileId } from './utils/api' @@ -40,21 +40,32 @@ import VitalsPage from './pages/VitalsPage' import GoalsPage from './pages/GoalsPage' import CustomGoalsPage from './pages/CustomGoalsPage' import WorkflowEditorPage from './pages/WorkflowEditorPage' +import DesktopSidebar from './components/DesktopSidebar' +import { getMainNavItems } from './config/appNav' import './app.css' -function Nav() { - const links = [ - { to:'/', icon:, label:'Übersicht' }, - { to:'/capture', icon:, label:'Erfassen' }, - { to:'/history', icon:, label:'Verlauf' }, - { to:'/analysis', icon:, label:'Analyse' }, - { to:'/settings', icon:, label:'Einst.' }, - ] +function navItemActive(pathname, item, routerIsActive) { + if (item.to.startsWith('/admin')) return pathname.startsWith('/admin') + return routerIsActive +} + +function Nav({ isAdmin }) { + const items = getMainNavItems(isAdmin) + const loc = useLocation() return ( @@ -62,9 +73,8 @@ function Nav() { } function AppShell() { - const { session, loading: authLoading, needsSetup, logout } = useAuth() - const { activeProfile, loading: profileLoading } = useProfile() - const nav = useNavigate() + const { session, loading: authLoading, needsSetup, logout, isAdmin } = useAuth() + const { activeProfile, loading: profileLoading } = useProfile() const handleLogout = () => { if (confirm('Wirklich abmelden?')) { @@ -136,36 +146,56 @@ function AppShell() { return (
-
- Mitai Jinkendo -
- - - {activeProfile - ? - :
- } - -
-
-
+ +
+
+ Mitai Jinkendo +
+ + + {activeProfile ? ( + + ) : ( +
+ )} + +
+
+
}/> }/> @@ -198,8 +228,9 @@ function AppShell() { }/> }/> -
-
+
+