Tarot readings: AI-written, drawn on the server, sold as units
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 5m52s
CI / deploy (push) Skipped

A new Kártyajóslás page: choose a spread (1, 3 or 5 cards), ask a
question, pick the cards from the fanned deck and watch them turn over;
the reading is written by the detailed-analysis model from the cards,
their positions and base meanings, the question and the reader's Sun,
Moon and Ascendant. The server shuffles and draws, so nobody can draw
again for free. A reading is a 'tarot' analysis (worker, retries,
fallback, refunds and admin regeneration as for analyses), uses one
'tarot' unit, and survives recalculations; deleting the account
deletes it.

Packages carry 2/5/10 readings, the new +5 kártyajóslás addon costs
1 000 Ft. The card artwork comes from the tarot design studio
(celestial astrolabe style); the deck JSON is shared by the frontend
and the prompt. A public example is at /kartyajoslas/pelda.

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-20 14:35:50 +00:00
co-authored by Claude Opus 5.5
parent 54af54cd39
commit b0fc547b73
36 changed files with 2957 additions and 46 deletions
@@ -8,13 +8,14 @@ import { ROLE_LABELS, formatDate } from "@/lib/astro";
import type { AdminUser, Package, Role } from "@/lib/types";
const EDITABLE_ROLES: Role[] = ["user", "creator", "admin"];
type UnitKind = "natal" | "synastry" | "forecast" | "question";
type UnitKind = "natal" | "synastry" | "forecast" | "question" | "tarot";
const UNITS: { value: UnitKind; label: string }[] = [
{ value: "natal", label: "képlet" },
{ value: "synastry", label: "szinasztria" },
{ value: "forecast", label: "előrejelzés" },
{ value: "question", label: "kérdés" },
{ value: "tarot", label: "kártyajóslás" },
];
export function AdminUsers({ selfId }: { selfId: string }) {
@@ -183,6 +184,8 @@ function UserRow({
előrejelzés {user.analyses_left.forecast ?? 0}
<br />
kérdés {user.analyses_left.question ?? 0}
<br />
jóslás {user.analyses_left.tarot ?? 0}
</span>
<label className="sr-only" htmlFor={`unit-${user.id}`}>
Elemzés fajtája
@@ -31,6 +31,10 @@ const FAQ: [string, string][] = [
"Mit jelent a kérdés?",
"A kész képletelemzésed, kapcsolati elemzésed vagy éves előrejelzésed alatt kérdezhetsz róla, például hogy mit jelent egy fényszög a munkádra nézve, mire figyeljetek egy kapcsolatban, vagy mire figyelj egy időszakban. A válasz a képleted és az elemzés alapján készül, legfeljebb 250 szóban. Minden csomagban 3 kérdés van, és külön is vehetsz még.",
],
[
"Mi a kártyajóslás?",
"Kérdezel, kiválasztasz egy kirakást (1, 3 vagy 5 lap), és húzol a megkevert pakliból. A kihúzott lapokra, a kérdésedre és a képleted Napjára, Holdjára és Aszcendensére személyre szabott értelmezés készül. Egy jóslás egyet használ, a kirakás méretétől függetlenül. A csomagokban van néhány, és külön is vehetsz ötöt egyben.",
],
[
"Mire kell a személyhely?",
"A saját képleted mellé felvett emberekhez (társ, gyerek, barát). Egy személy felvétele egy helyet használ; a képlete és a rövid összefoglalója ingyenes, a részletes elemzés külön jár.",
@@ -65,6 +69,7 @@ export default async function PackagesPage() {
<p>
<strong>{left.natal}</strong> képletelemzés · <strong>{left.synastry}</strong> kapcsolati elemzés ·{" "}
<strong>{left.forecast}</strong> éves előrejelzés · <strong>{left.question ?? 0}</strong> kérdés ·{" "}
<strong>{left.tarot ?? 0}</strong> kártyajóslás ·{" "}
{slots.unlimited ? (
"korlátlan személy"
) : (
+72
View File
@@ -964,3 +964,75 @@ a.pair-row:hover strong { color: var(--gold); }
@media (max-width: 640px) {
.invoice-table th:nth-child(3), .invoice-table td:nth-child(3) { display: none; }
}
/* Kártyajóslás */
.tarot { display: flex; flex-direction: column; gap: 24px; }
.tarot-card { display: block; width: 100%; height: auto; border-radius: 9px; user-select: none; }
.tarot-card-sm { width: 120px; flex: none; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); }
.tarot-card-xs { width: 30px; border-radius: 4px; }
.tarot-question { font-family: var(--font-display); font-size: 20px; font-style: italic; color: var(--ink-2); }
.tarot-spreads { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.tarot-spreads legend { margin-bottom: 8px; }
.tarot-spread {
display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; cursor: pointer;
border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); transition: border-color 0.15s;
}
.tarot-spread:hover { border-color: #5a6790; }
.tarot-spread.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tarot-spread:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.tarot-spread-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.tarot-stage { align-items: stretch; }
.tarot-stage-head { display: flex; flex-direction: column; gap: 6px; text-align: center; align-items: center; }
.tarot-slots { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 20px; }
.tarot-slot { width: 132px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.tarot-slots[data-count="5"] .tarot-slot { width: 118px; }
.tarot-slot-title { font-size: 13px; font-weight: 600; color: var(--gold); line-height: 1.3; }
.tarot-slot-empty { width: 100%; aspect-ratio: 3 / 5; border: 1px dashed var(--line-2); border-radius: 9px; }
.tarot-flip { width: 100%; aspect-ratio: 3 / 5; perspective: 900px; }
.tarot-flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.75s cubic-bezier(0.3, 0.7, 0.3, 1); animation: tarot-land 0.35s ease-out; }
.tarot-flip.is-flipped .tarot-flip-inner { transform: rotateY(180deg); }
.tarot-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); }
.tarot-front { transform: rotateY(180deg); }
@keyframes tarot-land { from { transform: translateY(-18px); opacity: 0; } to { transform: none; opacity: 1; } }
/* The shuffled deck, fanned out: each card turns around a point far below. */
.tarot-fan { --w: 64px; --step: 4.2deg; position: relative; height: calc(var(--w) * 3.5); margin: 12px auto 0; width: 100%; max-width: 560px; overflow: visible; }
.tarot-fan-card {
position: absolute; left: calc(50% - var(--w) / 2); top: 12px; width: var(--w); padding: 0; border: 0; background: none; cursor: pointer;
transform-origin: 50% 330%; transform: rotate(calc(var(--i) * var(--step))); transition: transform 0.2s ease, opacity 0.25s ease;
}
.tarot-fan-card .tarot-card { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }
.tarot-fan-card:hover:not(:disabled), .tarot-fan-card:focus-visible { transform: rotate(calc(var(--i) * var(--step))) translateY(-14px); }
.tarot-fan-card.is-picked { opacity: 0; transform: rotate(calc(var(--i) * var(--step))) translateY(-60px); cursor: default; }
.tarot-result { display: flex; flex-direction: column; gap: 28px; }
.tarot-result-head { display: flex; flex-direction: column; gap: 10px; }
.tarot-summary { font-size: 17px; color: var(--ink-2); }
.tarot-card-texts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 28px; }
.tarot-card-text { display: flex; gap: 22px; align-items: flex-start; }
.tarot-card-text-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tarot-synthesis, .tarot-advice { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 22px; }
.tarot-advice h3 { color: var(--gold); }
.tarot-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tarot-history li + li { border-top: 1px solid var(--line); }
.tarot-history-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; color: var(--ink); text-decoration: none; }
.tarot-history-row:hover strong { color: var(--gold); }
.tarot-history-cards { display: flex; gap: 3px; flex: none; }
.tarot-history-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (max-width: 640px) {
.tarot-fan { --w: 46px; --step: 4deg; }
.tarot-slot { width: calc((100% - 40px) / 3); }
.tarot-slots[data-count="1"] .tarot-slot { width: 46%; }
.tarot-slots[data-count="5"] .tarot-slot { width: calc((100% - 40px) / 3); }
.tarot-card-text { flex-direction: column; align-items: center; }
.tarot-card-text-body { align-self: stretch; }
.tarot-history-cards .tarot-card-xs:nth-child(n + 4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
.tarot-flip-inner, .tarot-fan-card { transition: none; animation: none; }
}
@@ -0,0 +1,35 @@
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">
{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>
);
}
@@ -0,0 +1,37 @@
import type { Metadata } from "next";
import Link from "next/link";
import { TarotTable } from "@/components/tarot/TarotTable";
import { payMethod } from "@/lib/payments";
import { backendGet, requireMe } from "@/lib/server";
import type { TarotReading } from "@/lib/tarot";
import type { PublicConfig } from "@/lib/types";
export const metadata: Metadata = { title: "Kártyajóslás" };
/** Tarot readings written for the user's own question. */
export default async function TarotPage() {
const me = await requireMe("/kartyajoslas");
const [data, config] = await Promise.all([
backendGet<{ readings: TarotReading[]; left: number }>("/v1/tarot/readings"),
backendGet<PublicConfig>("/v1/config"),
]);
return (
<main className="page" style={{ maxWidth: 1040 }}>
<div className="page-head">
<span className="eyebrow">Tarot</span>
<h1>Kártyajóslás</h1>
<p className="muted">
Kérdezz, húzz lapot, és a kirakásod alapján személyre szabott jóslást kapsz. A lapok értelmezéséhez a képleted
Napja, Holdja és Aszcendense is hozzájárul. <Link href="/kartyajoslas/pelda">Példajóslás →</Link>
</p>
</div>
<TarotTable
readings={data?.readings ?? []}
left={data?.left ?? me.analyses_left.tarot ?? 0}
isAdmin={me.user.roles.includes("admin")}
canPay={payMethod(config, me)}
/>
</main>
);
}
@@ -0,0 +1,55 @@
import type { Metadata } from "next";
import Link from "next/link";
import { PublicHeader } from "@/components/SiteHeader";
import { TarotResult } from "@/components/tarot/TarotResult";
import example from "@/content/tarot-pelda.json";
import { getMe } from "@/lib/server";
import type { TarotContent, TarotReading } from "@/lib/tarot";
export const metadata: Metadata = {
title: "Példajóslás",
description: "Így néz ki egy Sorsfonalak-kártyajóslás: három lap egy kitalált kérdésre, személyre szabott értelmezéssel.",
};
/** A full example tarot reading for a made-up question, for visitors and users without readings. */
export default async function TarotExamplePage() {
const me = await getMe();
return (
<>
{!me && <PublicHeader />}
<main className="page" style={{ maxWidth: 1040 }}>
<div className="page-head">
<span className="eyebrow">Példajóslás</span>
<h1>Így néz ki egy kártyajóslás</h1>
<p className="muted">
A kérdés és a képlet kitalált ({example.signs}), a kirakás: {example.spread_name}. A saját jóslásod a te
kérdésedre, a te lapjaidra és a képletedre készül.
</p>
</div>
<section className="card">
<TarotResult
cards={example.cards as TarotReading["cards"]}
question={example.question}
content={example.content as TarotContent}
/>
</section>
<section className="card" style={{ gap: 12 }}>
<p>
{me
? "Kérdezz te is: húzz lapot a saját kérdésedre."
: "Lépj be, és a csomagodban lévő jóslásokkal a saját kérdéseidre húzhatsz lapot."}
</p>
<div className="form-actions">
<Link href={me ? "/kartyajoslas" : "/belepes?vissza=/kartyajoslas"} className="btn btn-primary">
{me ? "Saját jóslás" : "Belépés"}
</Link>
<Link href="/csomagok" className="btn btn-ghost">
Csomagok
</Link>
</div>
</section>
</main>
</>
);
}
+1
View File
@@ -9,6 +9,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
return [
{ url: `${base}/`, changeFrequency: "weekly", priority: 1 },
{ url: `${base}/pelda`, changeFrequency: "monthly", priority: 0.8 },
{ url: `${base}/kartyajoslas/pelda`, changeFrequency: "monthly", priority: 0.7 },
{ url: `${base}/aszf`, changeFrequency: "yearly", priority: 0.2 },
{ url: `${base}/adatvedelem`, changeFrequency: "yearly", priority: 0.2, alternates: privacy },
{ url: `${base}/privacy`, changeFrequency: "yearly", priority: 0.2, alternates: privacy },