import { useEffect, useRef } from 'react'; import { motion } from 'framer-motion'; import { MessageSquare, Play, Pencil } from 'lucide-react'; import type { NegotiationMessage } from '@/types'; import { cn, roleBgColor, roleLabel } from '@/lib/utils'; import AnimatedCharacter from '@/components/AnimatedCharacter'; import TypingText from '@/components/TypingText'; interface NegotiationLogProps { messages: NegotiationMessage[]; episodeActive?: boolean; disabled?: boolean; onKickoff?: () => void; onOpenEditor?: () => void; className?: string; } export default function NegotiationLog({ messages, episodeActive = false, disabled = false, onKickoff, onOpenEditor, className, }: NegotiationLogProps) { const endRef = useRef(null); useEffect(() => { endRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages.length]); return (

Negotiation Log

{messages.length} messages
{messages.length === 0 ? (
VS

{episodeActive ? 'Episode ready. Start the first round to see the negotiation.' : 'Start an episode to see them negotiate.'}

{episodeActive && (
)}
) : ( messages.map((msg, i) => ( )) )}
); } function MessageBubble({ message, index, isLatest, }: { message: NegotiationMessage; index: number; isLatest: boolean; }) { const isScientist = message.role === 'scientist'; const actionType = message.action_type ?? undefined; return ( {/* Animated avatar */}
{roleLabel(message.role)} ยท Round {message.round}
{isLatest ? ( ) : ( message.message )} {actionType && ( {actionType.replace(/_/g, ' ')} )}
); }