diff --git a/src/app/portfolio/[slug]/components/BookSurveyModal.tsx b/src/app/portfolio/[slug]/components/BookSurveyModal.tsx index 5a5f112..bd599ce 100644 --- a/src/app/portfolio/[slug]/components/BookSurveyModal.tsx +++ b/src/app/portfolio/[slug]/components/BookSurveyModal.tsx @@ -30,13 +30,9 @@ export default function BookSurveyModal({ address, onSuccess, // ✅ fix: remove “?:” here, we already declared it optional in interface }: BookSurveyModalProps) { - const [formData, setFormData] = useState({ - dealname: "", - }); - // 🧠 Simple mutation to call your HubSpot API const bookSurveyMutation = useMutation({ - mutationFn: async (data: typeof formData) => { + mutationFn: async () => { const res = await fetch("/api/book-survey", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -63,53 +59,20 @@ export default function BookSurveyModal({ }, }); - // ✏️ Handle input - const handleChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData((prev) => ({ ...prev, [name]: value })); - }; - // 🚀 Submit const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - bookSurveyMutation.mutate(formData); + bookSurveyMutation.mutate(); }; - // 🔁 Reset when modal closes - useEffect(() => { - if (!open) { - setFormData({ dealname: ""}); - } - }, [open]); - return ( - Create HubSpot Deal (Test) + Confirm Booking a Survey
- {/* Deal Name */} -
- - -
- - {/* Error Message */} - {bookSurveyMutation.isError && ( -

- {(bookSurveyMutation.error as Error).message} -

- )} - - - - Actions - setOpenModal(true)}> - Book a survey - - navigator.clipboard.writeText(payment.id)} - className="text-gray-700 cursor-pointer" - > - - Building Passport - - + <> +
+ + + + + + Actions + setOpenModal(true)}> + Book a survey + + navigator.clipboard.writeText(payment.id)} + className="text-gray-700 cursor-pointer" + > + + Building Passport + + - - Settings - - - - Delete Property - - - - {/* ✅ Render modal outside dropdown context */} - {openModal && ( - setShowToast(true)} + + Settings + + + + Delete Property + + + +
+ {/* ✅ Render modal outside dropdown context */} + {openModal && ( + setShowToast(true)} + /> + )} + + {/* 💥 Toast */} + setShowToast(false)} + message="Survey Booked Successfully!" + subtext="Your Survey Request is with Domna and will be in contact with you shortly. 🎉" /> - )} - - {/* 💥 Toast */} - setShowToast(false)} - message="Deal Created Successfully!" - subtext="Your HubSpot deal is ready. 🎉" - /> - + ); }, },