"use client";
import { useState } from "react";
import Link from "next/link";
import { Check, TrafficCone } from "lucide-react";
import DemoButton from "@/components/ui/DemoButton";
/* ─── shared input styles ─── */
const inputClass =
"w-full rounded-lg px-3 h-11 text-[14px] outline-none focus:ring-2 focus:ring-[var(--accent-yellow)]";
const inputStyle = {
border: "1px solid var(--border-neutral)",
background: "var(--surface)",
color: "var(--text-primary)",
};
const HAZARD_STRIPES =
"repeating-linear-gradient(45deg, #F1B729 0 10px, #171106 10px 20px)";
/* ─── Left column: construction "wird gerade gebaut" panel ─── */
function ConstructionAside() {
return (
{/* Absperrband */}
HiveGrid wird gerade gebaut.
Wir legen gerade die letzten Handgriffe an. Trag dich in die Warteliste
ein und sei von Anfang an dabei, wenn HiveGrid für deinen Betrieb startet.
In Arbeit · Start in Kürze. Kein Spam, wir melden uns persönlich.
{/* heyData DSGVO seal */}
{/* eslint-disable-next-line @next/next/no-img-element */}
);
}
/* ─── Honeycomb backdrop — just the pattern (no hub, no cards), faded on all
edges AND in the centre so it stays subtle behind the content. ─── */
const HEX_FIELD = (() => {
const r = 33; // hex radius (centre → vertex)
const rr = r - 1.6; // slight inset → thin gaps between combs
const dh2 = (Math.sqrt(3) / 2) * rr;
const h2 = (Math.sqrt(3) / 2) * r;
const colStep = 1.5 * r;
const rowStep = 2 * h2;
const VW = 1600, VH = 1040;
const paths: string[] = [];
for (let col = 0; col * colStep < VW + r; col++) {
const cx = col * colStep;
const yOff = col % 2 ? h2 : 0;
for (let cy = -rowStep + yOff; cy < VH + rowStep; cy += rowStep) {
const f = (n: number) => n.toFixed(1);
paths.push(
`M${f(cx + rr)} ${f(cy)}L${f(cx + rr / 2)} ${f(cy - dh2)}L${f(cx - rr / 2)} ${f(cy - dh2)}L${f(cx - rr)} ${f(cy)}L${f(cx - rr / 2)} ${f(cy + dh2)}L${f(cx + rr / 2)} ${f(cy + dh2)}Z`,
);
}
}
return { paths, VW, VH };
})();
// Ellipse that clears the centre (behind the content) and fades to nothing well
// INSIDE the section box → soft fade on every edge, incl. the bottom seam.
const HC_MASK =
"radial-gradient(82% 70% at 50% 45%, transparent 0%, rgba(0,0,0,0.08) 20%, #000 40%, #000 52%, transparent 76%)";
function HoneycombBackdrop() {
return (
);
}
export default function WaitlistForm() {
const [state, setState] = useState<"idle" | "loading" | "ok" | "err">("idle");
const [errMsg, setErrMsg] = useState("");
const [form, setForm] = useState({
vorname: "",
nachname: "",
email: "",
unternehmen: "",
nachricht: "",
dsgvo: false,
});
const update = (k: string, v: string | boolean) =>
setForm((f) => ({ ...f, [k]: v }));
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!form.email || !form.vorname || !form.dsgvo) return;
setState("loading");
setErrMsg("");
try {
const res = await fetch("/api/demo-request", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
firstName: form.vorname,
lastName: form.nachname,
email: form.email,
company: form.unternehmen,
message: form.nachricht,
source: "HiveGrid Warteliste",
}),
});
if (!res.ok) {
const data = await res.json().catch(() => null);
throw new Error(data?.error || "Fehler beim Senden.");
}
setState("ok");
} catch (err) {
setState("err");
setErrMsg(err instanceof Error ? err.message : "Fehler beim Senden.");
}
};
/* ─── Success state ─── */
if (state === "ok") {
return (
Du bist auf der Warteliste!
Wir melden uns bei dir, sobald HiveGrid für deinen Betrieb bereit
ist. Kein Spam, versprochen.
);
}
/* ─── Form ─── */
return (
{/* ── Left: construction panel ── */}
{/* ── Right: form, centered ── */}
);
}