'use client'; import { useState, useCallback, type KeyboardEvent } from 'react'; interface ChatInputProps { onSend: (text: string) => void; disabled?: boolean; } export function ChatInput({ onSend, disabled }: ChatInputProps) { const [text, setText] = useState(''); const handleSend = useCallback(() => { if (!text.trim() || disabled) return; onSend(text.trim()); setText(''); }, [text, disabled, onSend]); const handleKeyDown = useCallback( (e: KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSend(); } }, [handleSend] ); return (