Files
sorsfonalak/services/frontend/src/app/profil/page.tsx
T
fecoandClaude Opus 5.5 e004ea696b
CI / test (push) Successful in 47s
CI / build (push) Successful in 4m19s
CI / deploy (push) Skipped
Packages: from one analysis to unlimited, admin can give them
A fixed catalog (packages.rs, reasoning in docs/csomagok.md): Egy elemzés
2 990 Ft, Páros 6 990 Ft, Család 11 990 Ft (featured), Korlátlan 17 990 Ft
for a year, and two top-ups. Every grant is a package_orders row; units are
credit_ledger rows with reason 'package' and never expire. The unlimited
package is a time-limited 'unlimited' entitlement: analyses use no unit and
persons have no limit, with a daily fair-use cap (UNLIMITED_DAILY_LIMIT, 5);
buying it again extends it by a year.

- GET /v1/packages, mock payment by package id, /v1/me unlimited_until
- POST /v1/admin/users/{id}/packages: give a package as a gift
- /csomagok page; the paid step of an analysis offers three packages with
  the bigger one featured; person packs use the catalog; admin user list
  has a package column
- PERSON_PACK_SIZE is replaced by the catalog's +5 személy top-up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-17 16:19:20 +00:00

99 lines
3.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata } from "next";
import Link from "next/link";
import { ROLE_LABELS, formatDate } from "@/lib/astro";
import { backendGet, requireMe } from "@/lib/server";
import type { Chart } from "@/lib/types";
import { AccountData } from "./AccountData";
import { BirthEditor } from "./BirthEditor";
import { ProfileForm } from "./ProfileForm";
export const metadata: Metadata = { title: "Profil" };
const PROVIDERS: Record<string, string> = { google: "Google", password: "E-mail és jelszó" };
export default async function ProfilePage() {
const me = await requireMe("/profil");
const chart = me.primary_chart_id ? await backendGet<Chart>(`/v1/charts/${me.primary_chart_id}`) : null;
const { user } = me;
return (
<main className="page">
<div className="page-head">
<h1>Profil</h1>
<p className="muted">A fiókod és a születési adataid.</p>
</div>
<section className="card" aria-labelledby="account">
<div className="card-head">
<h2 id="account">Fiók</h2>
<div className="row" style={{ gap: 6 }}>
{user.roles.map((r) => (
<span key={r} className={r === "user" ? "badge" : "badge badge-gold"}>
{ROLE_LABELS[r] ?? r}
</span>
))}
</div>
</div>
<div className="grid-2">
<dl className="facts">
<dt>E-mail</dt>
<dd>
{user.email} {user.email_verified && <span className="badge">megerősítve</span>}
</dd>
<dt>Belépés</dt>
<dd>{me.providers.map((p) => PROVIDERS[p] ?? p).join(", ") || "–"}</dd>
<dt>Részletes elemzések</dt>
<dd>
{me.unlimited_until
? `Korlátlan, ${formatDate(me.unlimited_until).replace(/\.$/, "")}-ig`
: `${me.analyses_left.natal} képlet, ${me.analyses_left.synastry} kapcsolati`}{" "}
· <Link href="/csomagok">Csomagok</Link>
</dd>
<dt>Személyek</dt>
<dd>
{me.persons.unlimited ? `${me.persons.used} felvéve, korlátlan` : `${me.persons.used} / ${me.persons.limit} hely`}
</dd>
<dt>Tag óta</dt>
<dd>{formatDate(user.created_at)}</dd>
</dl>
<ProfileForm displayName={user.display_name ?? ""} locale={user.locale} />
</div>
</section>
<section className="card" aria-labelledby="birth">
<div className="card-head">
<h2 id="birth">Születési adataim</h2>
{chart && !chart.highlights.time_known && <span className="badge">ismeretlen születési idő</span>}
</div>
<BirthEditor
chart={
chart
? {
birth: chart.birth_data,
placeName: chart.chart.location.place?.name ?? null,
region: chart.chart.location.place?.region ?? null,
countryCode: chart.chart.location.place?.country_code ?? chart.birth_data.country ?? null,
zone: chart.chart.time.zone,
utcOffset: chart.chart.time.utc_offset,
dst: chart.chart.time.dst,
}
: null
}
chartId={chart?.id ?? null}
notice={me.birth_change.notice}
/>
</section>
<section className="card" aria-labelledby="adataim">
<h2 id="adataim">Adataim</h2>
<p className="muted">
Hogyan kezeljük az adataidat: <Link href="/adatvedelem">adatvédelmi tájékoztató</Link>.
</p>
<AccountData />
</section>
</main>
);
}