From 0b2f8332a253f5c14cc8af75d0a9c2bb9b1fc8ab Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Wed, 2 Jul 2025 01:25:55 +0900 Subject: [PATCH] Add dynamic breadcrumb navigation and update `kanzlei` routes under `/demo` --- .../demo/kanzlei/bilanzbuchhalter/page.tsx | 7 ++ .../app/{ => demo}/kanzlei/page.tsx | 0 .../app/demo/kanzlei/rechtsanwalt/page.tsx | 7 ++ .../app/demo/kanzlei/steuer/page.tsx | 7 ++ internal_frontend/app/demo/settings/page.tsx | 10 ++ internal_frontend/app/layout.tsx | 30 ++++- internal_frontend/components/app-sidebar.tsx | 6 +- .../components/dynamic-breadcrumb.tsx | 42 +++++++ .../components/ui/breadcrumb.tsx | 109 ++++++++++++++++++ internal_frontend/lib/breadcrumb-map.ts | 8 ++ internal_frontend/utils/BreadcrumbUtils.ts | 28 +++++ 11 files changed, 246 insertions(+), 8 deletions(-) create mode 100644 internal_frontend/app/demo/kanzlei/bilanzbuchhalter/page.tsx rename internal_frontend/app/{ => demo}/kanzlei/page.tsx (100%) create mode 100644 internal_frontend/app/demo/kanzlei/rechtsanwalt/page.tsx create mode 100644 internal_frontend/app/demo/kanzlei/steuer/page.tsx create mode 100644 internal_frontend/app/demo/settings/page.tsx create mode 100644 internal_frontend/components/dynamic-breadcrumb.tsx create mode 100644 internal_frontend/components/ui/breadcrumb.tsx create mode 100644 internal_frontend/lib/breadcrumb-map.ts create mode 100644 internal_frontend/utils/BreadcrumbUtils.ts diff --git a/internal_frontend/app/demo/kanzlei/bilanzbuchhalter/page.tsx b/internal_frontend/app/demo/kanzlei/bilanzbuchhalter/page.tsx new file mode 100644 index 0000000..c47a85d --- /dev/null +++ b/internal_frontend/app/demo/kanzlei/bilanzbuchhalter/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+ Bilanzbuchhalter +
+ ); +} diff --git a/internal_frontend/app/kanzlei/page.tsx b/internal_frontend/app/demo/kanzlei/page.tsx similarity index 100% rename from internal_frontend/app/kanzlei/page.tsx rename to internal_frontend/app/demo/kanzlei/page.tsx diff --git a/internal_frontend/app/demo/kanzlei/rechtsanwalt/page.tsx b/internal_frontend/app/demo/kanzlei/rechtsanwalt/page.tsx new file mode 100644 index 0000000..cfda556 --- /dev/null +++ b/internal_frontend/app/demo/kanzlei/rechtsanwalt/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+ Rechtsanwalt +
+ ); +} diff --git a/internal_frontend/app/demo/kanzlei/steuer/page.tsx b/internal_frontend/app/demo/kanzlei/steuer/page.tsx new file mode 100644 index 0000000..4ebdb39 --- /dev/null +++ b/internal_frontend/app/demo/kanzlei/steuer/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+ Steuer +
+ ); +} diff --git a/internal_frontend/app/demo/settings/page.tsx b/internal_frontend/app/demo/settings/page.tsx new file mode 100644 index 0000000..3e25776 --- /dev/null +++ b/internal_frontend/app/demo/settings/page.tsx @@ -0,0 +1,10 @@ +import {SidebarGroupLabel} from "@/components/ui/sidebar"; + +export default function Home() { + return ( +
+ Documents + Settings +
+ ); +} diff --git a/internal_frontend/app/layout.tsx b/internal_frontend/app/layout.tsx index 3e07644..865c33e 100644 --- a/internal_frontend/app/layout.tsx +++ b/internal_frontend/app/layout.tsx @@ -1,9 +1,11 @@ import type {Metadata} from "next"; import "./globals.css"; import {ThemeProvider} from "@/components/theme-provider"; -import {SidebarProvider, SidebarTrigger} from "@/components/ui/sidebar" +import {SidebarInset, SidebarProvider, SidebarTrigger} from "@/components/ui/sidebar" import {AppSidebar} from "@/components/app-sidebar" import React from "react"; +import {Separator} from "@/components/ui/separator"; +import {DynamicBreadcrumb} from "@/components/dynamic-breadcrumb"; export const metadata: Metadata = { title: "Internal | Rhein Software", @@ -16,7 +18,6 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - - +
- + +
+
+ + + +
+
+
{children}
@@ -36,4 +56,4 @@ export default function RootLayout({ ); -} +} \ No newline at end of file diff --git a/internal_frontend/components/app-sidebar.tsx b/internal_frontend/components/app-sidebar.tsx index cb5dd4d..279084a 100644 --- a/internal_frontend/components/app-sidebar.tsx +++ b/internal_frontend/components/app-sidebar.tsx @@ -116,17 +116,17 @@ export function AppSidebar() { - + Steuer - + Rechtsanwalt - + Bilanzbuchhalter diff --git a/internal_frontend/components/dynamic-breadcrumb.tsx b/internal_frontend/components/dynamic-breadcrumb.tsx new file mode 100644 index 0000000..623bb49 --- /dev/null +++ b/internal_frontend/components/dynamic-breadcrumb.tsx @@ -0,0 +1,42 @@ +// components/dynamic-breadcrumb.tsx +'use client'; + +import {usePathname} from 'next/navigation'; +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb"; +import React from 'react'; +import {getBreadcrumbs} from "@/utils/BreadcrumbUtils"; + +export function DynamicBreadcrumb() { + const pathname = usePathname(); + const breadcrumbs = getBreadcrumbs(pathname); + + return ( + + + {breadcrumbs.map((breadcrumb, index) => ( + + + {breadcrumb.isCurrentPage ? ( + {breadcrumb.label} + ) : ( + + {breadcrumb.label} + + )} + + {index < breadcrumbs.length - 1 && ( + + )} + + ))} + + + ); +} \ No newline at end of file diff --git a/internal_frontend/components/ui/breadcrumb.tsx b/internal_frontend/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..eb88f32 --- /dev/null +++ b/internal_frontend/components/ui/breadcrumb.tsx @@ -0,0 +1,109 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { + return