Files
sorsfonalak/services/frontend/src/lib/tarot.ts
T
fecoandClaude Opus 5.5 7f6f05150e
CI / test (push) Successful in 1m27s
CI / build (push) Successful in 5m37s
CI / deploy (push) Skipped
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
2026-11-20 16:25:12 +00:00

84 lines
2.8 KiB
TypeScript

/** The tarot deck and spreads (the backend draws from the same deck file). */
import deckData from "@/content/tarot-deck.json";
export type TarotSuit = "major" | "wands" | "cups" | "swords" | "pentacles";
export type TarotElement = "Tűz" | "Víz" | "Levegő" | "Föld" | "Éter";
export type MinorRank = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "page" | "knight" | "queen" | "king";
export interface TarotCardData {
id: string;
number: number;
roman?: string;
rank?: MinorRank;
nameHu: string;
nameEn: string;
suit: TarotSuit;
suitLabelHu: string;
element: TarotElement;
astroRuler: string;
astroGlyph: string;
keywords: string[];
upright: string;
reversed: string;
}
export const DECK = deckData as TarotCardData[];
export function tarotCard(id: string): TarotCardData | undefined {
return DECK.find((c) => c.id === id);
}
export type SpreadId = "daily" | "trinity" | "astro_cross";
/** The spreads to choose from (the positions come with the reading). */
export const SPREADS: { id: SpreadId; name: string; cards: number; about: string }[] = [
{ id: "daily", name: "Napi iránymutatás", cards: 1, about: "Egy lap: mire hangolódj ma." },
{ id: "trinity", name: "Sorsfonalak hármas", cards: 3, about: "Három lap: előzmény, jelen, kibontakozás." },
{
id: "astro_cross",
name: "Képlet-kereszt",
cards: 5,
about: "Öt lap: központi téma, belső és tudatos erők, kihívás, útmutatás.",
},
];
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;
export interface TarotContent {
title: string;
summary: string;
cards: { body: string }[];
synthesis: string;
advice: string;
}
/** A reading (`/v1/tarot/readings`). */
export interface TarotReading {
id: string;
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;
error: string | null;
credits_charged: number;
attempts: number;
created_at: string;
completed_at: string | null;
}