Own chart back on the Képletem menu; persons get their own menu, page and a tile
CI / test (push) Failing after 41s
CI / build (push) Skipped
CI / deploy (push) Skipped

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-17 11:20:26 +00:00
co-authored by Claude Opus 5.5
parent fef1605848
commit 0791998c13
9 changed files with 114 additions and 92 deletions
+6
View File
@@ -388,3 +388,9 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.switcher-foot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 12px 6px; font-size: 14px; }
.switcher-foot a { color: var(--gold); text-decoration: none; }
.switcher-foot a:hover { text-decoration: underline; }
.persons-tile { position: relative; gap: 4px; padding: 16px 48px 16px 20px; color: inherit; text-decoration: none; transition: border-color 0.15s; }
.persons-tile:hover { border-color: var(--gold); }
.persons-tile strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.persons-tile .muted { font-size: 14px; }
.persons-tile-arrow { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: 20px; }
@@ -19,7 +19,7 @@ export function EditPerson({
<BirthForm
initial={initial}
person={{ chartId: id, name }}
onCancel={() => router.push("/kepletek")}
onCancel={() => router.push("/szemelyek")}
onSaved={() => {
router.push(`/kepletek/${id}`);
router.refresh();
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import Link from "next/link";
import { notFound } from "next/navigation";
import { AspectGrid, AspectList, BigThree, PositionTables } from "@/components/ChartTables";
@@ -29,6 +30,7 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
backendGet<{ charts: ChartListItem[] }>("/v1/charts"),
]);
const charts = chartList?.charts ?? [];
const persons = charts.filter((c) => c.kind === "person");
if (!chart) notFound();
const list = analyses?.analyses ?? [];
const summary = list.find((a) => a.kind === "summary" && a.status !== "failed") ?? null;
@@ -50,7 +52,7 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
title={chart.is_primary ? "Születési képletem" : chart.label}
currentId={chart.id}
own={charts.find((c) => c.is_primary) ?? null}
persons={charts.filter((c) => c.kind === "person")}
persons={persons}
canAdd={me.persons.left !== 0}
/>
<p className="muted">
@@ -114,6 +116,22 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
)}
</div>
)}
{chart.is_primary && (
<Link href="/szemelyek" className="card persons-tile">
<span className="eyebrow">Személyek</span>
<strong>
{persons.length > 0 ? `${persons.length} felvett személy` : "Társad, családod képlete"}
</strong>
<span className="muted">
{persons.length > 0
? persons.slice(0, 3).map((p) => p.label).join(", ") + (persons.length > 3 ? "…" : "")
: "Vedd fel őket, és nézd meg az ő képletüket és elemzésüket is."}
</span>
<span className="persons-tile-arrow" aria-hidden="true">
→
</span>
</Link>
)}
</div>
</section>
+4 -85
View File
@@ -1,87 +1,6 @@
import type { Metadata } from "next";
import Link from "next/link";
import { redirect } from "next/navigation";
import { ChartCard } from "@/components/ChartCard";
import { PersonActions } from "@/components/PersonActions";
import { PersonPacks } from "@/components/PersonPacks";
import { backendGet, requireMe } from "@/lib/server";
import type { ChartListItem, PublicConfig } from "@/lib/types";
export const metadata: Metadata = { title: "Képletek" };
/** The user's own chart and the persons they added, with room for a new one. */
export default async function ChartsPage() {
const me = await requireMe("/kepletek");
const [list, config] = await Promise.all([
backendGet<{ charts: ChartListItem[] }>("/v1/charts"),
backendGet<PublicConfig>("/v1/config"),
]);
const charts = list?.charts ?? [];
const own = charts.find((c) => c.is_primary);
const persons = charts.filter((c) => c.kind === "person");
const isAdmin = me.user.roles.includes("admin");
const slots = me.persons;
const full = slots.left === 0;
const now = Date.now();
return (
<main className="page" style={{ maxWidth: 1080 }}>
<div className="page-head">
<h1>Képletek</h1>
<p className="muted">A saját képleted és azoké, akiket felvettél: mindegyikhez kérhetsz részletes elemzést.</p>
</div>
<div className="chart-cards">
{own ? (
<ChartCard chart={own} title="Én">
<span className="chart-card-tag">Saját képletem</span>
</ChartCard>
) : (
<Link href="/profil#birth" className="chart-card chart-card-new">
<strong className="chart-card-name">Én</strong>
<span className="muted">Add meg a születési adataidat a profilodban.</span>
</Link>
)}
{persons.map((p) => (
<ChartCard key={p.id} chart={p} title={p.label}>
<PersonActions
id={p.id}
name={p.label}
editable={isAdmin || (p.editable_until !== null && Date.parse(p.editable_until) > now)}
/>
</ChartCard>
))}
{!full && (
<Link href="/kepletek/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>
)}
</div>
{!slots.unlimited && (
<section className="card" aria-labelledby="slots-title">
<div className="card-head">
<h2 id="slots-title">Személyek</h2>
<span className="badge">
{slots.used} / {slots.limit} hely
</span>
</div>
<p className="muted">
{full
? "Elfogytak a helyeid. Újabb személyhez válassz csomagot."
: "A felvett személyek képletét és elemzéseit itt éred el. Egy törölt személy helye nem szabadul fel."}
</p>
<PersonPacks packSize={config?.person_pack_size ?? 5} canPay={config?.mock_payments ?? false} />
</section>
)}
</main>
);
// The persons list moved to /szemelyek.
export default function ChartsIndex() {
redirect("/szemelyek");
}
@@ -0,0 +1,78 @@
import type { Metadata } from "next";
import Link from "next/link";
import { ChartCard } from "@/components/ChartCard";
import { PersonActions } from "@/components/PersonActions";
import { PersonPacks } from "@/components/PersonPacks";
import { backendGet, requireMe } from "@/lib/server";
import type { ChartListItem, PublicConfig } from "@/lib/types";
export const metadata: Metadata = { title: "Személyek" };
/** The persons the user added, with room for a new one. */
export default async function PersonsPage() {
const me = await requireMe("/szemelyek");
const [list, config] = await Promise.all([
backendGet<{ charts: ChartListItem[] }>("/v1/charts"),
backendGet<PublicConfig>("/v1/config"),
]);
const charts = list?.charts ?? [];
const persons = charts.filter((c) => c.kind === "person");
const isAdmin = me.user.roles.includes("admin");
const slots = me.persons;
const full = slots.left === 0;
const now = Date.now();
return (
<main className="page" style={{ maxWidth: 1080 }}>
<div className="page-head">
<h1>Személyek</h1>
<p className="muted">
Társad, családtagjaid, barátaid képlete. Mindegyikhez kérhetsz részletes elemzést, és a képletoldal címére
kattintva válthatsz köztük.
</p>
</div>
<div className="chart-cards">
{persons.map((p) => (
<ChartCard key={p.id} chart={p} title={p.label}>
<PersonActions
id={p.id}
name={p.label}
editable={isAdmin || (p.editable_until !== null && Date.parse(p.editable_until) > now)}
/>
</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>
)}
</div>
{!slots.unlimited && (
<section className="card" aria-labelledby="slots-title">
<div className="card-head">
<h2 id="slots-title">Személyek</h2>
<span className="badge">
{slots.used} / {slots.limit} hely
</span>
</div>
<p className="muted">
{full
? "Elfogytak a helyeid. Újabb személyhez válassz csomagot."
: "A felvett személyek képletét és elemzéseit itt éred el. Egy törölt személy helye nem szabadul fel."}
</p>
<PersonPacks packSize={config?.person_pack_size ?? 5} canPay={config?.mock_payments ?? false} />
</section>
)}
</main>
);
}
@@ -10,7 +10,7 @@ export function NewPerson() {
<BirthForm
initial={null}
person={{}}
onCancel={() => router.push("/kepletek")}
onCancel={() => router.push("/szemelyek")}
onSaved={(id) => router.push(`/kepletek/${id}`)}
/>
);
@@ -9,7 +9,7 @@ import { NewPerson } from "./NewPerson";
export const metadata: Metadata = { title: "Új személy" };
export default async function NewPersonPage() {
const me = await requireMe("/kepletek/uj");
const me = await requireMe("/szemelyek/uj");
const config = await backendGet<PublicConfig>("/v1/config");
const slots = me.persons;
@@ -83,8 +83,8 @@ export function ChartSwitcher({
))}
</ul>
<div className="switcher-foot">
{canAdd && <Link href="/kepletek/uj">+ Új személy</Link>}
<Link href="/kepletek">Összes képlet</Link>
{canAdd && <Link href="/szemelyek/uj">+ Új személy</Link>}
<Link href="/szemelyek">Személyek</Link>
</div>
</div>
)}
@@ -15,7 +15,8 @@ export function Logo() {
export function SiteHeader({ me }: { me: Me }) {
const links = [
{ href: "/kepletek", label: "Képletek" },
{ href: "/keplet", label: "Képletem" },
{ href: "/szemelyek", label: "Személyek" },
{ href: "/profil", label: "Profil" },
];
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });