import { getThreadActivity, type StoredChatThread } from "@agents24/react" import { LoaderCircle, Pause, SquarePen, Trash2 } from "lucide-react" import type { Agents24ChatIdentity } from "../../identity" import { IdentityControl } from "./identity-control" import { Button } from "../ui/button" import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarHeader, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarRail, useSidebar, } from "../ui/sidebar" type Props = { activeThreadId: string | null hasMore: boolean isLoading: boolean isLoadingMore: boolean onDelete: (threadId: string) => Promise onLoadMore: () => Promise onNew: () => void onOpen: (threadId: string) => Promise threads: StoredChatThread[] identity: Agents24ChatIdentity } function ThreadStatus({ thread }: { thread: StoredChatThread }) { const activity = getThreadActivity(thread) const waiting = ["paused", "waiting", "interrupted"].includes(activity.status || "") if (!activity.isSpinning && !waiting) return null const label = waiting ? "Waiting" : activity.status === "cancelling" ? "Cancelling" : activity.status === "queued" ? "Queued" : "Running" return ( {waiting ? : } ) } export function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoadingMore, onDelete, onLoadMore, onNew, onOpen, threads }: Props) { const { setOpenMobile } = useSidebar() return (