"use client"; import { ChevronRight, File, Folder, FolderOpen } from "lucide-react"; import * as React from "react"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarProvider, SidebarRail, SidebarTrigger, } from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; // Nav group with optional collapsible state type NavGroup = { title: string; items: Array<{ label: string; icon: React.ComponentType>; href: string; isActive?: boolean; children?: Array<{ label: string; icon: React.ComponentType>; href: string; isActive?: boolean; }>; }>; 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: [], footerGroup: { title: "پشتیبانی", items: [], }, }; // File tree data structure type FileTreeItem = { name: string; label: string; type: "file" | "folder"; children?: FileTreeItem[]; }; const fileTreeData: FileTreeItem[] = [ { name: "src", label: "کد منبع", type: "folder", children: [ { name: "components", label: "کامپوننت‌ها", type: "folder", children: [ { name: "ui", label: "رابط کاربری", type: "folder", children: [ { name: "button.tsx", label: "دکمه.tsx", type: "file" }, { name: "card.tsx", label: "کارت.tsx", type: "file" }, { name: "dialog.tsx", label: "دیالوگ.tsx", type: "file" }, { name: "input.tsx", label: "ورودی.tsx", type: "file" }, { name: "sidebar.tsx", label: "سایدبار.tsx", type: "file" }, ], }, { name: "app-sidebar.tsx", label: "سایدبار اپ.tsx", type: "file" }, { name: "nav-main.tsx", label: "ناوبری اصلی.tsx", type: "file" }, { name: "nav-user.tsx", label: "ناوبری کاربر.tsx", type: "file" }, ], }, { name: "lib", label: "کتابخانه", type: "folder", children: [{ name: "utils.ts", label: "ابزارها.ts", type: "file" }], }, { name: "app", label: "اپلیکیشن", type: "folder", children: [ { name: "layout.tsx", label: "چیدمان.tsx", type: "file" }, { name: "page.tsx", label: "صفحه.tsx", type: "file" }, { name: "globals.css", label: "استایل‌های عمومی.استایل‌دهی", type: "file" }, ], }, ], }, { name: "public", label: "عمومی", type: "folder", children: [ { name: "favicon.ico", label: "آیکن سایت.ico", type: "file" }, { name: "logo.svg", label: "لوگو.svg", type: "file" }, ], }, { name: "package.json", label: "پیکربندی بسته.json", type: "file" }, { name: "tsconfig.json", label: "پیکربندی زبان نوع‌ایمن.json", type: "file" }, { name: "tailwind.config.ts", label: "پیکربندی استایل‌دهی مدرن.ts", type: "file", }, { name: "README.md", label: "راهنما.md", type: "file" }, ]; const SidebarLogo = ({ logo }: { logo: SidebarData["logo"] }) => { return (
{logo.alt}
{logo.title} {logo.description}
); }; const FileTreeNode = ({ item, depth = 0, }: { item: FileTreeItem; depth?: number; }) => { const [isOpen, setIsOpen] = React.useState(depth < 2); if (item.type === "file") { return ( {item.label} ); } return ( {isOpen ? ( ) : ( )} {item.label} {item.children && ( {item.children.map((child) => ( ))} )} ); }; const AppSidebar = ({ ...props }: React.ComponentProps) => { return ( فایل‌ها {fileTreeData.map((item) => ( ))} ); }; interface Sidebar13Props { className?: string; } const Sidebar13 = ({ className }: Sidebar13Props) => { return (
کامپوننت‌ها رابط کاربری دکمه.tsx
); }; export { Sidebar13 };