2026-11-15 21:00:50 +00:00
|
|
|
|
import type { Metadata } from "next";
|
|
|
|
|
|
|
|
|
|
|
|
import { ROLE_LABELS, formatDate } from "@/lib/astro";
|
|
|
|
|
|
import { backendGet, requireMe } from "@/lib/server";
|
|
|
|
|
|
import type { Chart } from "@/lib/types";
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
2026-11-16 06:37:59 +00:00
|
|
|
|
<p className="muted">A fiókod és a születési adataid.</p>
|
2026-11-15 21:00:50 +00:00
|
|
|
|
</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>
|
2026-11-16 17:39:15 +00:00
|
|
|
|
<dt>Részletes elemzések</dt>
|
|
|
|
|
|
<dd>
|
|
|
|
|
|
{me.analyses_left.natal} képlet, {me.analyses_left.synastry} szinasztria
|
|
|
|
|
|
</dd>
|
2026-11-17 11:03:55 +00:00
|
|
|
|
<dt>Személyek</dt>
|
|
|
|
|
|
<dd>
|
|
|
|
|
|
{me.persons.unlimited ? `${me.persons.used} felvéve, korlátlan` : `${me.persons.used} / ${me.persons.limit} hely`}
|
|
|
|
|
|
</dd>
|
2026-11-15 21:00:50 +00:00
|
|
|
|
<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
|
|
|
|
|
|
}
|
2026-11-16 06:37:59 +00:00
|
|
|
|
chartId={chart?.id ?? null}
|
2026-11-17 06:45:33 +00:00
|
|
|
|
notice={me.birth_change.notice}
|
2026-11-16 06:37:59 +00:00
|
|
|
|
/>
|
2026-11-15 21:00:50 +00:00
|
|
|
|
</section>
|
|
|
|
|
|
</main>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|