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("/v1/config"), ]); const charts = list?.charts ?? []; const persons = charts.filter((c) => c.kind === "person"); const ownId = charts.find((c) => c.is_primary)?.id ?? null; const isAdmin = me.user.roles.includes("admin"); const slots = me.persons; const full = slots.left === 0; const now = Date.now(); return (

Személyek

Társad, családtagjaid, barátaid képlete. Mindegyikhez kérhetsz részletes elemzést, összevetheted a sajátoddal, és a képletoldal címére kattintva válthatsz köztük.

{persons.map((p) => ( now)} /> ))} {!full && ( Új személy {slots.unlimited ? "Korlátlan számú személy" : `Még ${slots.left} személyt vehetsz fel`} )}
{!slots.unlimited && (

Személyek

{slots.used} / {slots.limit} hely

{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."}

)}
); }