"use client"; import { motion } from "framer-motion"; import { Activity, Calendar, Clapperboard, FileText, Handshake, Home, Images, Inbox, Kanban, LayoutDashboard, ListTodo, Receipt, Settings, Wallet, } from "lucide-react"; import * as React from "react"; import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, } from "@/components/ui/drawer"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger, useSidebar, } from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; type ModuleId = | "overview" | "sales" | "production" | "deliverables" | "finance"; type NavItem = { label: string; icon: React.ComponentType>; href: string; badge?: string; active?: boolean; }; type NavSection = { title?: string; items: NavItem[]; }; type NavModule = { id: ModuleId; label: string; icon: NavItem["icon"]; sections: NavSection[]; }; const navModules: NavModule[] = [ { id: "overview", label: "نمای کلی", icon: LayoutDashboard, sections: [ { title: "نمای کلی", items: [ { label: "خانه", icon: Home, href: "#", active: true }, { label: "داشبورد", icon: Activity, href: "#" }, { label: "صندوق ورودی", icon: Inbox, href: "#", badge: "۳" }, ], }, { title: "وظایف", items: [ { label: "وظایف من", icon: ListTodo, href: "#", badge: "۵" }, { label: "تقویم", icon: Calendar, href: "#" }, ], }, ], }, { id: "sales", label: "فروش", icon: Handshake, sections: [ { title: "قیف فروش", items: [ { label: "سرنخ‌های جدید", icon: Inbox, href: "#", active: true }, { label: "پیش‌فاکتورها", icon: FileText, href: "#" }, { label: "رزروها", icon: Calendar, href: "#" }, ], }, { title: "گزارش‌ها", items: [{ label: "داشبورد فروش", icon: Activity, href: "#" }], }, ], }, { id: "production", label: "تولید", icon: Clapperboard, sections: [ { title: "مسیر تولید", items: [ { label: "تخته فیلمبرداری", icon: Kanban, href: "#", active: true }, { label: "لیست شات‌ها", icon: ListTodo, href: "#" }, ], }, { title: "تیم", items: [{ label: "تخصیص‌ها", icon: Inbox, href: "#" }], }, ], }, { id: "deliverables", label: "تحویل‌ها", icon: Images, sections: [ { title: "گالری‌ها", items: [ { label: "همه گالری‌ها", icon: Images, href: "#", active: true }, { label: "تأییدها", icon: Inbox, href: "#", badge: "۲" }, ], }, { title: "خروجی‌ها", items: [{ label: "مرکز دانلود", icon: FileText, href: "#" }], }, ], }, { id: "finance", label: "مالی", icon: Wallet, sections: [ { title: "صورتحساب", items: [ { label: "فاکتورها", icon: Receipt, href: "#", active: true }, { label: "پرداخت‌ها", icon: Wallet, href: "#" }, ], }, { title: "گزارش‌ها", items: [{ label: "سود و زیان", icon: Activity, href: "#" }], }, ], }, ]; const utilities: NavItem[] = [{ label: "تنظیمات", icon: Settings, href: "#" }]; interface ModulePanelProps { className?: string; module: NavModule; } function ModulePanel({ className, module }: ModulePanelProps) { return (
{module.sections.map((section, index) => (
{section.title && ( {section.title} )} {section.items.map((item) => { const Icon = item.icon; return ( {item.badge && ( {item.badge} )} {item.label} ); })}
))}
استودیو {utilities.map((item) => { const Icon = item.icon; return ( {item.label} ); })}
); } interface AppSidebarProps extends Omit< React.ComponentProps, "className" > { className?: string; activeKey: ModuleId; onNavChange: (key: ModuleId) => void; } export function AppSidebar({ className, activeKey, onNavChange, ...props }: AppSidebarProps) { const { state, setOpen, isMobile } = useSidebar(); const isCollapsed = state === "collapsed"; const showFooter = isCollapsed || isMobile; const activeModule = navModules.find((module) => module.id === activeKey) ?? navModules[0]; const activeNavLabel = activeModule.label; return (
شاد‌سی‌ان بلاکس
ری یو آی
{" "} {navModules.map((module) => { const Icon = module.icon; return ( { onNavChange(module.id); setOpen(true); }} isActive={activeKey === module.id} aria-label={module.label} className="px-2.5 md:px-2" > {module.label} ); })} {utilities.map((item) => { const Icon = item.icon; return ( {item.label} ); })} {" "}
{activeNavLabel}
); } interface ApplicationShell6Props { className?: string; } export function ApplicationShell6({ className }: ApplicationShell6Props) { const [activeKey, setActiveKey] = React.useState(navModules[0].id); const [isMobilePanelOpen, setIsMobilePanelOpen] = React.useState(false); const activeModule = navModules.find((module) => module.id === activeKey) ?? navModules[0]; const activeNavLabel = activeModule.label; return (
شاد‌سی‌ان بلاکس
{activeNavLabel}
{activeNavLabel}
); }