Tarot: a reading being written stays on the table
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:
@@ -50,10 +50,12 @@ export function TarotTable({
|
|||||||
const [spread, setSpread] = useState<SpreadId>("trinity");
|
const [spread, setSpread] = useState<SpreadId>("trinity");
|
||||||
const [topic, setTopic] = useState<TopicId>("general");
|
const [topic, setTopic] = useState<TopicId>("general");
|
||||||
const [question, setQuestion] = useState("");
|
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 [picked, setPicked] = useState<number[]>([]);
|
||||||
const [current, setCurrent] = useState<TarotReading | null>(null);
|
const [current, setCurrent] = useState<TarotReading | null>(inProgress);
|
||||||
const [revealed, setRevealed] = useState(0);
|
const [revealed, setRevealed] = useState(inProgress?.cards.length ?? 0);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [buying, setBuying] = useState(false);
|
const [buying, setBuying] = useState(false);
|
||||||
|
|
||||||
@@ -243,7 +245,9 @@ export function TarotTable({
|
|||||||
? "A lapok…"
|
? "A lapok…"
|
||||||
: "A kirakásod"}
|
: "A kirakásod"}
|
||||||
</h2>
|
</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">
|
<p className="hint" role="status">
|
||||||
{phase === "picking" &&
|
{phase === "picking" &&
|
||||||
`Hangolódj a kérdésedre, és válassz ösztönösen. ${picked.length}/${chosen.cards}`}
|
`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} />
|
<TarotLive key={current.id} initial={current} isAdmin={isAdmin} onChange={finished} />
|
||||||
<div className="form-actions">
|
<div className="form-actions">
|
||||||
|
{!writing && (
|
||||||
<button type="button" className="btn" onClick={again}>
|
<button type="button" className="btn" onClick={again}>
|
||||||
Új jóslás
|
Új jóslás
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
<Link href={`/kartyajoslas/${current.id}`} className="btn btn-ghost">
|
<Link href={`/kartyajoslas/${current.id}`} className="btn btn-ghost">
|
||||||
Külön oldalon
|
Külön oldalon
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
Reference in New Issue
Block a user