Tarot readings: AI-written, drawn on the server, sold as units
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:
@@ -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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user