"use client"; import { useEffect, useRef } from "react"; import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/dist/ScrollTrigger"; import { EnvelopeSimple, ChatCircleDots, Confetti } from "@phosphor-icons/react/ssr"; import type { Icon as PhosphorIcon } from "@phosphor-icons/react"; // Flat-top hexagon → ties the step nodes into the honeycomb theme. const HEX = "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)"; type Step = { n: string; t: string; d: string; Icon: PhosphorIcon }; const STEPS: Step[] = [ { n: "01", t: "Du trägst dich ein", d: "Eine E-Mail genügt. Kein Vertrag, keine Kreditkarte, komplett unverbindlich.", Icon: EnvelopeSimple }, { n: "02", t: "Wir melden uns", d: "Sobald HiveGrid für deinen Betrieb bereit ist, persönlich und ohne Spam.", Icon: ChatCircleDots }, { n: "03", t: "Du bist von Anfang an dabei", d: "Unter den Ersten, die HiveGrid nutzen und mitgestalten.", Icon: Confetti }, ]; // Scroll-linked "how it works" timeline: a fill line grows with scroll progress // and each hex node lights up the moment the fill reaches it. export default function WaitlistNext() { const listRef = useRef(null); const trackRef = useRef(null); const fillRef = useRef(null); useEffect(() => { const list = listRef.current; const track = trackRef.current; const fill = fillRef.current; if (!list || !track || !fill) return; const steps = Array.from(list.querySelectorAll("[data-step]")); const hexes = steps.map((s) => s.querySelector("[data-node]")!); // Reduced motion: skip the scrub, just show the finished state. if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { const lr = list.getBoundingClientRect(); const first = hexes[0].getBoundingClientRect().top - lr.top + hexes[0].offsetHeight / 2; const last = hexes[hexes.length - 1].getBoundingClientRect().top - lr.top + hexes[hexes.length - 1].offsetHeight / 2; track.style.top = fill.style.top = `${first}px`; track.style.height = fill.style.height = `${last - first}px`; steps.forEach((s) => s.classList.add("is-active")); return; } gsap.registerPlugin(ScrollTrigger); let centers: number[] = []; let first = 0; let span = 0; const measure = () => { const lr = list.getBoundingClientRect(); centers = hexes.map((h) => h.getBoundingClientRect().top - lr.top + h.offsetHeight / 2); first = centers[0]; span = centers[centers.length - 1] - first; track.style.top = `${first}px`; track.style.height = `${span}px`; fill.style.top = `${first}px`; }; const ctx = gsap.context(() => { measure(); ScrollTrigger.create({ trigger: list, start: "top 80%", end: "bottom 62%", scrub: 0.4, onRefresh: measure, onUpdate: (self) => { const filled = self.progress * span; fill.style.height = `${filled}px`; const reach = first + filled; steps.forEach((s, i) => s.classList.toggle("is-active", reach >= centers[i] - 1)); }, }); }, list); return () => ctx.revert(); }, []); return (
SO GEHT'S WEITER

Was nach deiner Anmeldung passiert.

{/* rail: dim track + animated fill with a glowing head */} {STEPS.map((s, i) => (
{s.n}

{s.t}

{s.d}

))}
); }