Tarot readings have a topic: general, relationship, work, self-knowledge
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:
@@ -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" : ""}
|
||||
|
||||
Reference in New Issue
Block a user