Tarot example: the draw played as an animation, and a love reading
The example page now plays each reading: cards are picked from the fanned deck, laid out and turned over, then the written reading appears below. A second example, a five-card love reading, sits next to the work one in a tab. The fan and the spread are shared with the real draw (TarotSpread). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -8,11 +8,10 @@ import { SPREADS, TAROT_QUESTION_MAX, tarotCard, type SpreadId, type TarotReadin
|
||||
import type { PayMethod, UnitBalance } from "@/lib/types";
|
||||
|
||||
import { PackageChooser } from "../PackageCards";
|
||||
import { TarotCard, TarotCardBack } from "./TarotCard";
|
||||
import { TarotCard } from "./TarotCard";
|
||||
import { TarotLive } from "./TarotLive";
|
||||
import { TarotFan, TarotSlots } from "./TarotSpread";
|
||||
|
||||
/** Face-down cards in the fan to pick from. */
|
||||
const FAN = 21;
|
||||
/** Pause between two cards turning over. */
|
||||
const REVEAL_MS = 650;
|
||||
|
||||
@@ -224,52 +223,9 @@ export function TarotTable({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ol className="tarot-slots" data-count={slots}>
|
||||
{Array.from({ length: slots }).map((_, i) => {
|
||||
const drawn = current?.cards[i];
|
||||
const card = drawn ? tarotCard(drawn.card) : undefined;
|
||||
const flipped = !!card && i < revealed;
|
||||
return (
|
||||
<li key={i} className="tarot-slot">
|
||||
<div className={flipped ? "tarot-flip is-flipped" : "tarot-flip"}>
|
||||
{i < picked.length || drawn ? (
|
||||
<div className="tarot-flip-inner">
|
||||
<TarotCardBack className="tarot-face tarot-back" />
|
||||
{card && <TarotCard card={card} reversed={drawn?.reversed} className="tarot-face tarot-front" />}
|
||||
</div>
|
||||
) : (
|
||||
<div className="tarot-slot-empty" aria-hidden="true" />
|
||||
)}
|
||||
</div>
|
||||
<span className="tarot-slot-title">{drawn?.position ?? `${i + 1}. lap`}</span>
|
||||
{flipped && card && (
|
||||
<span className="hint">
|
||||
{card.nameHu}
|
||||
{drawn?.reversed ? " · fordított" : ""}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
<TarotSlots count={slots} filled={current ? slots : picked.length} cards={current?.cards} revealed={revealed} />
|
||||
|
||||
{phase === "picking" && (
|
||||
<div className="tarot-fan" role="group" aria-label="A megkevert pakli">
|
||||
{Array.from({ length: FAN }).map((_, i) => (
|
||||
<button
|
||||
key={i}
|
||||
type="button"
|
||||
className={picked.includes(i) ? "tarot-fan-card is-picked" : "tarot-fan-card"}
|
||||
style={{ "--i": i - (FAN - 1) / 2 } as React.CSSProperties}
|
||||
onClick={() => pick(i)}
|
||||
disabled={picked.includes(i)}
|
||||
aria-label={`${i + 1}. lap kiválasztása`}
|
||||
>
|
||||
<TarotCardBack />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{phase === "picking" && <TarotFan picked={picked} onPick={pick} />}
|
||||
{phase === "picking" && (
|
||||
<div className="form-actions">
|
||||
<button type="button" className="btn btn-ghost" onClick={again}>
|
||||
|
||||
Reference in New Issue
Block a user