"use client"; import { BadgeCheck, BarChart3, Briefcase, ChevronRight, ChevronsUpDown, ClipboardList, Clock3, FileText, Folder, Globe2, HelpCircle, LayoutDashboard, LogOut, Search, Settings, Sparkles, Star, User, Users, } from "lucide-react"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; 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; }; // User data for footer (Sidebar6+) type UserData = { name: string; email: string; avatar: string; }; // 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?: UserData; // 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: "راه‌اندازی Q1", 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: "اسپرینت‌ها", 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-8.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 NavUser = ({ user }: { user: UserData }) => { return ( {user.name .split(" ") .map((n) => n[0]) .join("")}
{user.name} {user.email}
{user.name .split(" ") .map((n) => n[0]) .join("")}
{user.name} {user.email}
حساب کاربری خروج
); }; const AppSidebar = ({ ...props }: React.ComponentProps) => { return ( {sidebarData.navGroups.map((group) => ( {group.title} {group.items.map((item) => ( ))} ))} {sidebarData.user && } ); }; interface Sidebar6Props { className?: string; } const Sidebar6 = ({ className }: Sidebar6Props) => { return (
نمای کلی داشبورد
); }; export { Sidebar6 };