diff --git a/services/frontend/src/app/globals.css b/services/frontend/src/app/globals.css index fec995d..2dce34f 100644 --- a/services/frontend/src/app/globals.css +++ b/services/frontend/src/app/globals.css @@ -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; } diff --git a/services/frontend/src/app/kepletek/[id]/javitas/EditPerson.tsx b/services/frontend/src/app/kepletek/[id]/javitas/EditPerson.tsx index bdbdd34..c2d52cf 100644 --- a/services/frontend/src/app/kepletek/[id]/javitas/EditPerson.tsx +++ b/services/frontend/src/app/kepletek/[id]/javitas/EditPerson.tsx @@ -19,7 +19,7 @@ export function EditPerson({ router.push("/kepletek")} + onCancel={() => router.push("/szemelyek")} onSaved={() => { router.push(`/kepletek/${id}`); router.refresh(); diff --git a/services/frontend/src/app/kepletek/[id]/page.tsx b/services/frontend/src/app/kepletek/[id]/page.tsx index 3f02e38..9fe79ab 100644 --- a/services/frontend/src/app/kepletek/[id]/page.tsx +++ b/services/frontend/src/app/kepletek/[id]/page.tsx @@ -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} />

@@ -114,6 +116,22 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri )} )} + {chart.is_primary && ( + + Személyek + + {persons.length > 0 ? `${persons.length} felvett személy` : "Társad, családod képlete"} + + + {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."} + + + + )} diff --git a/services/frontend/src/app/kepletek/page.tsx b/services/frontend/src/app/kepletek/page.tsx index bb1e684..2130142 100644 --- a/services/frontend/src/app/kepletek/page.tsx +++ b/services/frontend/src/app/kepletek/page.tsx @@ -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("/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 ( -

-
-

Képletek

-

A saját képleted és azoké, akiket felvettél: mindegyikhez kérhetsz részletes elemzést.

-
- -
- {own ? ( - - Saját képletem - - ) : ( - - Én - Add meg a születési adataidat a profilodban. - - )} - - {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."} -

- -
- )} -
- ); +// The persons list moved to /szemelyek. +export default function ChartsIndex() { + redirect("/szemelyek"); } diff --git a/services/frontend/src/app/szemelyek/page.tsx b/services/frontend/src/app/szemelyek/page.tsx new file mode 100644 index 0000000..88160b1 --- /dev/null +++ b/services/frontend/src/app/szemelyek/page.tsx @@ -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("/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 ( +
+
+

Személyek

+

+ 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. +

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

+ +
+ )} +
+ ); +} diff --git a/services/frontend/src/app/kepletek/uj/NewPerson.tsx b/services/frontend/src/app/szemelyek/uj/NewPerson.tsx similarity index 86% rename from services/frontend/src/app/kepletek/uj/NewPerson.tsx rename to services/frontend/src/app/szemelyek/uj/NewPerson.tsx index 7b29214..727c733 100644 --- a/services/frontend/src/app/kepletek/uj/NewPerson.tsx +++ b/services/frontend/src/app/szemelyek/uj/NewPerson.tsx @@ -10,7 +10,7 @@ export function NewPerson() { router.push("/kepletek")} + onCancel={() => router.push("/szemelyek")} onSaved={(id) => router.push(`/kepletek/${id}`)} /> ); diff --git a/services/frontend/src/app/kepletek/uj/page.tsx b/services/frontend/src/app/szemelyek/uj/page.tsx similarity index 96% rename from services/frontend/src/app/kepletek/uj/page.tsx rename to services/frontend/src/app/szemelyek/uj/page.tsx index 3b06128..ddfc7c1 100644 --- a/services/frontend/src/app/kepletek/uj/page.tsx +++ b/services/frontend/src/app/szemelyek/uj/page.tsx @@ -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("/v1/config"); const slots = me.persons; diff --git a/services/frontend/src/components/ChartSwitcher.tsx b/services/frontend/src/components/ChartSwitcher.tsx index 22d526d..b14bcaf 100644 --- a/services/frontend/src/components/ChartSwitcher.tsx +++ b/services/frontend/src/components/ChartSwitcher.tsx @@ -83,8 +83,8 @@ export function ChartSwitcher({ ))}
- {canAdd && + Új személy} - Összes képlet + {canAdd && + Új személy} + Személyek
)} diff --git a/services/frontend/src/components/SiteHeader.tsx b/services/frontend/src/components/SiteHeader.tsx index bba7443..1da2ab2 100644 --- a/services/frontend/src/components/SiteHeader.tsx +++ b/services/frontend/src/components/SiteHeader.tsx @@ -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" });