'use client'; import { useState, useRef } from 'react'; import { useTranslations } from 'next-intl'; import { motion, useInView } from 'framer-motion'; import { Mail, Phone, MapPin, Clock, Send, MessageSquare, Headphones, Building2, CheckCircle2, Loader2, Shield, Zap, BookOpen, ArrowRight, type LucideIcon, } from 'lucide-react'; import { Link } from '@/i18n/navigation'; import { LandingHeader, LandingFooter } from '@/components/layout'; import { sendContactForm } from '@/lib/api/auth'; type MethodKey = 'email' | 'phone' | 'chat' | 'support'; type SubjectKey = 'demo' | 'pricing' | 'partnership' | 'support' | 'press' | 'careers' | 'other'; const METHODS: { key: MethodKey; icon: LucideIcon; color: string }[] = [ { key: 'email', icon: Mail, color: 'from-blue-500 to-cyan-500' }, { key: 'phone', icon: Phone, color: 'from-green-500 to-emerald-500' }, { key: 'chat', icon: MessageSquare, color: 'from-purple-500 to-pink-500' }, { key: 'support', icon: Headphones, color: 'from-orange-500 to-red-500' }, ]; const SUBJECTS: SubjectKey[] = [ 'demo', 'pricing', 'partnership', 'support', 'press', 'careers', 'other', ]; export default function ContactPage() { const t = useTranslations('marketing.contact'); const [formData, setFormData] = useState({ firstName: '', lastName: '', email: '', company: '', phone: '', subject: '', message: '', }); const [isSubmitting, setIsSubmitting] = useState(false); const [isSubmitted, setIsSubmitted] = useState(false); const [error, setError] = useState(''); const heroRef = useRef(null); const formRef = useRef(null); const contactRef = useRef(null); const afterSubmitRef = useRef(null); const quickAccessRef = useRef(null); const isHeroInView = useInView(heroRef, { once: true }); const isFormInView = useInView(formRef, { once: true }); const isContactInView = useInView(contactRef, { once: true }); const isAfterSubmitInView = useInView(afterSubmitRef, { once: true }); const isQuickAccessInView = useInView(quickAccessRef, { once: true }); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setIsSubmitting(true); try { await sendContactForm({ firstName: formData.firstName, lastName: formData.lastName, email: formData.email, company: formData.company || undefined, phone: formData.phone || undefined, subject: formData.subject, message: formData.message, }); setIsSubmitted(true); } catch (err: any) { setError(err.message || t('form.genericError')); } finally { setIsSubmitting(false); } }; const handleChange = ( e: React.ChangeEvent ) => { setFormData(prev => ({ ...prev, [e.target.name]: e.target.value, })); }; const containerVariants = { hidden: { opacity: 0, y: 50 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6, staggerChildren: 0.1, }, }, }; const itemVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.5 }, }, }; return (
{/* Hero Section */}
{t('badge')}

{t('title1')}
{t('title2')}

{t('intro')}

{/* Wave */}
{/* Contact Methods */}
{METHODS.map(method => { const IconComponent = method.icon; return (

{t(`methods.${method.key}.title`)}

{t(`methods.${method.key}.description`)}

{t(`methods.${method.key}.value`)}

); })}
{/* Contact Form & Info */}
{/* Form */}

{t('form.title')}

{t('form.description')}

{isSubmitted ? (

{t('form.successTitle')}

{t('form.successBody')}

) : (