"use client"; import { BadgeCheck, BarChart3, Briefcase, ChevronRight, ClipboardList, Clock3, FileText, Folder, Globe2, HelpCircle, LayoutDashboard, Search, Settings, Sparkles, Star, Users, } from "lucide-react"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Label } from "@/components/ui/label"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, } from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; // Base nav item - used by simple sidebars type NavItem = { label: string; icon: React.ComponentType>; href: string; isActive?: boolean; // Optional children for submenus (Sidebar3+) children?: NavItem[]; }; // Nav group with optional collapsible state type NavGroup = { title: string; items: NavItem[]; // Optional: default collapsed state (Sidebar2+) defaultOpen?: boolean; }; // Complete sidebar data structure type SidebarData = { // Logo/branding (all sidebars) logo: { src: string; alt: string; title: string; description: string; }; // Main navigation groups (all sidebars) navGroups: NavGroup[]; // Footer navigation group (all sidebars) footerGroup: NavGroup; // User data for user footer (Sidebar6+) user?: { name: string; email: string; avatar: string; }; // Workspaces for switcher (Sidebar7+) workspaces?: Array<{ id: string; name: string; logo: string; plan: string; }>; // Currently active workspace (Sidebar7+) activeWorkspace?: string; }; // Shared sidebar data - works with all sidebar variations const sidebarData: SidebarData = { logo: { src: "/block-media/shadcnblocks/block/logos/ShadcnBlocks-logo.svg", alt: "داده‌نما", title: "داده‌نما", description: "آنالیتیکس محصول", }, navGroups: [ { title: "نمای کلی", defaultOpen: true, items: [ { label: "داشبورد", icon: LayoutDashboard, href: "#", isActive: true, }, { label: "رویدادها", icon: ClipboardList, href: "#" }, { label: "قیف‌ها", icon: BarChart3, href: "#" }, ], }, { title: "گزارش‌ها", defaultOpen: true, items: [ { label: "گزارش‌های فعال", icon: Briefcase, href: "#", children: [ { label: "فعال‌سازی", icon: FileText, href: "#" }, { label: "نگهداشت", icon: FileText, href: "#" }, { label: "درآمد", icon: FileText, href: "#" }, ], }, { label: "بایگانی", icon: Folder, href: "#", children: [ { label: "آرشیو ۱۴۰۳", icon: FileText, href: "#" }, { label: "آرشیو ۱۴۰۲", icon: FileText, href: "#" }, ], }, ], }, { title: "تیم رشد", defaultOpen: false, items: [ { label: "تحلیل‌گران", icon: Users, href: "#" }, { label: "آزمایش‌های A/B", icon: Clock3, href: "#" }, { label: "انتشار گزارش", icon: BadgeCheck, href: "#" }, { label: "بازبینی متریک", icon: Star, href: "#" }, ], }, { title: "فضای کار", defaultOpen: false, items: [ { label: "یکپارچه‌سازی‌ها", icon: Globe2, href: "#" }, { label: "هشدارهای خودکار", icon: Sparkles, href: "#" }, ], }, ], footerGroup: { title: "پشتیبانی", items: [ { label: "مرکز راهنما", icon: HelpCircle, href: "#" }, { label: "تنظیمات", icon: Settings, href: "#" }, ], }, user: { name: "علی رضایی", email: "ali@example.com", avatar: "/block-media/shadcnblocks/block/avatar-6.webp", }, workspaces: [ { id: "1", name: "ShadcnBlocks", logo: "/block-media/shadcnblocks/block/logos/ShadcnBlocks-logo.svg", plan: "سازمانی", }, { id: "2", name: "قالب‌های داشبورد", logo: "/block-media/shadcnblocks/block/logos/ShadcnBlocks-logo.svg", plan: "تیم رشد محصول", }, { id: "3", name: "ویجت‌های گزارش", logo: "/block-media/shadcnblocks/block/logos/ShadcnBlocks-logo.svg", plan: "آزمایشی", }, ], activeWorkspace: "1", }; const SidebarLogo = ({ logo }: { logo: SidebarData["logo"] }) => { return (
{logo.alt}
{logo.title} {logo.description}
); }; const SearchForm = () => { return (
); }; const NavMenuItem = ({ item }: { item: NavItem }) => { const Icon = item.icon; const hasChildren = item.children && item.children.length > 0; if (!hasChildren) { return ( {item.label} ); } return ( {item.label} {item.children!.map((child) => ( {child.label} ))} ); }; const AppSidebar = ({ ...props }: React.ComponentProps) => { return ( {sidebarData.navGroups.map((group) => ( {group.title} {group.items.map((item) => ( ))} ))} {sidebarData.footerGroup.title} {sidebarData.footerGroup.items.map((item) => ( ))} ); }; interface Sidebar5Props { className?: string; } const Sidebar5 = ({ className }: Sidebar5Props) => { return (
نمای کلی داشبورد
); }; export { Sidebar5 };