- {result.profile.name} ({result.profile.role})
+ {result.profile.name} · {rollenBezeichnung(result.profile.role)}
@@ -87,7 +92,8 @@ export default async function RootLayout({
)}
-
{children}
+
0 ? "pb-20 lg:pb-0" : ""}`}>{children}
+ {untereLeiste.length > 0 &&
}
);
diff --git a/web/app/page.tsx b/web/app/page.tsx
index 8307ad3..6dda833 100644
--- a/web/app/page.tsx
+++ b/web/app/page.tsx
@@ -1,8 +1,8 @@
import { redirect } from "next/navigation";
import { loadProfile } from "@/lib/auth/profile";
+import { navigationFuer } from "@/lib/navigation";
export default async function Home() {
const result = await loadProfile();
- if (result.status === "ok" && result.profile.role === "superadmin") redirect("/plattform");
- redirect("/dashboard");
+ redirect(result.status === "ok" ? navigationFuer(result.profile.role).start : "/dashboard");
}
diff --git a/web/components/MobileNav.tsx b/web/components/MobileNav.tsx
index 5908f3f..6402329 100644
--- a/web/components/MobileNav.tsx
+++ b/web/components/MobileNav.tsx
@@ -1,9 +1,27 @@
"use client";
import { useEffect, useState } from "react";
+import { usePathname } from "next/navigation";
+import { MENUE_OEFFNEN } from "@/components/navigation/UntereLeiste";
export function MobileNav({ children }: { children: React.ReactNode }) {
- const [open, setOpen] = useState(false);
+ const pfad = usePathname();
+ // Das Menue merkt sich die Seite, auf der es geoeffnet wurde: nach einem
+ // Seitenwechsel ueber einen Menue-Link gilt es damit automatisch als geschlossen.
+ const [offenAuf, setOffenAuf] = useState
(null);
+ const open = offenAuf !== null && offenAuf === pfad;
+ const setOpen = (wert: boolean | ((alt: boolean) => boolean)) =>
+ setOffenAuf((alt) => {
+ const war = alt !== null && alt === pfad;
+ return (typeof wert === "function" ? wert(war) : wert) ? pfad : null;
+ });
+
+ // "Mehr" in der unteren Leiste oeffnet dieses Menue.
+ useEffect(() => {
+ const oeffnen = () => setOffenAuf(pfad);
+ window.addEventListener(MENUE_OEFFNEN, oeffnen);
+ return () => window.removeEventListener(MENUE_OEFFNEN, oeffnen);
+ }, [pfad]);
useEffect(() => {
if (!open) return;
@@ -40,7 +58,7 @@ export function MobileNav({ children }: { children: React.ReactNode }) {
onClick={() => setOpen(false)}
className="absolute inset-0 bg-black/40"
/>
-
+