"use client" import { ExternalLink, Folder, MoreHorizontal, Share, Trash2, type LucideIcon, } from "lucide-react" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "@/components/ui/sidebar" import { useRouter } from "next/navigation" // Map of icon names to their components const actionIconMap: Record = { ExternalLink, Folder, Share, Trash2, MoreHorizontal } interface ChatAction { name: string; icon: string; onClick: () => void; } export function NavProjects({ chats, }: { chats: { name: string url: string icon: LucideIcon id?: number search_space_id?: number actions?: ChatAction[] }[] }) { const { isMobile } = useSidebar() const router = useRouter() const searchSpaceId = chats[0]?.search_space_id || "" return ( Recent Chats {chats.map((item, index) => ( {item.name} More {item.actions ? ( // Use the actions provided by the item item.actions.map((action, actionIndex) => { const ActionIcon = actionIconMap[action.icon] || Folder; return ( {action.name} ); }) ) : ( // Default actions if none provided <> View Chat Delete Chat )} ))} router.push(`/dashboard/${searchSpaceId}/chats`)}> View All Chats ) }