Compare commits

...
Author SHA1 Message Date
feco f69f76a05a Merge main into prod: tarot on the home page, footer and description
CI / build (push) Successful in 23s
CI / deploy (push) Successful in 1m0s
CI / test (push) Successful in 1m31s
2026-11-20 17:11:18 +00:00
fecoandClaude Opus 5.5 5071589bf9 Home page: example reading in the footer, tarot in the description
CI / build (push) Successful in 8m27s
CI / deploy (push) Skipped
CI / test (push) Successful in 1m28s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 17:11:17 +00:00
fecoandClaude Opus 5.5 cd2eb02d3d Home page footer: no English Privacy Policy link
CI / deploy (push) Skipped
CI / test (push) Successful in 1m28s
CI / build (push) Successful in 6m3s
The Hungarian privacy page links its English version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 17:09:53 +00:00
fecoandClaude Opus 5.5 43e22e6768 Home page: a quiet tarot line under the forecast and comparison cards
CI / test (push) Successful in 1m31s
CI / build (push) Successful in 5m20s
CI / deploy (push) Skipped
Three small fanned cards (a back, the High Priestess, the Star), one
sentence and a link to the example reading; the side feature stays
smaller than the cards above it. On phones the cards sit above the
text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 17:07:43 +00:00
feco 1a75dec59a Merge main into prod: tarot topics, Párkapcsolat example tab
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 40s
2026-11-20 16:25:13 +00:00
fecoandClaude Opus 5.5 7f6f05150e Tarot readings have a topic: general, relationship, work, self-knowledge
CI / test (push) Successful in 1m27s
CI / build (push) Successful in 5m37s
CI / deploy (push) Skipped
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
fecoandClaude Opus 5.5 b0e1270246 Tarot example: the love reading's tab is Párkapcsolat
CI / test (push) Successful in 1m28s
CI / build (push) Successful in 6m15s
CI / deploy (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 16:06:42 +00:00
12 changed files with 203 additions and 17 deletions
+82 -2
View File
@@ -117,6 +117,67 @@ pub fn spread(id: &str) -> Option<&'static Spread> {
SPREADS.iter().find(|s| s.id == id) SPREADS.iter().find(|s| s.id == id)
} }
/// What the reading is about: it steers how the cards are read.
#[derive(Debug, Clone, Copy)]
pub struct Topic {
pub id: &'static str,
pub name: &'static str,
/// The instruction for the model (Hungarian, English).
pub focus: (&'static str, &'static str),
}
pub const TOPICS: [Topic; 4] = [
Topic {
id: "general",
name: "Általános",
focus: (
"Általános jóslás: az olvasó élete egészére vonatkoztasd a lapokat.",
"A general reading: relate the cards to the reader's life as a whole.",
),
},
Topic {
id: "love",
name: "Párkapcsolat",
focus: (
"Párkapcsolati jóslás: minden lapot a szerelem, a vonzalom, a közelség, a bizalom és a kommunikáció \
szemszögéből olvass, akár van kapcsolata az olvasónak, akár keres. Ne feltételezd a partner nemét, és ne \
jósolj szakítást, hűtlenséget vagy azt, hogy valaki biztosan visszatér.",
"A relationship reading: read every card through love, attraction, closeness, trust and communication, \
whether the reader is in a relationship or looking for one. Do not assume the partner's gender, and do \
not predict a break-up, infidelity or that someone will surely come back.",
),
},
Topic {
id: "work",
name: "Munka és hivatás",
focus: (
"Munka és hivatás: a lapokat a munka, a hivatás, a tanulás, a munkahelyi kapcsolatok és a fejlődés \
szemszögéből olvasd. Ne adj pénzügyi vagy jogi tanácsot, és ne jósolj elbocsátást vagy anyagi \
nyereséget, veszteséget.",
"Work and calling: read the cards through work, vocation, learning, relationships at work and growth. \
Give no financial or legal advice, and do not predict dismissal or financial gains or losses.",
),
},
Topic {
id: "self",
name: "Önismeret",
focus: (
"Önismeret: a lapokat a belső világ, az érzelmek, a minták és a lelki fejlődés szemszögéből olvasd; a \
külső események helyett arra figyelj, mit tanulhat az olvasó önmagáról.",
"Self-knowledge: read the cards through the inner world, feelings, patterns and inner growth; rather \
than outer events, focus on what the reader can learn about themselves.",
),
},
];
/// A topic by id (`None`, and readings from before topics: general).
pub fn topic(id: Option<&str>) -> Option<&'static Topic> {
match id {
None => TOPICS.first(),
Some(id) => TOPICS.iter().find(|t| t.id == id),
}
}
/// The Hungarian name of a zodiac sign as the charts store it ("cancer"). /// The Hungarian name of a zodiac sign as the charts store it ("cancer").
pub fn sign_hu(sign: &str) -> &'static str { pub fn sign_hu(sign: &str) -> &'static str {
match sign.to_ascii_lowercase().as_str() { match sign.to_ascii_lowercase().as_str() {
@@ -142,6 +203,7 @@ pub fn sign_hu(sign: &str) -> &'static str {
/// The cards are in the order of the spread's positions. /// The cards are in the order of the spread's positions.
pub struct Reading<'a> { pub struct Reading<'a> {
pub spread: &'static Spread, pub spread: &'static Spread,
pub topic: &'static Topic,
pub question: Option<&'a str>, pub question: Option<&'a str>,
/// (card, reversed) per position. /// (card, reversed) per position.
pub cards: Vec<(&'static Card, bool)>, pub cards: Vec<(&'static Card, bool)>,
@@ -171,6 +233,7 @@ impl<'a> Reading<'a> {
let text = |k: &str| value[k].as_str().map(str::trim).filter(|s| !s.is_empty()); let text = |k: &str| value[k].as_str().map(str::trim).filter(|s| !s.is_empty());
Ok(Self { Ok(Self {
spread, spread,
topic: topic(text("topic")).ok_or("unknown topic")?,
question: text("question"), question: text("question"),
cards, cards,
sun: text("sun"), sun: text("sun"),
@@ -284,12 +347,18 @@ pub fn build_tarot(language: &str, reading: &Reading) -> Prompt {
let hu = language == "hu"; let hu = language == "hu";
let mut user = String::new(); let mut user = String::new();
let none = if hu { "nincs megadva" } else { "not given" }; let none = if hu { "nincs megadva" } else { "not given" };
user.push_str(&format!(
"{}: {}. {}\n\n",
if hu { "Téma" } else { "Topic" },
reading.topic.name,
if hu { reading.topic.focus.0 } else { reading.topic.focus.1 },
));
match reading.question { match reading.question {
Some(q) => user.push_str(&format!("{}: {}\n\n", if hu { "A kérdés" } else { "The question" }, q.trim())), Some(q) => user.push_str(&format!("{}: {}\n\n", if hu { "A kérdés" } else { "The question" }, q.trim())),
None => user.push_str(if hu { None => user.push_str(if hu {
"Nincs konkrét kérdés: az olvasó a jelenlegi életszakaszára kér útmutatást.\n\n" "Nincs konkrét kérdés: az olvasó a témában a jelenlegi életszakaszára kér útmutatást.\n\n"
} else { } else {
"No specific question: the reader asks for guidance about their present phase of life.\n\n" "No specific question: the reader asks for guidance on the topic in their present phase of life.\n\n"
}), }),
} }
let sign = |s: Option<&str>| { let sign = |s: Option<&str>| {
@@ -369,6 +438,8 @@ mod tests {
"sun": "cancer", "moon": "pisces", "ascendant": null}); "sun": "cancer", "moon": "pisces", "ascendant": null});
let reading = Reading::parse(&value).unwrap(); let reading = Reading::parse(&value).unwrap();
let prompt = build_tarot("hu", &reading); let prompt = build_tarot("hu", &reading);
// Readings without a topic (the first ones) are general.
assert!(prompt.user.starts_with("Téma: Általános."));
assert!(prompt.user.contains("A kérdés: Merre induljak tovább?")); assert!(prompt.user.contains("A kérdés: Merre induljak tovább?"));
assert!(prompt.user.contains("Nap: Rák, Hold: Halak, Aszcendens: nincs megadva")); assert!(prompt.user.contains("Nap: Rák, Hold: Halak, Aszcendens: nincs megadva"));
assert!(prompt.user.contains("2. Jelenlegi fókusz")); assert!(prompt.user.contains("2. Jelenlegi fókusz"));
@@ -380,6 +451,15 @@ mod tests {
let english = build_tarot("en", &reading); let english = build_tarot("en", &reading);
assert!(english.user.contains("Sun: Cancer") && english.system.contains("English")); assert!(english.user.contains("Sun: Cancer") && english.system.contains("English"));
let mut love = value.clone();
love["topic"] = json!("love");
let prompt = build_tarot("hu", &Reading::parse(&love).unwrap());
assert!(
prompt.user.starts_with("Téma: Párkapcsolat.") && prompt.user.contains("Ne feltételezd a partner nemét")
);
love["topic"] = json!("pénz");
assert!(Reading::parse(&love).is_err());
let wrong = json!({"spread": "daily", "cards": [{"card": "major-0"}, {"card": "major-1"}]}); let wrong = json!({"spread": "daily", "cards": [{"card": "major-0"}, {"card": "major-1"}]});
assert!(Reading::parse(&wrong).is_err()); assert!(Reading::parse(&wrong).is_err());
assert!(Reading::parse(&json!({"spread": "daily", "cards": [{"card": "nincs"}]})).is_err()); assert!(Reading::parse(&json!({"spread": "daily", "cards": [{"card": "nincs"}]})).is_err());
+1 -1
View File
@@ -1,6 +1,6 @@
# Kártyajóslás # Kártyajóslás
A `/kartyajoslas` oldalon a felhasználó kirakást választ, opcionálisan kérdést ír (legfeljebb 300 karakter), és a legyezőbe terített, lefordított pakliból kiválasztja a lapokat. Ezután a lapok sorban felfordulnak, és elkészül a személyre szabott jóslás. A korábbi jóslások ugyanitt listázódnak, egyenként a `/kartyajoslas/{id}` oldalon nyithatók meg. A nyilvános példaoldal (`/kartyajoslas/pelda`) két előre megírt jóslást mutat fülekkel, egy munkáról (3 lap) és egy szerelemről (Képlet-kereszt, 5 lap). Mindkettőnél animáció játssza le a húzást: lapválasztás a legyezőből, kirakás, felfordítás, végül megjelenik a szöveg (`src/components/tarot/TarotDemo.tsx`, a szövegek: `src/content/tarot-pelda.json`). Mozgáscsökkentő beállításnál rögtön a végállapot látszik. A `/kartyajoslas` oldalon a felhasználó témát (Általános, Párkapcsolat, Munka és hivatás, Önismeret; a téma szerinti olvasási szempont a promptba kerül, `TOPICS`) és kirakást választ, opcionálisan kérdést ír (legfeljebb 300 karakter), és a legyezőbe terített, lefordított pakliból kiválasztja a lapokat. Ezután a lapok sorban felfordulnak, és elkészül a személyre szabott jóslás. A korábbi jóslások ugyanitt listázódnak, egyenként a `/kartyajoslas/{id}` oldalon nyithatók meg. A nyilvános példaoldal (`/kartyajoslas/pelda`) két előre megírt jóslást mutat fülekkel, egy munkáról (3 lap) és egy párkapcsolatról (Képlet-kereszt, 5 lap). Mindkettőnél animáció játssza le a húzást: lapválasztás a legyezőből, kirakás, felfordítás, végül megjelenik a szöveg (`src/components/tarot/TarotDemo.tsx`, a szövegek: `src/content/tarot-pelda.json`). Mozgáscsökkentő beállításnál rögtön a végállapot látszik.
## Működés ## Működés
+6
View File
@@ -69,6 +69,8 @@ impl ReadingRow {
"status": self.status, "status": self.status,
"spread": self.tarot["spread"], "spread": self.tarot["spread"],
"spread_name": spread.map(|s| s.name), "spread_name": spread.map(|s| s.name),
"topic": tarot::topic(self.tarot["topic"].as_str()).map(|t| t.id),
"topic_name": tarot::topic(self.tarot["topic"].as_str()).map(|t| t.name),
"question": self.tarot["question"], "question": self.tarot["question"],
"cards": cards, "cards": cards,
"content": self.content, "content": self.content,
@@ -147,6 +149,8 @@ pub async fn get_one(State(state): St, auth: AuthUser, WithRejection(Path(id), _
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct NewReading { pub struct NewReading {
spread: String, spread: String,
/// `general` (the default), `love`, `work` or `self`.
topic: Option<String>,
question: Option<String>, question: Option<String>,
} }
@@ -157,6 +161,7 @@ pub async fn create(
WithRejection(Json(req), _): Body<NewReading>, WithRejection(Json(req), _): Body<NewReading>,
) -> ApiResult<(StatusCode, Json<Value>)> { ) -> ApiResult<(StatusCode, Json<Value>)> {
let spread = tarot::spread(&req.spread).ok_or_else(|| ApiError::BadRequest("unknown spread".into()))?; let spread = tarot::spread(&req.spread).ok_or_else(|| ApiError::BadRequest("unknown spread".into()))?;
let topic = tarot::topic(req.topic.as_deref()).ok_or_else(|| ApiError::BadRequest("unknown topic".into()))?;
let question = req.question.map(|q| q.trim().replace("\r\n", "\n")).filter(|q| !q.is_empty()); let question = req.question.map(|q| q.trim().replace("\r\n", "\n")).filter(|q| !q.is_empty());
if question.as_ref().is_some_and(|q| q.chars().count() > TAROT_QUESTION_MAX_CHARS) { if question.as_ref().is_some_and(|q| q.chars().count() > TAROT_QUESTION_MAX_CHARS) {
return Err(ApiError::BadRequest(format!( return Err(ApiError::BadRequest(format!(
@@ -179,6 +184,7 @@ pub async fn create(
let (sun, moon, ascendant) = big_three(&state, auth.id()).await?; let (sun, moon, ascendant) = big_three(&state, auth.id()).await?;
let reading = json!({ let reading = json!({
"spread": spread.id, "spread": spread.id,
"topic": topic.id,
"question": question, "question": question,
"cards": draw(spread), "cards": draw(spread),
"sun": sun, "sun": sun,
+4 -1
View File
@@ -2593,7 +2593,7 @@ async fn tarot_readings_draw_on_the_server_and_use_tarot_units(pool: PgPool) {
let app = TestApp::new(pool.clone()).await; let app = TestApp::new(pool.clone()).await;
let anna = app.register("anna@example.com", "Anna").await; let anna = app.register("anna@example.com", "Anna").await;
app.chart(&anna, "Saját", true, "1990-07-01").await; app.chart(&anna, "Saját", true, "1990-07-01").await;
let body = json!({"spread": "trinity", "question": "Merre induljak tovább?"}); let body = json!({"spread": "trinity", "topic": "love", "question": "Merre induljak tovább?"});
// No units: a package or the addon is needed. // No units: a package or the addon is needed.
let r = app.post("/v1/tarot/readings", Some(&anna), body.clone()).await; let r = app.post("/v1/tarot/readings", Some(&anna), body.clone()).await;
assert_eq!(r.status, StatusCode::PAYMENT_REQUIRED, "{}", r.body); assert_eq!(r.status, StatusCode::PAYMENT_REQUIRED, "{}", r.body);
@@ -2610,6 +2610,8 @@ async fn tarot_readings_draw_on_the_server_and_use_tarot_units(pool: PgPool) {
let r = app.post("/v1/tarot/readings", Some(&anna), json!({"spread": "nincs"})).await; let r = app.post("/v1/tarot/readings", Some(&anna), json!({"spread": "nincs"})).await;
assert_eq!(r.status, StatusCode::BAD_REQUEST); assert_eq!(r.status, StatusCode::BAD_REQUEST);
let r = app.post("/v1/tarot/readings", Some(&anna), json!({"spread": "daily", "topic": "pénz"})).await;
assert_eq!(r.status, StatusCode::BAD_REQUEST);
let long = "x".repeat(analysis_prompt::TAROT_QUESTION_MAX_CHARS + 1); let long = "x".repeat(analysis_prompt::TAROT_QUESTION_MAX_CHARS + 1);
let r = app.post("/v1/tarot/readings", Some(&anna), json!({"spread": "daily", "question": long})).await; let r = app.post("/v1/tarot/readings", Some(&anna), json!({"spread": "daily", "question": long})).await;
assert_eq!(r.status, StatusCode::BAD_REQUEST); assert_eq!(r.status, StatusCode::BAD_REQUEST);
@@ -2618,6 +2620,7 @@ async fn tarot_readings_draw_on_the_server_and_use_tarot_units(pool: PgPool) {
assert_eq!(r.status, StatusCode::ACCEPTED, "{}", r.body); assert_eq!(r.status, StatusCode::ACCEPTED, "{}", r.body);
assert_eq!(r.body["status"], "pending"); assert_eq!(r.body["status"], "pending");
assert_eq!(r.body["spread_name"], "Sorsfonalak hármas"); assert_eq!(r.body["spread_name"], "Sorsfonalak hármas");
assert_eq!((&r.body["topic"], &r.body["topic_name"]), (&json!("love"), &json!("Párkapcsolat")));
assert_eq!(r.body["question"], "Merre induljak tovább?"); assert_eq!(r.body["question"], "Merre induljak tovább?");
let cards = r.body["cards"].as_array().unwrap(); let cards = r.body["cards"].as_array().unwrap();
assert_eq!(cards.len(), 3); assert_eq!(cards.len(), 3);
+28 -3
View File
@@ -2,11 +2,16 @@ import Link from "next/link";
import { ChartWheel } from "@/components/ChartWheel"; import { ChartWheel } from "@/components/ChartWheel";
import { Rich } from "@/components/Rich"; import { Rich } from "@/components/Rich";
import { TarotCard, TarotCardBack } from "@/components/tarot/TarotCard";
import { Logo, PublicHeader } from "@/components/SiteHeader"; import { Logo, PublicHeader } from "@/components/SiteHeader";
import { Waitlist } from "@/components/Waitlist"; import { Waitlist } from "@/components/Waitlist";
import example from "@/content/pelda.json"; import example from "@/content/pelda.json";
import { tarotCard } from "@/lib/tarot";
import type { AnalysisContent, ChartResult } from "@/lib/types"; import type { AnalysisContent, ChartResult } from "@/lib/types";
/** The cards fanned out next to the tarot line (after a card back). */
const TAROT_CARDS = ["major-2", "major-17"].map((id) => tarotCard(id)).filter((c) => c !== undefined);
// A quiet starfield, the same on every render. // A quiet starfield, the same on every render.
const STARS = (() => { const STARS = (() => {
let seed = 7; let seed = 7;
@@ -378,6 +383,28 @@ export function Landing({ inviteOnly }: { inviteOnly: boolean }) {
</div> </div>
</article> </article>
</div> </div>
<article className="card lp-tarot" aria-labelledby="tarot-title">
<div className="lp-tarot-cards" aria-hidden="true">
<TarotCardBack />
{TAROT_CARDS.map((card) => (
<TarotCard key={card.id} card={card} />
))}
</div>
<div className="lp-tarot-text">
<span className="eyebrow">Kártyajóslás is</span>
<h3 id="tarot-title" className="lp-tarot-title">
Egy kérdés, néhány lap
</h3>
<p className="lp-small">
Húzz lapot egy konkrét kérdésre: a kirakásodra és a képleted Napjára, Holdjára, Aszcendensére személyre
szabott értelmezés készül. Néhány jóslás minden csomagban benne van.
</p>
</div>
<Link href="/kartyajoslas/pelda" className="lp-tarot-link">
Példajóslás →
</Link>
</article>
</div> </div>
</section> </section>
@@ -454,11 +481,9 @@ export function Landing({ inviteOnly }: { inviteOnly: boolean }) {
<Logo /> <Logo />
<nav aria-label="Lábléc" className="lp-footer-nav"> <nav aria-label="Lábléc" className="lp-footer-nav">
<Link href="/pelda">Példaelemzés</Link> <Link href="/pelda">Példaelemzés</Link>
<Link href="/kartyajoslas/pelda">Példajóslás</Link>
<Link href="/aszf">ÁSZF</Link> <Link href="/aszf">ÁSZF</Link>
<Link href="/adatvedelem">Adatvédelem</Link> <Link href="/adatvedelem">Adatvédelem</Link>
<Link href="/privacy" lang="en">
Privacy Policy
</Link>
<Link href="/belepes">Belépés</Link> <Link href="/belepes">Belépés</Link>
</nav> </nav>
<span className="hint">© {new Date().getFullYear()} Sorsfonalak</span> <span className="hint">© {new Date().getFullYear()} Sorsfonalak</span>
+31
View File
@@ -938,6 +938,28 @@ a.pair-row:hover strong { color: var(--gold); }
.lp-why-card { gap: 12px; padding: 28px; } .lp-why-card { gap: 12px; padding: 28px; }
.lp-why-icon { width: 36px; height: 36px; fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; } .lp-why-icon { width: 36px; height: 36px; fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
/* Home page: tarot, a quiet line under the yearly forecast and the comparison */
.lp-tarot { flex-direction: row; align-items: center; gap: 32px; padding: 22px 32px; margin-top: -16px; }
.lp-tarot-cards { position: relative; width: 132px; height: 112px; flex: none; }
.lp-tarot-cards .tarot-card { position: absolute; top: 12px; width: 56px; border-radius: 5px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }
.lp-tarot-cards .tarot-card:nth-child(1) { left: 4px; transform: rotate(-11deg); }
.lp-tarot-cards .tarot-card:nth-child(2) { left: 38px; top: 4px; }
.lp-tarot-cards .tarot-card:nth-child(3) { left: 72px; transform: rotate(11deg); }
.lp-tarot-text { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.lp-tarot-text .lp-small { max-width: 640px; }
.lp-tarot-title { font-size: 24px; line-height: 1.15; }
.lp-tarot-link { flex: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
@media (max-width: 720px) {
.lp-tarot { flex-wrap: wrap; gap: 14px 16px; padding: 22px; }
.lp-tarot-cards { width: 104px; height: 88px; }
.lp-tarot-cards .tarot-card { width: 44px; top: 10px; }
.lp-tarot-cards .tarot-card:nth-child(1) { left: 2px; }
.lp-tarot-cards .tarot-card:nth-child(2) { left: 30px; top: 3px; }
.lp-tarot-cards .tarot-card:nth-child(3) { left: 58px; }
.lp-tarot-text { flex: 1 1 100%; }
.lp-tarot-link { flex-basis: 100%; min-height: 44px; display: inline-flex; align-items: center; }
}
/* Home page footer: payment and invoicing partners */ /* Home page footer: payment and invoicing partners */
.lp-partners { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); } .lp-partners { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.lp-partner { height: 26px; width: auto; opacity: 0.65; transition: opacity 0.2s; } .lp-partner { height: 26px; width: auto; opacity: 0.65; transition: opacity 0.2s; }
@@ -981,6 +1003,15 @@ a.pair-row:hover strong { color: var(--gold); }
.tarot-spread:hover { border-color: #5a6790; } .tarot-spread:hover { border-color: #5a6790; }
.tarot-spread.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; } .tarot-spread.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tarot-spread:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; } .tarot-spread:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.tarot-topics { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tarot-topics legend { margin-bottom: 8px; }
.tarot-topic {
display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; cursor: pointer; font-size: 14px;
border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); color: var(--ink-2);
}
.tarot-topic:hover { border-color: #5a6790; }
.tarot-topic.is-active { border-color: var(--gold); color: var(--gold); background: rgba(217, 180, 106, 0.08); }
.tarot-topic:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.tarot-spread-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; } .tarot-spread-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.tarot-stage { align-items: stretch; } .tarot-stage { align-items: stretch; }
@@ -24,6 +24,7 @@ export default async function TarotReadingPage({ params }: { params: Promise<{ i
← Kártyajóslás ← Kártyajóslás
</Link> </Link>
<span className="eyebrow"> <span className="eyebrow">
{reading.topic_name ? `${reading.topic_name} · ` : ""}
{reading.spread_name} · {day(reading.created_at)} {reading.spread_name} · {day(reading.created_at)}
</span> </span>
</div> </div>
@@ -9,7 +9,7 @@ import { getMe } from "@/lib/server";
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Példajóslás", title: "Példajóslás",
description: description:
"Így néz ki egy Sorsfonalak-kártyajóslás: lapválasztás a pakliból, kirakás és személyre szabott értelmezés, munkáról és szerelemről.", "Így néz ki egy Sorsfonalak-kártyajóslás: lapválasztás a pakliból, kirakás és személyre szabott értelmezés, munkáról és párkapcsolatról.",
}; };
/** A full example tarot reading for a made-up question, for visitors and users without readings. */ /** A full example tarot reading for a made-up question, for visitors and users without readings. */
+1 -1
View File
@@ -24,7 +24,7 @@ export async function generateMetadata(): Promise<Metadata> {
return { return {
title: { absolute: "Sorsfonalak – születési képlet, éves előrejelzés, kapcsolati összevetés" }, title: { absolute: "Sorsfonalak – születési képlet, éves előrejelzés, kapcsolati összevetés" },
description: description:
"Percre pontos születési képlet és személyre szóló elemzés a legfejlettebb AI-modellekkel: egy tapasztalt asztrológushoz közelítő mélység, töredék áron. Éves előrejelzés és kapcsolati összevetés.", "Percre pontos születési képlet és személyre szóló elemzés a legfejlettebb AI-modellekkel: egy tapasztalt asztrológushoz közelítő mélység, töredék áron. Éves előrejelzés, kapcsolati összevetés és kártyajóslás.",
alternates: { canonical: `${base}/` }, alternates: { canonical: `${base}/` },
openGraph: { type: "website", siteName: "Sorsfonalak", locale: "hu_HU", url: `${base}/`, title, description, images: [image] }, openGraph: { type: "website", siteName: "Sorsfonalak", locale: "hu_HU", url: `${base}/`, title, description, images: [image] },
twitter: { card: "summary_large_image", title, description, images: [image.url] }, twitter: { card: "summary_large_image", title, description, images: [image.url] },
@@ -4,7 +4,15 @@ import Link from "next/link";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { api, ApiError, errorText } from "@/lib/api"; 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 type { PayMethod, UnitBalance } from "@/lib/types";
import { PackageChooser } from "../PackageCards"; import { PackageChooser } from "../PackageCards";
@@ -40,6 +48,7 @@ export function TarotTable({
const [readings, setReadings] = useState(initialReadings); const [readings, setReadings] = useState(initialReadings);
const [left, setLeft] = useState(initialLeft); const [left, setLeft] = useState(initialLeft);
const [spread, setSpread] = useState<SpreadId>("trinity"); const [spread, setSpread] = useState<SpreadId>("trinity");
const [topic, setTopic] = useState<TopicId>("general");
const [question, setQuestion] = useState(""); const [question, setQuestion] = useState("");
const [phase, setPhase] = useState<Phase>("setup"); const [phase, setPhase] = useState<Phase>("setup");
const [picked, setPicked] = useState<number[]>([]); const [picked, setPicked] = useState<number[]>([]);
@@ -68,7 +77,7 @@ export function TarotTable({
setError(null); setError(null);
try { try {
const reading = await api<TarotReading>("/tarot/readings", { const reading = await api<TarotReading>("/tarot/readings", {
body: { spread, question: question.trim() || null }, body: { spread, topic, question: question.trim() || null },
}); });
setCurrent(reading); setCurrent(reading);
setReadings((all) => [reading, ...all]); setReadings((all) => [reading, ...all]);
@@ -86,7 +95,7 @@ export function TarotTable({
} }
} }
}, },
[spread, question], [spread, topic, question],
); );
function pick(i: number) { function pick(i: number) {
@@ -151,6 +160,22 @@ export function TarotTable({
</div> </div>
) : ( ) : (
<form className="field" style={{ gap: 18 }} onSubmit={start}> <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"> <fieldset className="tarot-spreads">
<legend className="label">Kirakás</legend> <legend className="label">Kirakás</legend>
{SPREADS.map((s) => ( {SPREADS.map((s) => (
@@ -176,7 +201,7 @@ export function TarotTable({
rows={2} rows={2}
maxLength={TAROT_QUESTION_MAX} maxLength={TAROT_QUESTION_MAX}
value={question} 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)} onChange={(e) => setQuestion(e.target.value)}
/> />
<span className="hint"> <span className="hint">
@@ -208,7 +233,9 @@ export function TarotTable({
{phase !== "setup" && ( {phase !== "setup" && (
<section className="card tarot-stage" aria-labelledby="tarot-stage-title"> <section className="card tarot-stage" aria-labelledby="tarot-stage-title">
<div className="tarot-stage-head"> <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"> <h2 id="tarot-stage-title">
{phase === "picking" {phase === "picking"
? `Válassz ${chosen.cards} lapot a pakliból` ? `Válassz ${chosen.cards} lapot a pakliból`
@@ -266,7 +293,8 @@ export function TarotTable({
<span className="tarot-history-text"> <span className="tarot-history-text">
<strong>{r.content?.title ?? r.question ?? r.spread_name}</strong> <strong>{r.content?.title ?? r.question ?? r.spread_name}</strong>
<span className="hint"> <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.question && r.content ? ` · „${r.question}”` : ""}
{r.status === "pending" || r.status === "running" ? " · készül" : ""} {r.status === "pending" || r.status === "running" ? " · készül" : ""}
{r.status === "failed" ? " · nem sikerült" : ""} {r.status === "failed" ? " · nem sikerült" : ""}
@@ -45,8 +45,8 @@
} }
}, },
{ {
"id": "szerelem", "id": "parkapcsolat",
"label": "Szerelem", "label": "Párkapcsolat",
"signs": "Mérleg Nap, Bika Hold, Oroszlán Aszcendens", "signs": "Mérleg Nap, Bika Hold, Oroszlán Aszcendens",
"spread_name": "Képlet-kereszt", "spread_name": "Képlet-kereszt",
"question": "Merre tart a kapcsolatunk, és mit tehetek azért, hogy közelebb kerüljünk egymáshoz?", "question": "Merre tart a kapcsolatunk, és mit tehetek azért, hogy közelebb kerüljünk egymáshoz?",
+12
View File
@@ -43,6 +43,16 @@ export const SPREADS: { id: SpreadId; name: string; cards: number; about: string
}, },
]; ];
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`). */ /** Longest question (the backend's `TAROT_QUESTION_MAX_CHARS`). */
export const TAROT_QUESTION_MAX = 300; export const TAROT_QUESTION_MAX = 300;
@@ -60,6 +70,8 @@ export interface TarotReading {
status: "pending" | "running" | "done" | "failed"; status: "pending" | "running" | "done" | "failed";
spread: SpreadId; spread: SpreadId;
spread_name: string | null; spread_name: string | null;
topic: TopicId | null;
topic_name: string | null;
question: string | null; question: string | null;
cards: { card: string; reversed: boolean; position: string | null; about: string | null }[]; cards: { card: string; reversed: boolean; position: string | null; about: string | null }[];
content: TarotContent | null; content: TarotContent | null;