'use client';
import Link from 'next/link';
import { usePathname, useSearchParams } from 'next/navigation';
import { cn } from '@/lib/utils';
import {
LayoutDashboard,
FileText,
FileCheck,
PenTool,
Search,
Settings,
Shield,
Menu,
Layers,
LucideIcon,
} from 'lucide-react';
import { Button } from '@/components/ui/button';
import { useState } from 'react';
import { Can } from '@/components/common/can';
import { useAuthStore } from '@/lib/stores/auth-store';
export type NavItem = {
title: string;
href: string;
icon: LucideIcon;
permission?: string | null;
adminOnly?: boolean;
matchType?: string;
excludeType?: string;
};
export const mainNavItems: NavItem[] = [
{
title: 'Dashboard',
href: '/dashboard',
icon: LayoutDashboard,
permission: null, // Everyone can see
},
{
title: 'Correspondences',
href: '/correspondences',
icon: FileText,
permission: null,
excludeType: 'RFA',
},
{
title: 'RFAs',
href: '/correspondences?type=RFA',
icon: FileCheck,
permission: null,
matchType: 'RFA',
},
{
title: 'Drawings',
href: '/drawings',
icon: PenTool,
permission: null,
},
{
title: 'Circulations',
href: '/circulation',
icon: Layers, // Start with generic icon, maybe update import if needed
permission: null,
},
{
title: 'Transmittals',
href: '/transmittals',
icon: FileText,
permission: null,
},
{
title: 'Search',
href: '/search',
icon: Search,
permission: null,
},
{
title: 'Admin Panel',
href: '/admin',
icon: Shield,
permission: null,
adminOnly: true,
},
];
interface SidebarProps {
className?: string;
}
export function Sidebar({ className }: SidebarProps) {
const pathname = usePathname();
const searchParams = useSearchParams();
const [collapsed, setCollapsed] = useState(false);
const user = useAuthStore((state) => state.user);
const isAdmin = user?.role === 'ADMIN' || user?.role === 'DC';
const currentType = searchParams.get('type')?.toUpperCase();
return (
{!collapsed && LCBP3 DMS}
{!collapsed && Settings}
);
}
import { Sheet, SheetContent, SheetTrigger, SheetTitle } from '@/components/ui/sheet';
export function MobileSidebar() {
const pathname = usePathname();
const searchParams = useSearchParams();
const [open, setOpen] = useState(false);
const user = useAuthStore((state) => state.user);
const isAdmin = user?.role === 'ADMIN' || user?.role === 'DC';
const currentType = searchParams.get('type')?.toUpperCase();
return (
Mobile Navigation
LCBP3 DMS
setOpen(false)}
className="flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
>
Settings
);
}