Tarot readings have a topic: general, relationship, work, self-knowledge
CI / test (push) Successful in 1m27s
CI / build (push) Successful in 5m37s
CI / deploy (push) Skipped

The new reading form starts with the topic; it steers how the model
reads the cards (with the topic's own limits, e.g. no break-up
predictions for relationships) and shows on the reading and in the
list. Readings from before count as general.

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 16:25:12 +00:00
co-authored by Claude Opus 5.5
parent b0e1270246
commit 7f6f05150e
8 changed files with 149 additions and 10 deletions
+9
View File
@@ -981,6 +981,15 @@ a.pair-row:hover strong { color: var(--gold); }
.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-topics { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tarot-topics legend { margin-bottom: 8px; }
.tarot-topic {
display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; cursor: pointer; font-size: 14px;
border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); color: var(--ink-2);
}
.tarot-topic:hover { border-color: #5a6790; }
.tarot-topic.is-active { border-color: var(--gold); color: var(--gold); background: rgba(217, 180, 106, 0.08); }
.tarot-topic: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; }
@@ -24,6 +24,7 @@ export default async function TarotReadingPage({ params }: { params: Promise<{ i
← Kártyajóslás
</Link>
<span className="eyebrow">
{reading.topic_name ? `${reading.topic_name} · ` : ""}
{reading.spread_name} · {day(reading.created_at)}
</span>
</div>
@@ -4,7 +4,15 @@ import Link from "next/link";
import { useCallback, useEffect, useState } from "react";
import { api, ApiError, errorText } from "@/lib/api";
import { SPREADS, TAROT_QUESTION_MAX, tarotCard, type SpreadId, type TarotReading } from "@/lib/tarot";
import {
SPREADS,
TAROT_QUESTION_MAX,
TOPICS,
tarotCard,
type SpreadId,
type TarotReading,
type TopicId,
} from "@/lib/tarot";
import type { PayMethod, UnitBalance } from "@/lib/types";
import { PackageChooser } from "../PackageCards";
@@ -40,6 +48,7 @@ export function TarotTable({
const [readings, setReadings] = useState(initialReadings);
const [left, setLeft] = useState(initialLeft);
const [spread, setSpread] = useState<SpreadId>("trinity");
const [topic, setTopic] = useState<TopicId>("general");
const [question, setQuestion] = useState("");
const [phase, setPhase] = useState<Phase>("setup");
const [picked, setPicked] = useState<number[]>([]);
@@ -68,7 +77,7 @@ export function TarotTable({
setError(null);
try {
const reading = await api<TarotReading>("/tarot/readings", {
body: { spread, question: question.trim() || null },
body: { spread, topic, question: question.trim() || null },
});
setCurrent(reading);
setReadings((all) => [reading, ...all]);
@@ -86,7 +95,7 @@ export function TarotTable({
}
}
},
[spread, question],
[spread, topic, question],
);
function pick(i: number) {
@@ -151,6 +160,22 @@ export function TarotTable({
</div>
) : (
<form className="field" style={{ gap: 18 }} onSubmit={start}>
<fieldset className="tarot-topics">
<legend className="label">Téma</legend>
{TOPICS.map((t) => (
<label key={t.id} className={t.id === topic ? "tarot-topic is-active" : "tarot-topic"}>
<input
type="radio"
name="topic"
value={t.id}
checked={t.id === topic}
onChange={() => setTopic(t.id)}
className="sr-only"
/>
{t.name}
</label>
))}
</fieldset>
<fieldset className="tarot-spreads">
<legend className="label">Kirakás</legend>
{SPREADS.map((s) => (
@@ -176,7 +201,7 @@ export function TarotTable({
rows={2}
maxLength={TAROT_QUESTION_MAX}
value={question}
placeholder="Pl. Mire figyeljek, ha munkahelyet váltanék? Kérdés nélkül általános útmutatást kapsz."
placeholder={`${TOPICS.find((x) => x.id === topic)?.example ?? ""} Kérdés nélkül a témában kapsz útmutatást.`}
onChange={(e) => setQuestion(e.target.value)}
/>
<span className="hint">
@@ -208,7 +233,9 @@ export function TarotTable({
{phase !== "setup" && (
<section className="card tarot-stage" aria-labelledby="tarot-stage-title">
<div className="tarot-stage-head">
<span className="eyebrow">{current?.spread_name ?? chosen.name}</span>
<span className="eyebrow">
{current?.spread_name ?? chosen.name} · {current?.topic_name ?? TOPICS.find((x) => x.id === topic)?.name}
</span>
<h2 id="tarot-stage-title">
{phase === "picking"
? `Válassz ${chosen.cards} lapot a pakliból`
@@ -266,7 +293,8 @@ export function TarotTable({
<span className="tarot-history-text">
<strong>{r.content?.title ?? r.question ?? r.spread_name}</strong>
<span className="hint">
{day(r.created_at)} · {r.spread_name}
{day(r.created_at)} · {r.topic_name ? `${r.topic_name} · ` : ""}
{r.spread_name}
{r.question && r.content ? ` · „${r.question}”` : ""}
{r.status === "pending" || r.status === "running" ? " · készül" : ""}
{r.status === "failed" ? " · nem sikerült" : ""}
+12
View File
@@ -43,6 +43,16 @@ export const SPREADS: { id: SpreadId; name: string; cards: number; about: string
},
];
export type TopicId = "general" | "love" | "work" | "self";
/** What a reading is about (the backend's `TOPICS`), with an example question. */
export const TOPICS: { id: TopicId; name: string; example: string }[] = [
{ id: "general", name: "Általános", example: "Pl. Mire figyeljek a következő hetekben?" },
{ id: "love", name: "Párkapcsolat", example: "Pl. Mit tehetek azért, hogy közelebb kerüljünk egymáshoz?" },
{ id: "work", name: "Munka és hivatás", example: "Pl. Mire figyeljek, ha munkahelyet váltanék?" },
{ id: "self", name: "Önismeret", example: "Pl. Mit tanulhatok most önmagamról?" },
];
/** Longest question (the backend's `TAROT_QUESTION_MAX_CHARS`). */
export const TAROT_QUESTION_MAX = 300;
@@ -60,6 +70,8 @@ export interface TarotReading {
status: "pending" | "running" | "done" | "failed";
spread: SpreadId;
spread_name: string | null;
topic: TopicId | null;
topic_name: string | null;
question: string | null;
cards: { card: string; reversed: boolean; position: string | null; about: string | null }[];
content: TarotContent | null;