"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { LayoutDashboard, BookOpen, CalendarRange, Coins, Landmark, FolderKanban, FileText, Wallet, Users, Building2, Briefcase, FileBarChart2, ShieldCheck, Settings, Moon, Sun, ChevronRight, Scale, Wrench, Truck, Plus, MoreHorizontal, } from "lucide-react"; import { cn } from "@/lib/utils"; import { useColorMode } from "@/components/providers/ColorModeProvider"; import { Button } from "@/components/ds"; const NAV = [ { href: "/accounting", label: "داشبورد", icon: LayoutDashboard }, { href: "/accounting/chart-of-accounts", label: "دفتر حساب‌ها", icon: BookOpen }, { href: "/accounting/fiscal", label: "سال و دوره مالی", icon: CalendarRange }, { href: "/accounting/currencies", label: "ارزها", icon: Coins }, { href: "/accounting/cost-centers", label: "مراکز هزینه", icon: Landmark }, { href: "/accounting/projects", label: "پروژه‌ها", icon: FolderKanban }, { href: "/accounting/vouchers", label: "اسناد و ثبت", icon: FileText }, { href: "/accounting/ledger", label: "دفتر کل", icon: Scale }, { href: "/accounting/treasury", label: "خزانه", icon: Wallet }, { href: "/accounting/customers", label: "مشتریان", icon: Users }, { href: "/accounting/suppliers", label: "تأمین‌کنندگان", icon: Truck }, { href: "/accounting/assets", label: "دارایی‌ها", icon: Building2 }, { href: "/accounting/payroll", label: "حقوق و دستمزد", icon: Briefcase }, { href: "/accounting/reports", label: "گزارش‌ها", icon: FileBarChart2 }, { href: "/accounting/audit", label: "حسابرسی", icon: ShieldCheck }, { href: "/accounting/setup", label: "راه‌اندازی", icon: Wrench }, { href: "/accounting/settings", label: "تنظیمات", icon: Settings }, ]; const MOBILE_PRIMARY = [ { href: "/accounting", label: "داشبورد", icon: LayoutDashboard }, { href: "/accounting/vouchers", label: "اسناد", icon: FileText }, { href: "/accounting/chart-of-accounts", label: "حساب‌ها", icon: BookOpen }, { href: "/accounting/treasury", label: "خزانه", icon: Wallet }, { href: "/accounting/setup", label: "بیشتر", icon: MoreHorizontal }, ]; function isActive(pathname: string, href: string) { if (href === "/accounting") return pathname === "/accounting"; return pathname === href || pathname.startsWith(`${href}/`); } export function AccountingShell({ children }: { children: React.ReactNode }) { const pathname = usePathname(); const { mode, toggle } = useColorMode(); return (
{NAV.map((item) => { const active = isActive(pathname, item.href); return ( {item.label} ); })}
{children}
); }