Tarot: a reading being written stays on the table
CI / test (push) Successful in 1m43s
CI / build (push) Successful in 7m2s
CI / deploy (push) Skipped

Opening the page while a reading is written shows that reading (cards and
progress), not the form for a new one; the 'Új jóslás' button appears
only once the reading is finished.

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-22 11:31:15 +00:00
co-authored by Claude Opus 5.5
parent f8386cbf55
commit 6c5f0b160e
@@ -50,10 +50,12 @@ export function TarotTable({
const [spread, setSpread] = useState<SpreadId>("trinity");
const [topic, setTopic] = useState<TopicId>("general");
const [question, setQuestion] = useState("");
const [phase, setPhase] = useState<Phase>("setup");
// A reading still being written is shown on the table, not the form for a new one.
const inProgress = initialReadings.find((r) => r.status === "pending" || r.status === "running") ?? null;
const [phase, setPhase] = useState<Phase>(inProgress ? "done" : "setup");
const [picked, setPicked] = useState<number[]>([]);
const [current, setCurrent] = useState<TarotReading | null>(null);
const [revealed, setRevealed] = useState(0);
const [current, setCurrent] = useState<TarotReading | null>(inProgress);
const [revealed, setRevealed] = useState(inProgress?.cards.length ?? 0);
const [error, setError] = useState<string | null>(null);
const [buying, setBuying] = useState(false);
@@ -243,7 +245,9 @@ export function TarotTable({
? "A lapok…"
: "A kirakásod"}
</h2>
{question.trim() && <p className="tarot-question">„{question.trim()}”</p>}
{(current ? current.question : question.trim()) && (
<p className="tarot-question">„{current ? current.question : question.trim()}”</p>
)}
<p className="hint" role="status">
{phase === "picking" &&
`Hangolódj a kérdésedre, és válassz ösztönösen. ${picked.length}/${chosen.cards}`}
@@ -265,9 +269,11 @@ export function TarotTable({
<>
<TarotLive key={current.id} initial={current} isAdmin={isAdmin} onChange={finished} />
<div className="form-actions">
<button type="button" className="btn" onClick={again}>
Új jóslás
</button>
{!writing && (
<button type="button" className="btn" onClick={again}>
Új jóslás
</button>
)}
<Link href={`/kartyajoslas/${current.id}`} className="btn btn-ghost">
Külön oldalon
</Link>