From e84ba761c7c4205778e9a7c6630bfbdfb8ff76ce Mon Sep 17 00:00:00 2001 From: seb Date: Tue, 23 Jun 2026 11:44:14 +0200 Subject: [PATCH] routes --- src/App.jsx | 72 ++++++++----------- .../SectionLayout.jsx} | 6 +- src/pages/SubPage.jsx | 9 --- src/pages/artikel/index.jsx | 7 ++ src/pages/artikel/kategorien.jsx | 7 ++ src/pages/artikel/lager.jsx | 7 ++ src/pages/auftrag/archiv.jsx | 7 ++ src/pages/auftrag/index.jsx | 7 ++ src/pages/index.jsx | 10 +++ src/pages/infos/index.jsx | 10 +++ src/pages/kunde/gruppen.jsx | 7 ++ src/pages/kunde/index.jsx | 7 ++ src/pages/kunde/kontakte.jsx | 7 ++ src/pages/lieferung/index.jsx | 10 +++ 14 files changed, 118 insertions(+), 55 deletions(-) rename src/{pages/SectionPage.jsx => components/SectionLayout.jsx} (81%) delete mode 100644 src/pages/SubPage.jsx create mode 100644 src/pages/artikel/index.jsx create mode 100644 src/pages/artikel/kategorien.jsx create mode 100644 src/pages/artikel/lager.jsx create mode 100644 src/pages/auftrag/archiv.jsx create mode 100644 src/pages/auftrag/index.jsx create mode 100644 src/pages/index.jsx create mode 100644 src/pages/infos/index.jsx create mode 100644 src/pages/kunde/gruppen.jsx create mode 100644 src/pages/kunde/index.jsx create mode 100644 src/pages/kunde/kontakte.jsx create mode 100644 src/pages/lieferung/index.jsx diff --git a/src/App.jsx b/src/App.jsx index eec455c..e89faf0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,48 +4,18 @@ import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; import { useAuth } from './auth/useAuth'; import LoginPage from './components/LoginPage'; import AppShell from './components/AppShell'; -import SectionPage from './pages/SectionPage'; -import SubPage from './pages/SubPage'; -import { NAV_ITEMS, SUB_NAV } from './nav'; - -function sectionRoutes(path) { - const subNav = SUB_NAV[path]; - const routePath = path === '/' ? undefined : path.slice(1); - - if (subNav) { - return ( - }> - {subNav.map(({ segment, label }) => - segment ? ( - } - /> - ) : ( - } /> - ), - )} - - ); - } - - const label = NAV_ITEMS.find((n) => n.path === path)?.label; - - if (path === '/') { - return ( - } /> - ); - } - - return ( - } - /> - ); -} +import SectionLayout from './components/SectionLayout'; +import HomePage from './pages/index'; +import ArtikelUebersichtPage from './pages/artikel/index'; +import ArtikelKategorienPage from './pages/artikel/kategorien'; +import ArtikelLagerPage from './pages/artikel/lager'; +import LieferungPage from './pages/lieferung/index'; +import AuftragAktivePage from './pages/auftrag/index'; +import AuftragArchivPage from './pages/auftrag/archiv'; +import KundeListePage from './pages/kunde/index'; +import KundeGruppenPage from './pages/kunde/gruppen'; +import KundeKontaktePage from './pages/kunde/kontakte'; +import InfosPage from './pages/infos/index'; export default function App() { const { status } = useAuth(); @@ -74,7 +44,23 @@ export default function App() { }> - {NAV_ITEMS.map((item) => sectionRoutes(item.path))} + } /> + } /> + } /> + }> + } /> + } /> + } /> + + }> + } /> + } /> + + }> + } /> + } /> + } /> + } /> diff --git a/src/pages/SectionPage.jsx b/src/components/SectionLayout.jsx similarity index 81% rename from src/pages/SectionPage.jsx rename to src/components/SectionLayout.jsx index 35c6bcd..3cffc56 100644 --- a/src/pages/SectionPage.jsx +++ b/src/components/SectionLayout.jsx @@ -1,8 +1,8 @@ import { Outlet, useLocation } from 'react-router-dom'; -import PageLayout from '../components/PageLayout'; +import PageLayout from './PageLayout'; import { NAV_ITEMS, SUB_NAV } from '../nav'; -export default function SectionPage({ sectionPath, children }) { +export default function SectionLayout({ sectionPath }) { const { pathname } = useLocation(); const title = NAV_ITEMS.find((item) => item.path === sectionPath)?.label ?? ''; const subNav = SUB_NAV[sectionPath]; @@ -14,7 +14,7 @@ export default function SectionPage({ sectionPath, children }) { return ( - {children ?? } + ); } diff --git a/src/pages/SubPage.jsx b/src/pages/SubPage.jsx deleted file mode 100644 index 5f18e34..0000000 --- a/src/pages/SubPage.jsx +++ /dev/null @@ -1,9 +0,0 @@ -import Typography from '@mui/material/Typography'; - -export default function SubPage({ title, description }) { - return ( - - {description ?? `${title} — Inhalt folgt.`} - - ); -} diff --git a/src/pages/artikel/index.jsx b/src/pages/artikel/index.jsx new file mode 100644 index 0000000..c0af29d --- /dev/null +++ b/src/pages/artikel/index.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function ArtikelUebersichtPage() { + return ( + Übersicht — Inhalt folgt. + ); +} diff --git a/src/pages/artikel/kategorien.jsx b/src/pages/artikel/kategorien.jsx new file mode 100644 index 0000000..42487e2 --- /dev/null +++ b/src/pages/artikel/kategorien.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function ArtikelKategorienPage() { + return ( + Kategorien — Inhalt folgt. + ); +} diff --git a/src/pages/artikel/lager.jsx b/src/pages/artikel/lager.jsx new file mode 100644 index 0000000..8ba047f --- /dev/null +++ b/src/pages/artikel/lager.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function ArtikelLagerPage() { + return ( + Lager — Inhalt folgt. + ); +} diff --git a/src/pages/auftrag/archiv.jsx b/src/pages/auftrag/archiv.jsx new file mode 100644 index 0000000..f7c381e --- /dev/null +++ b/src/pages/auftrag/archiv.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function AuftragArchivPage() { + return ( + Archiv — Inhalt folgt. + ); +} diff --git a/src/pages/auftrag/index.jsx b/src/pages/auftrag/index.jsx new file mode 100644 index 0000000..3d07381 --- /dev/null +++ b/src/pages/auftrag/index.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function AuftragAktivePage() { + return ( + Aktive Aufträge — Inhalt folgt. + ); +} diff --git a/src/pages/index.jsx b/src/pages/index.jsx new file mode 100644 index 0000000..d508180 --- /dev/null +++ b/src/pages/index.jsx @@ -0,0 +1,10 @@ +import Typography from '@mui/material/Typography'; +import PageLayout from '../components/PageLayout'; + +export default function HomePage() { + return ( + + Home — Inhalt folgt. + + ); +} diff --git a/src/pages/infos/index.jsx b/src/pages/infos/index.jsx new file mode 100644 index 0000000..ddd6a16 --- /dev/null +++ b/src/pages/infos/index.jsx @@ -0,0 +1,10 @@ +import Typography from '@mui/material/Typography'; +import PageLayout from '../../components/PageLayout'; + +export default function InfosPage() { + return ( + + Infos — Inhalt folgt. + + ); +} diff --git a/src/pages/kunde/gruppen.jsx b/src/pages/kunde/gruppen.jsx new file mode 100644 index 0000000..7dc5729 --- /dev/null +++ b/src/pages/kunde/gruppen.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function KundeGruppenPage() { + return ( + Gruppen — Inhalt folgt. + ); +} diff --git a/src/pages/kunde/index.jsx b/src/pages/kunde/index.jsx new file mode 100644 index 0000000..07f4ba8 --- /dev/null +++ b/src/pages/kunde/index.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function KundeListePage() { + return ( + Kundenliste — Inhalt folgt. + ); +} diff --git a/src/pages/kunde/kontakte.jsx b/src/pages/kunde/kontakte.jsx new file mode 100644 index 0000000..ea61351 --- /dev/null +++ b/src/pages/kunde/kontakte.jsx @@ -0,0 +1,7 @@ +import Typography from '@mui/material/Typography'; + +export default function KundeKontaktePage() { + return ( + Kontakte — Inhalt folgt. + ); +} diff --git a/src/pages/lieferung/index.jsx b/src/pages/lieferung/index.jsx new file mode 100644 index 0000000..2bab0b5 --- /dev/null +++ b/src/pages/lieferung/index.jsx @@ -0,0 +1,10 @@ +import Typography from '@mui/material/Typography'; +import PageLayout from '../../components/PageLayout'; + +export default function LieferungPage() { + return ( + + Lieferung — Inhalt folgt. + + ); +}