Customer Detail Page and Enhance dynamic breadcrumbs

This commit is contained in:
2025-07-06 17:24:12 +00:00
parent 055d19d201
commit e00142ff81
14 changed files with 934 additions and 69 deletions

View File

@@ -1,19 +1,18 @@
// utils/getBreadcrumbs.ts
import {breadcrumbMap} from '@/lib/breadcrumb-map';
import {breadcrumbMap} from "@/lib/breadcrumb-map";
export type Breadcrumb = {
label: string;
export interface Breadcrumb {
href: string;
isCurrentPage?: boolean;
};
label: string;
isCurrentPage: boolean;
}
export function getBreadcrumbs(path: string): Breadcrumb[] {
const pathSegments = path.split('/').filter(Boolean);
return pathSegments.map((segment, index) => {
const href = `/${pathSegments.slice(0, index + 1).join('/')}`;
// Use the mapping if it exists, otherwise format the segment
const label = breadcrumbMap[segment.toLowerCase()] ||
const label =
breadcrumbMap[segment.toLowerCase()] ||
segment
.split('-')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
@@ -22,7 +21,7 @@ export function getBreadcrumbs(path: string): Breadcrumb[] {
return {
label,
href,
isCurrentPage: index === pathSegments.length - 1
isCurrentPage: index === pathSegments.length - 1,
};
});
}