mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 09:13:11 +00:00
80 lines
2 KiB
TypeScript
80 lines
2 KiB
TypeScript
import type { LucideIcon } from "lucide-react";
|
|
import {
|
|
// BarChart2,
|
|
BriefcaseBusiness,
|
|
Building2,
|
|
ClipboardList,
|
|
FileText,
|
|
LayoutDashboard,
|
|
MapPin,
|
|
Bell,
|
|
BarChart3,
|
|
Star,
|
|
Users,
|
|
} from "lucide-react";
|
|
|
|
export type NavItemDef = {
|
|
label: string;
|
|
icon: LucideIcon;
|
|
path: string;
|
|
badge?: number;
|
|
};
|
|
|
|
export type NavGroup = {
|
|
title: string;
|
|
items: NavItemDef[];
|
|
};
|
|
|
|
export const SIDEBAR_WIDTH = 244;
|
|
|
|
export const SIDEBAR_COLLAPSED_WIDTH = 76;
|
|
|
|
export function getSidebarWidth(collapsed: boolean): number {
|
|
return collapsed ? SIDEBAR_COLLAPSED_WIDTH : SIDEBAR_WIDTH;
|
|
}
|
|
|
|
export const navGroups: NavGroup[] = [
|
|
{
|
|
title: "",
|
|
items: [
|
|
{ label: "Work Orders", icon: ClipboardList, path: "/workorders", badge: 11 },
|
|
{ label: "Dashboard", icon: LayoutDashboard, path: "/" },
|
|
{ label: "Notifications", icon: Bell, path: "/notifications" },
|
|
// { label: "Reports", icon: BarChart2, path: "/reports" },
|
|
],
|
|
},
|
|
{
|
|
title: "VENDORS",
|
|
items: [
|
|
{ label: "Vendors", icon: Building2, path: "/vendors" },
|
|
{ label: "Vendor POs", icon: FileText, path: "/vendor-pos" },
|
|
{ label: "Vendor Insights", icon: BarChart3, path: "/vendors/insights" },
|
|
{ label: "Site Preferences", icon: Star, path: "/vendors/preferences" },
|
|
],
|
|
},
|
|
{
|
|
title: "CUSTOMERS & SITES",
|
|
items: [
|
|
{ label: "Accounts", icon: BriefcaseBusiness, path: "/accounts" },
|
|
{ label: "Sites", icon: MapPin, path: "/locations" },
|
|
],
|
|
},
|
|
{
|
|
title: "TEAM",
|
|
items: [{ label: "Team Members", icon: Users, path: "/team-members" }],
|
|
},
|
|
// {
|
|
// title: "INTERNAL",
|
|
// items: [{ label: "Documents", icon: FileText, path: "/documents" }],
|
|
// },
|
|
];
|
|
|
|
export function getActiveNavPath(pathname: string): string | undefined {
|
|
return navGroups
|
|
.flatMap((group) => group.items)
|
|
.map((item) => item.path)
|
|
.filter((path) =>
|
|
path === "/" ? pathname === path : pathname === path || pathname.startsWith(`${path}/`),
|
|
)
|
|
.sort((firstPath, secondPath) => secondPath.length - firstPath.length)[0];
|
|
}
|