"use client"; import { useState } from "react"; import { api, errorText } from "@/lib/api"; /** "Tell me when it opens": for visitors without an invitation. */ export function Waitlist({ email: initial = "" }: { email?: string }) { const [email, setEmail] = useState(initial); const [busy, setBusy] = useState(false); const [done, setDone] = useState(false); const [error, setError] = useState(null); async function submit(e: React.FormEvent) { e.preventDefault(); setBusy(true); setError(null); try { await api("/public/waitlist", { body: { email, locale: "hu" } }); setDone(true); } catch (err) { setError(errorText(err)); } finally { setBusy(false); } } if (done) { return (

Felírtunk. Ha megnyílik az oldal, vagy meghívót küldünk, ide írunk: {email}

); } return (

Szólunk, ha megnyílik.{" "} Add meg az e-mail-címed, és felírunk a várólistára.

setEmail(e.target.value)} placeholder="nev@pelda.hu" style={{ flex: "1 1 220px" }} />
{error && (

{error}

)}
); }