Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47bbe2f348 | ||
|
|
6c5f0b160e | ||
|
|
f8386cbf55 | ||
|
|
f6fc2e46ac | ||
|
|
f7b9af5e8c |
@@ -601,7 +601,7 @@ pub fn build(kind: Kind, language: &str, chart_text: &str, system: Option<&str>)
|
||||
|
||||
/// Checks an answer against our schema subset (objects with required
|
||||
/// properties, strings with at least three letters, string arrays with at
|
||||
/// least two items). A placeholder such as "x" counts as missing.
|
||||
/// least two items, other arrays not empty). A placeholder such as "x" counts as missing.
|
||||
pub fn validate(schema: &Value, value: &Value) -> Result<(), String> {
|
||||
fn walk(schema: &Value, value: &Value, path: &str) -> Result<(), String> {
|
||||
match schema["type"].as_str() {
|
||||
@@ -615,7 +615,9 @@ pub fn validate(schema: &Value, value: &Value) -> Result<(), String> {
|
||||
}
|
||||
Some("array") => {
|
||||
let items = value.as_array().ok_or_else(|| format!("{path}: expected an array"))?;
|
||||
if items.len() < 2 {
|
||||
// Lists of strings need two items; other lists (a one-card reading's cards) one.
|
||||
let min = if schema["items"]["type"] == "string" { 2 } else { 1 };
|
||||
if items.len() < min {
|
||||
return Err(format!("{path}: too few items"));
|
||||
}
|
||||
items.iter().enumerate().try_for_each(|(i, v)| walk(&schema["items"], v, &format!("{path}[{i}]")))
|
||||
|
||||
@@ -264,7 +264,7 @@ pub fn tarot_schema() -> Value {
|
||||
}
|
||||
}
|
||||
},
|
||||
"synthesis": {"type": "string", "description": "How the cards read together, 1-3 paragraphs separated by a blank line"},
|
||||
"synthesis": {"type": "string", "description": "How the cards read together (a single card: how its message shows in practice), 1-3 paragraphs separated by a blank line"},
|
||||
"advice": {"type": "string", "description": "A closing, encouraging paragraph with one or two concrete steps"}
|
||||
}
|
||||
})
|
||||
@@ -281,6 +281,13 @@ fn length(cards: usize) -> (usize, usize) {
|
||||
|
||||
fn hungarian_system(cards: usize) -> String {
|
||||
let (min, max) = length(cards);
|
||||
let together = if cards == 1 {
|
||||
"- Egyetlen lap van, nincs mit egymáshoz mérni: a „synthesis” mezőben arról írj, hogyan jelenhet meg a lap \
|
||||
üzenete a gyakorlatban, az olvasó napjában vagy a kérdése ügyében (helyzetek, érzések, amelyekre figyelhet)."
|
||||
} else {
|
||||
"- A lapok együtt mesélnek: mutasd meg, hogyan kapcsolódnak egymáshoz (ismétlődő elemek, színek, nagy árkánumok \
|
||||
súlya, az álló és fordított lapok aránya)."
|
||||
};
|
||||
format!(
|
||||
"Tapasztalt, empatikus, lélektani szemléletű tarot-olvasó vagy, aki az asztrológiát is ismeri. A Sorsfonalak \
|
||||
alkalmazás számára személyes kártyajóslást írsz egy kirakásról, amelyet az olvasó kérdésére húzott.
|
||||
@@ -292,8 +299,7 @@ Szabályok:
|
||||
kiindulópont: a saját tudásod a lapok hagyományos szimbolikájáról (Rider–Waite) kiegészítheti, de ne mondjon neki ellent.
|
||||
- Minden lapot a pozíciója fényében olvass, és mindig a kérdésre vonatkoztasd. Ha nincs kérdés, az olvasó jelenlegi \
|
||||
életszakaszáról szólj általánosan.
|
||||
- A lapok együtt mesélnek: mutasd meg, hogyan kapcsolódnak egymáshoz (ismétlődő elemek, színek, nagy árkánumok \
|
||||
súlya, az álló és fordított lapok aránya).
|
||||
{together}
|
||||
- Az olvasó Napját, Holdját és Aszcendensét (ha meg van adva) egy-két helyen, finoman kapcsold a lapokhoz, például a \
|
||||
lapok elemén vagy asztrológiai megfelelésén keresztül; ne írj belőle horoszkópot.
|
||||
- Közvetlenül az olvasóhoz szólj, tegező formában (egyes szám második személyben, „te”).
|
||||
@@ -313,6 +319,13 @@ elem legyen, ahány lap van, a pozíciók sorrendjében.{HUNGARIAN_TERMS}"
|
||||
|
||||
fn english_system(language: &str, cards: usize) -> String {
|
||||
let (min, max) = length(cards);
|
||||
let together = if cards == 1 {
|
||||
"- There is a single card, nothing to weigh it against: in \"synthesis\" write how its message may show in \
|
||||
practice, in the reader's day or in the matter of the question (situations and feelings to watch for)."
|
||||
} else {
|
||||
"- Show how the cards tell one story together (recurring elements and suits, the weight of the major arcana, \
|
||||
upright versus reversed cards)."
|
||||
};
|
||||
format!(
|
||||
"You are an experienced, empathetic tarot reader with a psychological approach who also knows astrology. You \
|
||||
write a personal tarot reading for the Sorsfonalak app about a spread the reader drew for their question.
|
||||
@@ -324,8 +337,7 @@ Rules:
|
||||
starting point; your knowledge of the traditional (Rider-Waite) symbolism may add to them but must not contradict them.
|
||||
- Read each card in the light of its position and always relate it to the question. Without a question, speak about \
|
||||
the reader's present phase of life.
|
||||
- Show how the cards tell one story together (recurring elements and suits, the weight of the major arcana, upright \
|
||||
versus reversed cards).
|
||||
{together}
|
||||
- Link the reader's Sun, Moon and Ascendant (when given) to the cards once or twice, gently, e.g. through the cards' \
|
||||
elements or astrological correspondences; do not write a horoscope.
|
||||
- Address the reader directly, in the second person.
|
||||
@@ -464,4 +476,19 @@ mod tests {
|
||||
assert!(Reading::parse(&wrong).is_err());
|
||||
assert!(Reading::parse(&json!({"spread": "daily", "cards": [{"card": "nincs"}]})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_card_has_no_reading_together() {
|
||||
assert!(hungarian_system(1).contains("Egyetlen lap van") && !hungarian_system(1).contains("együtt mesélnek"));
|
||||
assert!(hungarian_system(3).contains("együtt mesélnek"));
|
||||
assert!(english_system("en", 1).contains("single card") && !english_system("en", 1).contains("one story"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_one_card_answer_is_valid() {
|
||||
let text = "Egy bekezdés a lapról.";
|
||||
let answer = |cards: Value| json!({"title": "Napi üzenet", "summary": text, "cards": cards, "synthesis": text, "advice": text});
|
||||
assert_eq!(crate::validate(&tarot_schema(), &answer(json!([{"body": text}]))), Ok(()));
|
||||
assert!(crate::validate(&tarot_schema(), &answer(json!([]))).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,9 +977,19 @@ a.pair-row:hover strong { color: var(--gold); }
|
||||
.lp-nav { display: none; }
|
||||
/* On phones the free tools get their own row under the logo. */
|
||||
.lp-header { flex-wrap: wrap; row-gap: 4px; }
|
||||
.lp-free { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; overflow-x: auto; scrollbar-width: none; }
|
||||
.lp-free { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; overflow-x: auto; scrollbar-width: none; gap: 0; }
|
||||
.lp-free a { padding: 10px 7px; }
|
||||
.lp-free-label { margin-right: 4px; }
|
||||
.lp-header > .btn { margin-left: auto; }
|
||||
}
|
||||
/* The free-tools row fits on narrow phones too, without sideways scrolling */
|
||||
@media (max-width: 380px) {
|
||||
.lp-free a { font-size: 14px; padding: 10px 5px; }
|
||||
.lp-free-label { font-size: 10px; padding: 2px 6px; letter-spacing: 0.5px; }
|
||||
}
|
||||
@media (max-width: 350px) {
|
||||
.lp-free-label { display: none; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.lp *, .lp-orbit { animation: none !important; }
|
||||
.lp-rise, .lp-wheel .w-point { opacity: 1; transform: none; }
|
||||
|
||||
@@ -16,6 +16,8 @@ export function TarotResult({
|
||||
question: string | null;
|
||||
content: TarotContent;
|
||||
}) {
|
||||
// A single card has nothing to read it with: its synthesis is about everyday life.
|
||||
const together = cards.length === 1 ? "A gyakorlatban" : "A lapok együtt";
|
||||
return (
|
||||
<article className="tarot-result">
|
||||
<header className="tarot-result-head">
|
||||
@@ -51,8 +53,8 @@ export function TarotResult({
|
||||
</ol>
|
||||
|
||||
{content.synthesis && (
|
||||
<section className="tarot-synthesis" aria-label="A lapok együtt">
|
||||
<h3>A lapok együtt</h3>
|
||||
<section className="tarot-synthesis" aria-label={together}>
|
||||
<h3>{together}</h3>
|
||||
<Paragraphs text={content.synthesis} />
|
||||
</section>
|
||||
)}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user