"use client"; import { useState } from "react"; /** * Contact section with interactive form, bot anti-spam protection, and direct email info */ export default function Contact() { // Form input states const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [message, setMessage] = useState(""); const [honeypot, setHoneypot] = useState(""); // Submission UI states const [submitted, setSubmitted] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(false); // Bot detection timestamp (form interaction speed check) const [formLoadTime] = useState(Date.now()); // Handles contact form submission with bot verification & PHP backend dispatch const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); // Anti-spam check 1: Submissions faster than 3 seconds are treated as automated bots const timeTaken = (Date.now() - formLoadTime) / 1000; if (timeTaken < 3) { setSubmitted(true); return; } // Anti-spam check 2: Honeypot field filled out by bots if (honeypot !== "") { setSubmitted(true); return; } setLoading(true); setError(false); try { const response = await fetch( "https://andre-kempf.com/backend/sendMail.php", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ name, email, message, honeypot }), }, ); if (response.ok) { setSubmitted(true); setName(""); setEmail(""); setMessage(""); setHoneypot(""); } else { setError(true); } } catch (err) { console.error("Mail send error:", err); setError(true); } finally { setLoading(false); } }; return (
{/* Section Header */}

// 04. Get in Touch

Contact me.

{/* Left Column: Direct Info & Terminal Card */}

// Got a project in mind?

Feel free to reach out using this form. I am always open to discussing new projects, creative ideas, or opportunities to contribute to your team.

{/* Terminal Status Display */}
// Terminal Direct Contact
chneemann@portfolio: ~$ mail --send
Status:{" "} Ready to receive messages
{/* Email Shortcut */}
// Prefer email? dev@andre-kempf.com
{/* Right Column: Contact Form / Success Message */}
{submitted ? ( /* Success Message */

Thank you!

Your message has been sent successfully. I'll get back to you as soon as possible!

) : ( /* Form Container */
{/* Hidden Honeypot Field for Bot Catching */} {/* Name Input */}
setName(e.target.value)} placeholder="John Doe" className="w-full px-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-800 text-slate-100 placeholder:text-slate-600 focus:outline-none focus:border-blue-500/80 focus:ring-1 focus:ring-blue-500/80 transition-colors text-sm" />
{/* Email Input */}
setEmail(e.target.value)} placeholder="john@example.com" className="w-full px-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-800 text-slate-100 placeholder:text-slate-600 focus:outline-none focus:border-blue-500/80 focus:ring-1 focus:ring-blue-500/80 transition-colors text-sm" />
{/* Message Input */}