import { Star, SquarePen } from "lucide-react"; import { SidebarNavItem } from "@/components/SidebarNavItem"; import { AgentIcon } from "@/components/AgentIconPicker"; import { Button } from "@/components/ui/button"; import { useSidebar } from "@/context/SidebarContext"; import type { Agent } from "@paperclipai/shared"; import { agentRouteRef, cn } from "@/lib/utils"; import { orderChatAgents } from "@/lib/recent-agent-chats"; export function AgentChatSidebar({ activeId, starredIds, recentIds, onToggleStar, onOpenChat, agents, href = (id: string) => `/chats/${encodeURIComponent(agentRouteRef(agents.find((agent) => agent.id === id)!))}`, }: { agents: Agent[]; href?: (id: string) => string; activeId: string; starredIds: string[]; recentIds: string[]; onToggleStar: (id: string) => void; onOpenChat: () => void; }) { const { collapsed, peeking } = useSidebar(); const rail = collapsed && !peeking; const ordered = orderChatAgents(agents, starredIds, recentIds); const row = (agent: Agent) => { const pinned = starredIds.includes(agent.id); return (