"use client"; import { buttonVariants } from "fumadocs-ui/components/ui/button"; import { Check, Copy, ThumbsDown, ThumbsUp } from "lucide-react"; import { useState } from "react"; import { cn } from "@/lib/utils"; interface MessageFeedbackProps { messageId: string; userMessageId?: string; content: string; className?: string; } export function MessageFeedback({ messageId, userMessageId, content, className, }: MessageFeedbackProps) { const [feedback, setFeedback] = useState<"positive" | "negative" | null>( null, ); const [copied, setCopied] = useState(false); const handleFeedback = (type: "positive" | "negative") => { if (feedback === type) return; setFeedback(type); }; const handleCopy = async () => { if (copied) return; try { await navigator.clipboard.writeText(content); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { // Silently handle error } }; return (
); }