Files
sorsfonalak/services/frontend/src/lib/skyText.ts
T
fecoandClaude Opus 5.5 699ce2abbd
CI / test (push) Successful in 2m6s
CI / build (push) Skipped
CI / deploy (push) Skipped
Moon and retrograde calendars, "today in the sky" on the own chart
New public pages: /holdnaptar (new and full moons, quarters, eclipses and
the Moon's sign changes, month by month, with the Moon of today) and
/retrograd (the retrograde periods of Mercury to Pluto with their shadows,
and which planets are retrograde now), each with a page per year around
the current one. The own chart gets a "Ma az égen" card: the Moon's sign,
phase and natal house, the tightest transits to the chart in fixed
sentences, and the retrograde planets. No AI, nothing stored.

The events come from astro-engine (sampling and bisection, checked against
swetest and the 2026 eclipses) through horoscope-api GET /v1/sky and
/v1/sky/events; the backend serves them at /v1/public/sky… and keeps them
in memory (the sky now for five minutes, a year's events for good). Links
in the mobile menu, the footer, the sitemap and the free tools on the home
page; the desktop header is unchanged (it is full at 1280 px).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-23 17:21:36 +00:00

262 lines
10 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Hungarian words and short texts for the sky calendars and the "today in
// the sky" card. No AI: fixed sentences put together from parts.
import { POINTS, SIGNS } from "./astro";
import type { LunationKind, SkyLunation, SkyPosition } from "./types";
/** "in Aries": `Kosban`. */
export const SIGN_IN: Record<string, string> = {
aries: "Kosban",
taurus: "Bikában",
gemini: "Ikrekben",
cancer: "Rákban",
leo: "Oroszlánban",
virgo: "Szűzben",
libra: "Mérlegben",
scorpio: "Skorpióban",
sagittarius: "Nyilasban",
capricorn: "Bakban",
aquarius: "Vízöntőben",
pisces: "Halakban",
};
/** "into Aries": `Kosba`. */
export const SIGN_INTO: Record<string, string> = {
aries: "Kosba",
taurus: "Bikába",
gemini: "Ikrekbe",
cancer: "Rákba",
leo: "Oroszlánba",
virgo: "Szűzbe",
libra: "Mérlegbe",
scorpio: "Skorpióba",
sagittarius: "Nyilasba",
capricorn: "Bakba",
aquarius: "Vízöntőbe",
pisces: "Halakba",
};
/** The mood of the days with the Moon in a sign. */
export const MOON_IN_SIGN: Record<string, string> = {
aries: "Lendület és türelmetlenség. Jó nap elkezdeni valamit.",
taurus: "Nyugalom, kényelem, érzéki örömök. Ráérősebb tempó.",
gemini: "Kíváncsiság, beszélgetések, sok apró ügy egyszerre.",
cancer: "Otthon, család, érzékenység. Jólesik a biztonság.",
leo: "Önkifejezés, játékosság, a figyelem öröme.",
virgo: "Rendrakás, részletek, a test és a napi rutin.",
libra: "Kapcsolatok, harmónia, kompromisszumok.",
scorpio: "Mélység és intenzitás: erősebb érzések, kevesebb felszínesség.",
sagittarius: "Derűlátás, tanulás, kalandvágy.",
capricorn: "Kötelességek, tervezés, kitartó munka.",
aquarius: "Szabadság, barátok, szokatlan ötletek.",
pisces: "Álmodozás, együttérzés, megérzések.",
};
/** What a phase of the Moon is good for, in the astrological tradition. */
export const PHASE_MEANING: Record<string, string> = {
new_moon: "Újrakezdés: jó pillanat szándékot megfogalmazni, valami újat elindítani.",
waxing_crescent: "Az elindított dolgok szárba szöknek: lendület, első lépések.",
first_quarter: "Próbatétel: ami elindult, most döntéseket és kitartást kér.",
waxing_gibbous: "Csiszolás és finomhangolás a kiteljesedés előtt.",
full_moon: "Tetőpont: felfokozott érzelmek, minden láthatóbbá válik.",
waning_gibbous: "Az eredmények ideje: megosztás, hála, tanulságok.",
last_quarter: "Rendrakás: amitől ideje elbúcsúzni, attól most könnyebb.",
waning_crescent: "Pihenés és elengedés a következő újhold előtt.",
};
export const LUNATION_NAMES: Record<LunationKind, string> = {
new_moon: "Újhold",
first_quarter: "Első negyed",
full_moon: "Telihold",
last_quarter: "Utolsó negyed",
};
/** Moon glyphs of the four main phases: the filled part is the lit one (gold on the dark page). */
export const LUNATION_GLYPHS: Record<LunationKind, string> = {
new_moon: "○",
first_quarter: "◑",
full_moon: "●",
last_quarter: "◐",
};
export function eclipseName(e: NonNullable<SkyLunation["eclipse"]>): string {
const type = { total: "teljes", annular: "gyűrűs", hybrid: "hibrid", partial: "részleges", penumbral: "félárnyékos" }[
e.eclipse_type
];
return `${type} ${e.kind === "solar" ? "napfogyatkozás" : "holdfogyatkozás"}`;
}
/** What a natal house is about, as the subject of "kerülnek előtérbe". */
export const HOUSE_THEMES: Record<number, string> = {
1: "a hangulatod és a megjelenésed",
2: "a pénzügyeid és az anyagi biztonságod",
3: "a beszélgetések és a rövid utak",
4: "az otthonod és a családod",
5: "az örömeid és a kreativitásod",
6: "a munkád és a napi teendőid",
7: "a párkapcsolatod és a társaid",
8: "a közös anyagiak és az intimitás",
9: "a tanulás és az utazás",
10: "a hivatásod és a céljaid",
11: "a barátaid és a közösségeid",
12: "a pihenés és a belső világod",
};
/** What a planet brings when it moves over a chart (one noun, for the sentences). */
const TRANSIT_THEME: Record<string, string> = {
sun: "az önkifejezés",
moon: "a hangulat",
mercury: "a kommunikáció",
venus: "a szeretet",
mars: "a lendület",
jupiter: "a bizalom",
saturn: "a felelősség",
uranus: "a változás",
neptune: "a képzelet",
pluto: "az átalakulás",
};
/** What a point of the birth chart stands for (yours). */
const NATAL_THEME: Record<string, string> = {
sun: "az önazonosságod",
moon: "az érzelmeid",
mercury: "a gondolkodásod",
venus: "a kapcsolataid",
mars: "a cselekvőkészséged",
jupiter: "az optimizmusod",
saturn: "a kötelességtudatod",
uranus: "a függetlenséged",
neptune: "az érzékenységed",
pluto: "a belső erőd",
ascendant: "a fellépésed",
midheaven: "a hivatásod",
};
/** "with your natal Moon": the point in the instrumental, with "your". */
const NATAL_WITH: Record<string, string> = {
sun: "Napoddal",
moon: "Holdaddal",
mercury: "Merkúroddal",
venus: "Vénuszoddal",
mars: "Marsoddal",
jupiter: "Jupitereddel",
saturn: "Szaturnuszoddal",
uranus: "Uránuszoddal",
neptune: "Neptunuszoddal",
pluto: "Plútóddal",
ascendant: "aszcendenseddel",
midheaven: "MC-ddel",
};
/** The aspect as "in trine" (`trigonban`). */
const ASPECT_IN: Record<string, string> = {
conjunction: "együttállásban",
sextile: "szextilben",
square: "kvadrátban",
trine: "trigonban",
opposition: "szembenállásban",
};
/** "A tranzit Vénusz trigonban áll a születési Holdaddal." */
export function transitLine(transiting: string, aspect: string, natal: string): string {
return `A tranzit ${POINTS[transiting]?.hu ?? transiting} ${ASPECT_IN[aspect] ?? aspect} áll a születési ${NATAL_WITH[natal] ?? natal}.`;
}
/** One sentence on what the aspect suggests. */
export function transitMeaning(transiting: string, aspect: string, natal: string): string {
const a = TRANSIT_THEME[transiting] ?? transiting;
const b = NATAL_THEME[natal] ?? natal;
if (aspect === "conjunction") return `Egybefonódik ${a} és ${b}.`;
if (aspect === "trine" || aspect === "sextile") return `Könnyen összhangba kerül ${a} és ${b}.`;
return `Súrlódás lehet ${a} és ${b} között; megéri tudatosan kezelni.`;
}
/** What a retrograde period of the planet is said to bring. */
export const RETROGRADE_MEANING: Record<string, string> = {
mercury:
"Kommunikáció, utazás, technika, szerződések: gyakoribb félreértések, késések, előkerülő régi ügyek. Jó idő átnézni, javítani, újragondolni.",
venus:
"Kapcsolatok és értékek: régi szerelmek, kapcsolati kérdések kerülhetnek elő. A nagy vásárlásokat, látványos változtatásokat a külsőn sokan elhalasztják.",
mars: "Energia és cselekvés: a lendület befelé fordul, régi konfliktusok kerülhetnek elő. Inkább befejezni érdemes, mint új harcba kezdeni.",
jupiter: "Növekedés, hit, tanulás: a kifelé terjeszkedés helyett belső fejlődés, a meggyőződések átgondolása.",
saturn: "Felelősség és struktúra: a kötelezettségek, határok és hosszú távú tervek felülvizsgálata.",
uranus: "Változás és szabadság: a változások belül érlelődnek, mielőtt kifelé is megmutatkoznának.",
neptune: "Álmok és illúziók: a köd ritkul, könnyebb tisztán látni, mi volt csak vágyálom.",
pluto: "Átalakulás és hatalom: régi minták kerülnek felszínre, mély, belső átalakulás.",
};
/** `"2026-03-03T12:38"` as a date in Hungarian (no time zone shift: the text is local already). */
export function localDate(
local: string,
opts: { time?: boolean; weekday?: boolean; year?: boolean; short?: boolean } = {},
): string {
const [date, clock = "00:00"] = local.split("T");
const [y, m, d] = date.split("-").map(Number);
const [h, min] = clock.split(":").map(Number);
const text = new Intl.DateTimeFormat("hu-HU", {
...(opts.year ? { year: "numeric" } : {}),
month: opts.short ? "short" : "long",
day: "numeric",
...(opts.weekday ? { weekday: "long" } : {}),
timeZone: "UTC",
}).format(new Date(Date.UTC(y, m - 1, d)));
return opts.time ? `${text} ${String(h).padStart(2, "0")}:${String(min).padStart(2, "0")}` : text;
}
/** `Halak 8°29′`. */
export function positionText(p: SkyPosition): string {
const deg = Math.floor(p.degree_in_sign);
const min = Math.floor((p.degree_in_sign - deg) * 60);
return `${SIGNS[p.sign]?.hu ?? p.sign} ${deg}°${String(min).padStart(2, "0")}′`;
}
/** Hungarian month names, January first. */
export const MONTH_NAMES = [
"Január",
"Február",
"Március",
"Április",
"Május",
"Június",
"Július",
"Augusztus",
"Szeptember",
"Október",
"November",
"December",
];
/** `a Kosba`, `az Ikrekbe`: the article before a Hungarian word. */
export function withArticle(word: string): string {
return `${/^[aáeéiíoóöőuúüű]/i.test(word) ? "az" : "a"} ${word}`;
}
/** "ma", "holnap" or the date, for a local time relative to another one. */
export function dayWord(local: string, today: string): string {
const day = (t: string) => {
const [y, m, d] = t.slice(0, 10).split("-").map(Number);
return Date.UTC(y, m - 1, d);
};
const diff = Math.round((day(local) - day(today)) / 86400000);
if (diff === 0) return "ma";
if (diff === 1) return "holnap";
return localDate(local, { short: true });
}
/** `december 13-ig`: a date with "until" (the date's closing dot dropped). */
export function until(local: string, opts: Parameters<typeof localDate>[1] = {}): string {
return `${localDate(local, opts).replace(/\.$/, "")}-ig`;
}
/** `2026-ban`, `2027-ben`: a year with "in", by how its last word sounds. */
export function yearIn(year: number): string {
const last = year % 10;
const tens = Math.floor(year / 10) % 10;
let back: boolean;
if (last !== 0) back = [3, 6, 8].includes(last);
else if (tens !== 0) back = [2, 3, 6, 8].includes(tens);
// "…száz": -ban, "…ezer": -ben.
else back = Math.floor(year / 100) % 10 !== 0;
return `${year}-${back ? "ban" : "ben"}`;
}