"use client"; import React from 'react'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; import { Send, Paperclip } from 'lucide-react'; interface MessageFormProps { input: string; setInput: (value: string) => void; handleSendMessage: (e: React.FormEvent) => Promise; isLoading: boolean; handleFileChange: (e: React.ChangeEvent) => void; isFileSelected: boolean; } export default function MessageForm({ input, setInput, handleSendMessage, isLoading, handleFileChange, isFileSelected, }: MessageFormProps) { const fileInputRef = React.useRef(null); const handleAttachClick = () => { fileInputRef.current?.click(); } const handleFileReset = (e: React.MouseEvent) => { // Reset file input value so the same file can be selected again (e.target as HTMLInputElement).value = ''; } return (
setInput(e.target.value)} disabled={isLoading} className="flex-1 rounded-full border bg-input pr-12 pl-12 py-6 shadow-lg focus-visible:ring-0 focus-visible:ring-offset-0" autoComplete="off" onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); const form = e.target as HTMLInputElement; form.form?.requestSubmit(); } }} />
); }