2026-11-20 14:35:50 +00:00
|
|
|
import type { Metadata } from "next";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
|
|
|
|
|
|
import { TarotLive } from "@/components/tarot/TarotLive";
|
|
|
|
|
import { backendGet, requireMe } from "@/lib/server";
|
|
|
|
|
import type { TarotReading } from "@/lib/tarot";
|
|
|
|
|
|
|
|
|
|
export const metadata: Metadata = { title: "Kártyajóslás" };
|
|
|
|
|
|
|
|
|
|
const day = (iso: string) =>
|
|
|
|
|
new Date(iso).toLocaleDateString("hu-HU", { timeZone: "Europe/Budapest", year: "numeric", month: "long", day: "numeric" });
|
|
|
|
|
|
|
|
|
|
/** One of the user's readings. */
|
|
|
|
|
export default async function TarotReadingPage({ params }: { params: Promise<{ id: string }> }) {
|
|
|
|
|
const { id } = await params;
|
|
|
|
|
const me = await requireMe(`/kartyajoslas/${id}`);
|
|
|
|
|
const reading = await backendGet<TarotReading>(`/v1/tarot/readings/${encodeURIComponent(id)}`);
|
|
|
|
|
if (!reading) notFound();
|
|
|
|
|
return (
|
|
|
|
|
<main className="page" style={{ maxWidth: 1040 }}>
|
|
|
|
|
<div className="page-head">
|
|
|
|
|
<Link href="/kartyajoslas" className="hint">
|
|
|
|
|
← Kártyajóslás
|
|
|
|
|
</Link>
|
|
|
|
|
<span className="eyebrow">
|
2026-11-20 16:25:12 +00:00
|
|
|
{reading.topic_name ? `${reading.topic_name} · ` : ""}
|
2026-11-20 14:35:50 +00:00
|
|
|
{reading.spread_name} · {day(reading.created_at)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<section className="card">
|
|
|
|
|
<TarotLive key={reading.id} initial={reading} isAdmin={me.user.roles.includes("admin")} />
|
|
|
|
|
</section>
|
|
|
|
|
</main>
|
|
|
|
|
);
|
|
|
|
|
}
|