"use client"; import { ChevronRight, File, Folder, GitBranch, History, MessageSquare, PanelRight, Play, Plus, Search, Settings, User, } from "lucide-react"; import * as React from "react"; import { Button } from "@/components/ui/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, } from "@/components/ui/drawer"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarProvider, } from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; type SidebarModule = { id: string; label: string; icon: React.ComponentType>; }; const sidebarModules: SidebarModule[] = [ { id: "search", label: "جستجو", icon: Search }, { id: "explorer", label: "مرورگر", icon: File }, { id: "git", label: "کنترل منبع", icon: GitBranch }, ]; const changesData = [ { file: "README.md", state: "M" }, { file: "api/hello/route.ts", state: "U" }, { file: "app/layout.tsx", state: "M" }, ]; type TreeItem = string | TreeItem[]; const fileTreeData: TreeItem[] = [ [ "app", [ "api", ["hello", ["route.ts"]], "page.tsx", "layout.tsx", ["blog", ["page.tsx"]], ], ], ["components", ["ui", "button.tsx", "card.tsx"], "header.tsx", "footer.tsx"], ["lib", ["util.ts"]], ["public", "favicon.ico", "vercel.svg"], ".eslintrc.json", ".gitignore", "next.config.js", "tailwind.config.js", "package.json", "README.md", ]; function Logo({ className }: { className?: string }) { return ( شاد‌سی‌ان بلاکس ); } function Tree({ item }: { item: TreeItem }) { const [name, ...items] = Array.isArray(item) ? item : [item]; if (!items.length) { return ( {name} ); } return ( {name} {items.map((subItem, index) => ( ))} ); } interface AppSidebarProps extends React.ComponentProps { activeModule: string; onModuleChange: (moduleId: string) => void; } export function AppSidebar({ activeModule, onModuleChange, ...props }: AppSidebarProps) { return (
شاد‌سی‌ان بلاکس
ری یو آی پروژه من
{sidebarModules.map((module) => ( onModuleChange(module.id)} isActive={activeModule === module.id} className="px-2.5 md:px-2" > {module.label} ))} تنظیمات پروفایل
); } function ExplorerSidebar() { return ( تغییرات {changesData.map((item, index) => ( {item.file} {item.state} ))} فایل‌ها {fileTreeData.map((item, index) => ( ))} ); } function SearchSidebar() { return ( جستجو
); } function GitSidebar() { return ( تغییرات {changesData.map((item, index) => ( {item.file} {item.state} ))} ); } type MobileDrawer = "search" | "explorer" | "git" | "chat" | null; export function ApplicationShell9() { const [activeModule, setActiveModule] = React.useState("explorer"); const [isChatOpen, setIsChatOpen] = React.useState(false); const [mobileDrawer, setMobileDrawer] = React.useState(null); const handleModuleChange = (moduleId: string) => { setActiveModule(moduleId); }; const renderSidebar = () => { switch (activeModule) { case "search": return ; case "explorer": return ; case "کنترل نسخه": return ; default: return ; } }; return (
شاد‌سی‌ان بلاکس
پروژه من
setMobileDrawer(open ? "search" : null)} > جستجو
setMobileDrawer(open ? "explorer" : null)} > فایل‌ها تغییرات {changesData.map((item, index) => ( {item.file} {item.state} ))} فایل‌ها {fileTreeData.map((item, index) => ( ))} setMobileDrawer(open ? "git" : null)} > کنترل منبع تغییرات {changesData.map((item, index) => ( {item.file} {item.state} ))} setMobileDrawer(open ? "chat" : null)} > گفتگو
یک لندینگ برای ری یو آی با بخش قهرمان، شبکه ویژگی‌ها و جدول قیمت‌گذاری بساز