"use client" import * as React from "react" import { Index } from "@/__registry__" import { AudioWaveform, BookOpen, Bot, ChevronRightIcon, Command, GalleryVerticalEnd, Search, Settings2, SquareTerminal, } from "lucide-react" import { NavUser } from "@/registry/new-york-v4/blocks/sidebar-07/components/nav-user" import { TeamSwitcher } from "@/registry/new-york-v4/blocks/sidebar-07/components/team-switcher" import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/registry/new-york-v4/ui/collapsible" import { Label } from "@/registry/new-york-v4/ui/label" import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarRail, } from "@/registry/new-york-v4/ui/sidebar" // This is sample data. const data = { user: { name: "shadcn", email: "m@example.com", avatar: "/avatars/shadcn.jpg", }, teams: [ { name: "Acme Inc", logo: GalleryVerticalEnd, plan: "Enterprise", }, { name: "Acme Corp.", logo: AudioWaveform, plan: "Startup", }, { name: "Evil Corp.", logo: Command, plan: "Free", }, ], navMain: [ { title: "Playground", url: "#", icon: SquareTerminal, isActive: true, items: [ { title: "History", url: "#", }, { title: "Starred", url: "#", }, { title: "Settings", url: "#", }, ], }, { title: "Models", url: "#", icon: Bot, items: [ { title: "Genesis", url: "#", }, { title: "Explorer", url: "#", }, { title: "Quantum", url: "#", }, ], }, { title: "Documentation", url: "#", icon: BookOpen, items: [ { title: "Introduction", url: "#", }, { title: "Get Started", url: "#", }, { title: "Tutorials", url: "#", }, { title: "Changelog", url: "#", }, ], }, { title: "Settings", url: "#", icon: Settings2, items: [ { title: "General", url: "#", }, { title: "Team", url: "#", }, { title: "Billing", url: "#", }, { title: "Limits", url: "#", }, ], }, ], components: Object.values(Index) .filter((item) => item.type === "registry:ui") .concat([ { name: "combobox", }, ]) .sort((a, b) => a.name.localeCompare(b.name)), } export function AppSidebar({ ...props }: React.ComponentProps) { return (
Platform {data.navMain.map((item) => ( {item.icon && } {item.title} {item.items?.map((subItem) => ( {subItem.title} ))} ))} Components {data.components.map((item) => ( {getComponentName(item.name)} ))}
) } function getComponentName(name: string) { // convert kebab-case to title case return name.replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase()) }