Inviting shown but off until launch; waitlist confirmation; waitlist invites with a package
USER_INVITES (default false) keeps users from inviting others until the launch: the 'Meghívom' option and a 'Hívd meg, akit szeretsz' card on the persons page are shown, disabled, with 'Hamarosan'; the backend refuses with invites_disabled (admins may always). Joining the waitlist sends one confirmation e-mail (waitlist_joined) with a link that takes the address off the list and opts it out; at most 10 per address in 15 minutes. Admins can pick a package for waitlist invitations, like on the invitation form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -403,13 +403,15 @@ function InvitationRow({ invitation: i, onChange }: { invitation: AdminInvitatio
|
||||
function WaitlistTable({ waitlist, onChange }: { waitlist: WaitlistEntry[]; onChange: () => Promise<void> }) {
|
||||
const [busy, setBusy] = useState<string | null>(null);
|
||||
const [note, setNote] = useState<string | null>(null);
|
||||
const [pkg, setPkg] = useState("");
|
||||
const packages = usePackages();
|
||||
|
||||
async function invite(w: WaitlistEntry) {
|
||||
setBusy(w.email);
|
||||
setNote(null);
|
||||
try {
|
||||
const res = await api<{ results: InvitationResult[] }>("/admin/invitations", {
|
||||
body: { emails: [w.email], locale: w.locale },
|
||||
body: { emails: [w.email], locale: w.locale, package: pkg || null },
|
||||
});
|
||||
const r = res.results[0];
|
||||
if (r && r.status !== "invited") setNote(`${r.email}: ${RESULT[r.status]}`);
|
||||
@@ -440,6 +442,20 @@ function WaitlistTable({ waitlist, onChange }: { waitlist: WaitlistEntry[]; onCh
|
||||
Várólista
|
||||
</h2>
|
||||
<p className="hint">Akik meghívó nélkül próbáltak belépni, és kérték, hogy szóljunk nekik.</p>
|
||||
{waitlist.some((w) => w.invitation === null) && (
|
||||
<div className="field" style={{ maxWidth: 320 }}>
|
||||
<label htmlFor="waitlist-package">Ajándék csomag a meghívottaknak</label>
|
||||
<select id="waitlist-package" className="inp" value={pkg} onChange={(e) => setPkg(e.target.value)}>
|
||||
<option value="">nincs</option>
|
||||
{(packages ?? []).map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="hint">A „Meghívás” gomb ezzel a csomaggal küldi a meghívót; a regisztrációkor magától jóváíródik.</span>
|
||||
</div>
|
||||
)}
|
||||
{note && (
|
||||
<p className="msg msg-error" role="alert">
|
||||
{note}
|
||||
|
||||
@@ -909,3 +909,8 @@ a.pair-row:hover strong { color: var(--gold); }
|
||||
.lp-wheel .w-aspect { stroke-dashoffset: 0; }
|
||||
.lp-wheel .w-aspect.w-asp-sextile { opacity: 1; }
|
||||
}
|
||||
|
||||
.mode-option:disabled { cursor: not-allowed; opacity: 0.75; }
|
||||
.mode-option:disabled:hover { border-color: var(--line-2); }
|
||||
.mode-soon { margin-left: 8px; vertical-align: middle; font-family: var(--font-body); font-size: 11px; }
|
||||
.invite-soon .btn:disabled { cursor: not-allowed; }
|
||||
|
||||
@@ -20,7 +20,7 @@ export function Unsubscribe({ token }: { token: string | null }) {
|
||||
if (state === "done") {
|
||||
return (
|
||||
<p className="msg msg-ok" role="status">
|
||||
Leiratkoztál: erre a címre nem küldünk több meghívót.
|
||||
Leiratkoztál: erre a címre nem küldünk több meghívót, és levettük a várólistáról.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -40,7 +40,8 @@ export function Unsubscribe({ token }: { token: string | null }) {
|
||||
return (
|
||||
<div className="card field" style={{ gap: 12 }}>
|
||||
<p style={{ margin: 0 }}>
|
||||
Ha leiratkozol, erre az e-mail-címre többé nem küldünk meghívót, és a mostani meghívód is érvényét veszti.
|
||||
Ha leiratkozol, erre az e-mail-címre többé nem küldünk meghívót, levesszük a várólistáról, és a mostani meghívód
|
||||
is érvényét veszti.
|
||||
</p>
|
||||
<div>
|
||||
<button type="button" className="btn btn-primary" onClick={confirm} disabled={state === "busy"}>
|
||||
|
||||
@@ -12,7 +12,7 @@ export default async function UnsubscribePage({ searchParams }: { searchParams:
|
||||
<main className="page" style={{ maxWidth: 560 }}>
|
||||
<div className="page-head">
|
||||
<h1>Leiratkozás</h1>
|
||||
<p className="muted">Nem kérsz több meghívót a Sorsfonalakra.</p>
|
||||
<p className="muted">Nem kérsz több levelet és meghívót a Sorsfonalakról.</p>
|
||||
</div>
|
||||
<Unsubscribe token={token ?? null} />
|
||||
</main>
|
||||
|
||||
@@ -23,6 +23,7 @@ export default async function PersonsPage() {
|
||||
const isAdmin = me.user.roles.includes("admin");
|
||||
const slots = me.persons;
|
||||
const full = slots.left === 0;
|
||||
const invitesOpen = (config?.user_invites ?? false) || isAdmin;
|
||||
const now = Date.now();
|
||||
|
||||
return (
|
||||
@@ -47,22 +48,46 @@ export default async function PersonsPage() {
|
||||
</ChartCard>
|
||||
))}
|
||||
|
||||
<Link href="/szemelyek/uj" className="chart-card chart-card-new">
|
||||
<span className="chart-card-plus" aria-hidden="true">
|
||||
+
|
||||
</span>
|
||||
<strong className="chart-card-name">Új személy</strong>
|
||||
<span className="muted">
|
||||
{full
|
||||
? "Meghívással bármikor"
|
||||
: slots.unlimited
|
||||
? "Adatokkal vagy meghívással"
|
||||
: `Még ${slots.left} személyt vehetsz fel, vagy hívd meg`}
|
||||
</span>
|
||||
</Link>
|
||||
{(!full || invitesOpen) && (
|
||||
<Link href="/szemelyek/uj" className="chart-card chart-card-new">
|
||||
<span className="chart-card-plus" aria-hidden="true">
|
||||
+
|
||||
</span>
|
||||
<strong className="chart-card-name">Új személy</strong>
|
||||
<span className="muted">
|
||||
{!invitesOpen
|
||||
? slots.unlimited
|
||||
? "Korlátlan számú személy"
|
||||
: `Még ${slots.left} személyt vehetsz fel`
|
||||
: full
|
||||
? "Meghívással bármikor"
|
||||
: slots.unlimited
|
||||
? "Adatokkal vagy meghívással"
|
||||
: `Még ${slots.left} személyt vehetsz fel, vagy hívd meg`}
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<PendingInvites />
|
||||
{invitesOpen ? (
|
||||
<PendingInvites />
|
||||
) : (
|
||||
<section className="card invite-soon" aria-labelledby="invite-soon-title">
|
||||
<div className="card-head">
|
||||
<h2 id="invite-soon-title">Hívd meg, akit szeretsz</h2>
|
||||
<span className="badge">Hamarosan</span>
|
||||
</div>
|
||||
<p className="muted">
|
||||
Hamarosan te is meghívhatod a barátaidat, a családodat vagy a párodat: ők megadják a saját születési adataikat,
|
||||
ingyen megkapják a képletüket, és együtt megnézitek, mennyire illetek össze.
|
||||
</p>
|
||||
<div>
|
||||
<button type="button" className="btn" disabled>
|
||||
Meghívó küldése
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{!slots.unlimited && (
|
||||
<section className="card" aria-labelledby="slots-title">
|
||||
|
||||
@@ -14,16 +14,19 @@ import { NewPerson } from "./NewPerson";
|
||||
export function NewPersonChooser({
|
||||
canAdd,
|
||||
hasOwnChart,
|
||||
invitesOpen,
|
||||
full,
|
||||
}: {
|
||||
/** A slot is free for typed-in data. */
|
||||
canAdd: boolean;
|
||||
/** Inviting is on (until the launch it is shown, but off). */
|
||||
invitesOpen: boolean;
|
||||
/** Inviting compares with the user's own chart. */
|
||||
hasOwnChart: boolean;
|
||||
/** Shown instead of the form when no slot is left. */
|
||||
full: React.ReactNode;
|
||||
}) {
|
||||
const [mode, setMode] = useState<"data" | "invite">(canAdd ? "data" : "invite");
|
||||
const [mode, setMode] = useState<"data" | "invite">(canAdd || !invitesOpen ? "data" : "invite");
|
||||
return (
|
||||
<div className="field" style={{ gap: 18 }}>
|
||||
<div className="mode-switch" role="tablist" aria-label="Hogyan veszed fel?">
|
||||
@@ -41,11 +44,19 @@ export function NewPersonChooser({
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={mode === "invite"}
|
||||
aria-disabled={!invitesOpen}
|
||||
disabled={!invitesOpen}
|
||||
className="mode-option"
|
||||
onClick={() => setMode("invite")}
|
||||
>
|
||||
<strong>Meghívom</strong>
|
||||
<span>Ő adja meg a saját adatait, és megnézitek, mennyire illetek össze. Ingyenes, nem kell hozzá hely.</span>
|
||||
<strong>
|
||||
Meghívom {!invitesOpen && <span className="badge mode-soon">Hamarosan</span>}
|
||||
</strong>
|
||||
<span>
|
||||
{invitesOpen
|
||||
? "Ő adja meg a saját adatait, és megnézitek, mennyire illetek össze. Ingyenes, nem kell hozzá hely."
|
||||
: "Hamarosan meghívhatod azokat, akiket szeretsz: ők adják meg a saját adataikat, és együtt nézitek meg, mennyire illetek össze."}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
{mode === "data" ? (
|
||||
|
||||
@@ -27,6 +27,7 @@ export default async function NewPersonPage() {
|
||||
<NewPersonChooser
|
||||
canAdd={slots.left !== 0}
|
||||
hasOwnChart={me.primary_chart_id !== null}
|
||||
invitesOpen={(config?.user_invites ?? false) || me.user.roles.includes("admin")}
|
||||
full={
|
||||
<>
|
||||
<p className="muted">Elfogytak a helyeid. Újabb személyhez válassz csomagot, vagy hívd meg.</p>
|
||||
|
||||
Reference in New Issue
Block a user