Inviting a person to compare charts
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:
@@ -3,6 +3,7 @@ import Link from "next/link";
|
||||
|
||||
import { ChartCard } from "@/components/ChartCard";
|
||||
import { PersonActions } from "@/components/PersonActions";
|
||||
import { PendingInvites } from "@/components/PendingInvites";
|
||||
import { PersonPacks } from "@/components/PersonPacks";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import type { ChartListItem, PublicConfig } from "@/lib/types";
|
||||
@@ -46,19 +47,23 @@ export default async function PersonsPage() {
|
||||
</ChartCard>
|
||||
))}
|
||||
|
||||
{!full && (
|
||||
<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">
|
||||
{slots.unlimited ? "Korlátlan számú személy" : `Még ${slots.left} személyt vehetsz fel`}
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<PendingInvites />
|
||||
|
||||
{!slots.unlimited && (
|
||||
<section className="card" aria-labelledby="slots-title">
|
||||
<div className="card-head">
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
||||
import { InvitePerson } from "@/components/InvitePerson";
|
||||
|
||||
import { NewPerson } from "./NewPerson";
|
||||
|
||||
/**
|
||||
* Adding a person: typing in their birth data (uses a slot), or inviting
|
||||
* them to compare charts (they give their own data; no slot used).
|
||||
*/
|
||||
export function NewPersonChooser({
|
||||
canAdd,
|
||||
hasOwnChart,
|
||||
full,
|
||||
}: {
|
||||
/** A slot is free for typed-in data. */
|
||||
canAdd: 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");
|
||||
return (
|
||||
<div className="field" style={{ gap: 18 }}>
|
||||
<div className="mode-switch" role="tablist" aria-label="Hogyan veszed fel?">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={mode === "data"}
|
||||
className="mode-option"
|
||||
onClick={() => setMode("data")}
|
||||
>
|
||||
<strong>Adatok megadása</strong>
|
||||
<span>Te írod be a születési adatait. Egy személyhelyet használ.</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={mode === "invite"}
|
||||
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>
|
||||
</button>
|
||||
</div>
|
||||
{mode === "data" ? (
|
||||
canAdd ? (
|
||||
<>
|
||||
<NewPerson />
|
||||
<p className="hint">Az adatokat a felvételt követő egy órán belül még javíthatod, utána nem módosíthatók.</p>
|
||||
</>
|
||||
) : (
|
||||
full
|
||||
)
|
||||
) : hasOwnChart ? (
|
||||
<>
|
||||
<InvitePerson />
|
||||
<p className="hint">
|
||||
A meghívott a saját képletét és rövid összefoglalóját ingyen kapja. Ti ketten az összevetést látjátok, egymás
|
||||
születési adatait nem. A részletes kapcsolati elemzést bármelyikőtök kérheti egy kapcsolati elemzéssel, és
|
||||
mindketten látjátok.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p className="muted">
|
||||
A meghívó a saját képleteddel veti össze az övét, ezért előbb <Link href="/profil#birth">add meg a saját
|
||||
születési adataidat</Link>.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { PersonPacks } from "@/components/PersonPacks";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import type { PublicConfig } from "@/lib/types";
|
||||
|
||||
import { NewPerson } from "./NewPerson";
|
||||
import { NewPersonChooser } from "./NewPersonChooser";
|
||||
|
||||
export const metadata: Metadata = { title: "Új személy" };
|
||||
|
||||
@@ -18,22 +18,22 @@ export default async function NewPersonPage() {
|
||||
<div className="page-head">
|
||||
<h1>Új személy</h1>
|
||||
<p className="muted">
|
||||
Társad, családtagod, barátod: a születési adataiból elkészül a képlete és egy rövid összefoglaló.
|
||||
Társad, családtagod, barátod: megadhatod a születési adatait, vagy meghívhatod, hogy ő adja meg, és megnézzétek,
|
||||
mennyire illetek össze.
|
||||
{!slots.unlimited && slots.left !== null && slots.left > 0 && ` Még ${slots.left} személyt vehetsz fel.`}
|
||||
</p>
|
||||
</div>
|
||||
<section className="card" aria-label="Születési adatok">
|
||||
{slots.left === 0 ? (
|
||||
<>
|
||||
<p className="muted">Elfogytak a helyeid. Újabb személyhez válassz csomagot.</p>
|
||||
<PersonPacks canPay={config?.mock_payments ?? false} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<NewPerson />
|
||||
<p className="hint">Az adatokat a felvételt követő egy órán belül még javíthatod, utána nem módosíthatók.</p>
|
||||
</>
|
||||
)}
|
||||
<section className="card" aria-label="Új személy">
|
||||
<NewPersonChooser
|
||||
canAdd={slots.left !== 0}
|
||||
hasOwnChart={me.primary_chart_id !== null}
|
||||
full={
|
||||
<>
|
||||
<p className="muted">Elfogytak a helyeid. Újabb személyhez válassz csomagot, vagy hívd meg.</p>
|
||||
<PersonPacks canPay={config?.mock_payments ?? false} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user