'use client' import { useState, useEffect } from "react"; import Layout from "@/components/layout/Layout"; import ReCAPTCHA from "react-google-recaptcha"; import axios from "axios"; export default function Contact() { const [formData, setFormData] = useState({ name: "", email: "", phone: "", message: "", }); const [alert, setAlert] = useState({ show: false, type: "", message: "", }); const [captchaToken, setCaptchaToken] = useState(null); const handleCaptchaChange = (token) => { setCaptchaToken(token); }; const handleChange = (e) => { const { name, value } = e.target; setFormData(prev => ({ ...prev, [name]: value })); }; const handleSubmit = async (e) => { e.preventDefault(); if (!formData.name || !formData.email || !formData.phone || !formData.message) { setAlert({ show: true, type: "danger", message: "Please fill in all fields." }); return; } if (!captchaToken) { setAlert({ show: true, type: "danger", message: "Please verify the CAPTCHA." }); return; } const emailData = { ...formData, recaptchaToken: captchaToken, to: "info@metatroncubesolutions.com", senderName: "Website Contact Form", message: ` Name: ${formData.name}
Email: ${formData.email}
Phone: ${formData.phone}

Message:
${formData.message} `, }; try { await axios.post("https://mailserver.metatronnest.com/send", emailData, { headers: { "Content-Type": "application/json" }, }); setAlert({ show: true, type: "success", message: "Your message has been sent successfully!" }); setFormData({ name: "", email: "", phone: "", message: "" }); setCaptchaToken(null); } catch { setAlert({ show: true, type: "danger", message: "Failed to send your message. Try again later." }); } }; useEffect(() => { if (alert.show) { const timer = setTimeout(() => setAlert({ show: false, type: "", message: "" }), 5000); return () => clearTimeout(timer); } }, [alert.show]); return ( {/* Contact Section */}
{/* Left Column - Info */}
Reach us

Contact

Whether you're grabbing lunch, chilling with friends, or fueling a late-night craving, we've got something hot, hearty, and delicious waiting for you.
{/* Right Column - Form */}
{alert.show && (
{alert.message}
)}
{/* Google Map */}
); }