- SIGNUP_MODE=invite (default): a new account needs an open invitation for its address, or the invitation link (then any Google account will do) - admin page "Meghívók": invite many addresses at once, personal message, resend (max 3, 24 h apart), revoke, copy link, mail preview and test copy, waitlist - invitation e-mail in HTML and plain text; Message-ID on the sender's domain, List-Unsubscribe with one-click POST, opt-out list (hashes only) - e-mail texts moved to a shared crate (crates/email-templates) - login page shows the invitation; waitlist for uninvited visitors; unsubscribe page; privacy policy updated - docs/levelkuldes.md: Brevo, DNS (SPF, DKIM, DMARC) and the SMTP setup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
"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<string | null>(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 (
|
|
<p className="msg msg-ok" role="status">
|
|
Felírtunk. Ha megnyílik az oldal, vagy meghívót küldünk, ide írunk: <strong>{email}</strong>
|
|
</p>
|
|
);
|
|
}
|
|
return (
|
|
<form onSubmit={submit} className="card waitlist">
|
|
<p style={{ margin: 0 }}>
|
|
<strong>Szólunk, ha megnyílik.</strong>{" "}
|
|
<span className="muted">Add meg az e-mail-címed, és felírunk a várólistára.</span>
|
|
</p>
|
|
<div className="row" style={{ gap: 8, flexWrap: "wrap" }}>
|
|
<label htmlFor="waitlist-email" className="sr-only">
|
|
E-mail-cím
|
|
</label>
|
|
<input
|
|
id="waitlist-email"
|
|
className="inp"
|
|
type="email"
|
|
required
|
|
autoComplete="email"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
placeholder="nev@pelda.hu"
|
|
style={{ flex: "1 1 220px" }}
|
|
/>
|
|
<button type="submit" className="btn" disabled={busy}>
|
|
{busy ? "Küldés…" : "Feliratkozom"}
|
|
</button>
|
|
</div>
|
|
{error && (
|
|
<p className="msg msg-error" role="alert">
|
|
{error}
|
|
</p>
|
|
)}
|
|
</form>
|
|
);
|
|
}
|