"use client"; export const dynamic = "force-dynamic"; export const runtime = "nodejs"; import { Suspense } from "react"; import { useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { motion, AnimatePresence } from "framer-motion"; import { toast } from "sonner"; export default function ContactPage() { return ( Loading...}> ); } function RequestForm() { const router = useRouter(); const searchParams = useSearchParams(); // Accept both ?type= and ?plan= to allow links from multiple pages const rawType = (searchParams.get("type") || searchParams.get("plan")) as string | null; type RequestType = | "recommendation" | "vps" | "website-care" | "development" | "minecraft-hosting" | "plugin" | "support" | "partnership"; const isRequestType = (v: any): v is RequestType => [ "recommendation", "vps", "website-care", "development", "minecraft-hosting", "plugin", "support", "partnership", ].includes(v); const prefillType: RequestType | "" = rawType && isRequestType(rawType) ? rawType : ""; const [step, setStep] = useState(1); const [loading, setLoading] = useState(false); const [form, setForm] = useState({ type: prefillType || "", name: "", email: "", domain: "", company: "", message: "", hosting: "", // reused for Minecraft edition (Java/Bedrock/etc.) concern: "", }); const requestTypes: { id: RequestType; label: string; desc: string; icon: string }[] = [ { id: "recommendation", label: "Get My Recommendation", desc: "Tell us about your stack/server. We’ll propose the right plan and next steps.", icon: "🧭", }, { id: "vps", label: "Managed VPS Hosting", desc: "Hardened, monitored VPS with restore-tested backups.", icon: "🖥️", }, { id: "website-care", label: "Managed Website Hosting & Care", desc: "Updates, uptime, security checks, monthly restore tests.", icon: "🛡️", }, { id: "development", label: "Website Development", desc: "Fast, SEO-ready Next.js site with deployment.", icon: "⚡", }, { id: "minecraft-hosting", label: "Managed Minecraft Hosting", desc: "Lag-free server on a hardened VPS with backups and tuning.", icon: "⛏️", }, { id: "plugin", label: "Minecraft Plugin Development", desc: "Custom Paper/Spigot plugins with tests and docs.", icon: "🔌", }, { id: "support", label: "Technical Support", desc: "Report an issue or request hands-on help.", icon: "🛠️", }, { id: "partnership", label: "Partnership / Collaboration", desc: "Discuss a potential collaboration or integration.", icon: "🤝", }, ]; const handleChange = ( e: React.ChangeEvent ) => { const { name, value } = e.target; setForm((f) => ({ ...f, [name]: value })); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); try { const res = await fetch("/api/contact", { method: "POST", headers: { "Content-Type": "application/json", "x-secret-token": process.env.NEXT_PUBLIC_FORM_SECRET || "", }, body: JSON.stringify(form), }); if (!res.ok) throw new Error("Submission failed"); toast.success("Request submitted successfully!"); router.push("/contact/success"); } catch (err) { console.error(err); toast.error("Something went wrong. Please try again."); } finally { setLoading(false); } }; const submitLabel = form.type === "recommendation" ? "Get My Recommendation" : form.type === "plugin" ? "Request Plugin Quote" : form.type === "minecraft-hosting" ? "Launch My Minecraft Server" : form.type === "development" ? "Request Website Proposal" : form.type === "vps" || form.type === "website-care" ? "Send Technical Details" : "Submit Request"; const showDomainInput = form.type === "recommendation" || form.type === "vps" || form.type === "website-care" || form.type === "development" || form.type === "support"; const showMinecraftEdition = form.type === "minecraft-hosting" || form.type === "plugin"; return (
{/* --- HERO --- */}

Talk to an Engineer

Tell us about your stack or server. We’ll recommend a plan and outline next steps—no lock-in.

{/* Trust microcopy */}
{[ { t: "Mutual NDA", s: "Available on request" }, { t: "Least-Privilege Access", s: "Credentials scoped to the task" }, { t: "Month-to-Month", s: "30-day cancel policy" }, ].map((item) => (
{item.t}
{item.s}
))}
{/* --- FORM --- */}
{step === 1 && (

What do you need help with?

{requestTypes.map((t) => ( ))}
)} {step === 2 && (

{requestTypes.find((t) => t.id === form.type)?.label}

{showDomainInput && (
)} {/* Concern selector for scoping */} {(form.type !== "" && form.type !== "partnership") && (
)} {/* Minecraft edition for hosting/plugin */} {showMinecraftEdition && (
)}