import { useState, useCallback } from "react"; import { Copy, Check, Trash2, RotateCcw } from "lucide-react"; import { cn } from "@/lib/utils"; interface MessageActionsProps { content: string; isLastAssistant: boolean; onDelete: () => void; onRegenerate?: () => void; } export function MessageActions({ content, isLastAssistant, onDelete, onRegenerate, }: MessageActionsProps) { const [copied, setCopied] = useState(false); const handleCopy = useCallback(async () => { try { await navigator.clipboard.writeText(content); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { // Fallback for insecure contexts const textarea = document.createElement("textarea"); textarea.value = content; textarea.style.position = "fixed"; textarea.style.opacity = "0"; document.body.appendChild(textarea); textarea.select(); document.execCommand("copy"); document.body.removeChild(textarea); setCopied(true); setTimeout(() => setCopied(false), 2000); } }, [content]); return (