Inviting a person to compare charts
CI / test (push) Successful in 1m15s
CI / build (push) Successful in 5m27s
CI / deploy (push) Skipped

The new person page offers 'Adatok megadása' (typed-in data, uses a slot)
or 'Meghívom': a 'how compatible are we?' link with an optional name,
e-mail and message (no links, 300 chars), shareable by copy, the phone's
share menu, WhatsApp or Facebook. With an address we e-mail it too (at most
10 a day per user, opted-out addresses skipped, unsubscribe link included).
The invitee lands on /meghivas/<token>, signs in, gives their own birth data
if needed and gets the comparison; the inviter is told and lists pending
invitations (revocable) on the persons page. No person slot is used.

Also: the accepted e-mail links to /osszevetesek/<id>, and the cross grid no
longer breaks on another user's chart (no highlights there).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-19 10:12:51 +00:00
co-authored by Claude Opus 5.5
parent 7b23d71526
commit 4f09aac3f5
16 changed files with 820 additions and 39 deletions
@@ -0,0 +1,63 @@
"use client";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { BirthForm } from "@/app/profil/BirthForm";
import { api, errorText } from "@/lib/api";
/** The logged-in invitee: gives their own birth data if needed, then the comparison is made. */
export function AcceptInvite({ token, hasOwnChart }: { token: string; hasOwnChart: boolean }) {
const router = useRouter();
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [needsChart, setNeedsChart] = useState(!hasOwnChart);
async function accept() {
setBusy(true);
setError(null);
try {
const s = await api<{ id: string }>("/invites/accept", { body: { token } });
router.push(`/osszevetesek/${s.id}`);
router.refresh();
} catch (e) {
setError(errorText(e));
setBusy(false);
}
}
if (needsChart) {
return (
<div className="field" style={{ gap: 12 }}>
<p>Add meg a születési adataidat: ebből készül a képleted, és ezt vetjük össze.</p>
<BirthForm
initial={null}
onSaved={() => {
setNeedsChart(false);
accept();
}}
/>
{error && (
<p className="msg msg-error" role="alert">
{error}
</p>
)}
</div>
);
}
return (
<div className="field" style={{ gap: 12 }}>
<p>A saját képleteddel vetjük össze.</p>
<div className="form-actions">
<button type="button" className="btn btn-primary" onClick={accept} disabled={busy}>
{busy ? "Készül az összevetés…" : "Összevetés elkészítése"}
</button>
</div>
{error && (
<p className="msg msg-error" role="alert">
{error}
</p>
)}
</div>
);
}