import { useState } from "react"; import { FaUserEdit } from "react-icons/fa"; interface ReassignModalProps { open: boolean; onClose: () => void; onConfirm: (data: { firstName: string; lastName: string; email: string; message: string }) => void; } export default function ReassignModal({ open, onClose, onConfirm }: ReassignModalProps) { const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [email, setEmail] = useState(""); const [message, setMessage] = useState(""); const [errors, setErrors] = useState<{ lastName?: string; email?: string }>({}); if (!open) return null; const validate = () => { const newErrors: { lastName?: string; email?: string } = {}; if (!lastName.trim()) newErrors.lastName = "Last name is required."; if (!email.trim()) newErrors.email = "Email is required."; else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email."; setErrors(newErrors); return Object.keys(newErrors).length == 0; }; const handleSubmit = () => { if (!validate()) return; onConfirm({ firstName, lastName, email, message }); onClose(); }; return (
{/* Header */}

Reassign Document

{/* Message */}

Please enter the recipient details to reassign this document.

{/* Form Fields */}
setFirstName(e.target.value)} className="w-full border border-slate-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400" />
setLastName(e.target.value)} className={`w-full border border-slate-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 ${ errors.lastName ? "border-red-500 focus:ring-red-400" : "focus:ring-blue-400" }`} /> {errors.lastName && (

{errors.lastName}

)}
setEmail(e.target.value)} className={`w-full border border-slate-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 ${ errors.email ? "border-red-500 focus:ring-red-400" : "focus:ring-blue-400" }`} /> {errors.email &&

{errors.email}

}
{/* Message Textarea */}