import * as React from "react"; import { Pencil, Trash2, X } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; /** * CopilotChatHistory — WealthX DS (Molecule) * * The Copilot's chat-history panel: a scrollable list of past conversations. * The current conversation is highlighted with a "current" badge and inline * rename / delete actions; the rest are tappable rows that reopen the thread. * * Pure display — the host supplies the conversations and wires the callbacks. */ export interface CopilotConversation { id: string; /** Conversation title (usually the first user message). */ title: string; /** Relative time, e.g. "a few seconds ago" / "20 hours ago". */ timeLabel: string; } export interface CopilotChatHistoryProps { conversations: CopilotConversation[]; /** Id of the conversation currently open — gets the highlight + actions. */ currentId?: string; /** Panel heading. Defaults to "Chat History". */ title?: string; onSelect?: (id: string) => void; onRename?: (id: string) => void; onDelete?: (id: string) => void; onClose?: () => void; /** Shown when there are no conversations. */ emptyLabel?: string; className?: string; } export function CopilotChatHistory({ conversations, currentId, title = "Chat History", onSelect, onRename, onDelete, onClose, emptyLabel = "No conversations yet.", className, }: CopilotChatHistoryProps) { return (
{emptyLabel}
) : ( conversations.map((conv) => { const isCurrent = conv.id === currentId; return (