import { ASPECTS, MOON_PHASES, POINTS, dms, orbText, pointName, signName } from "@/lib/astro"; import type { Forecast, ForecastContact, SolarReturn } from "@/lib/types"; /** Sign names with the "into" suffix: Kos → Kosba. */ const SIGN_INTO: Record = { 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", }; const ECLIPSE_TYPES: Record = { total: "Teljes", annular: "Gyűrűs", hybrid: "Hibrid", partial: "Részleges", penumbral: "Félárnyékos", }; const utcDate = (iso: string) => { const [y, m, d] = iso.split("-").map(Number); return new Date(Date.UTC(y, m - 1, d)); }; /** `2026-08-20` → `aug. 20.` */ export function shortDay(iso: string): string { return new Intl.DateTimeFormat("hu-HU", { month: "short", day: "numeric", timeZone: "UTC" }).format(utcDate(iso)); } /** `2026-08-20` → `2026. aug. 20.` */ export function longDay(iso: string): string { return new Intl.DateTimeFormat("hu-HU", { year: "numeric", month: "short", day: "numeric", timeZone: "UTC" }).format( utcDate(iso), ); } function monthTitle(key: string): string { return new Intl.DateTimeFormat("hu-HU", { year: "numeric", month: "long", timeZone: "UTC" }).format( utcDate(`${key}-01`), ); } const glyph = (id: string) => POINTS[id]?.glyph ?? ""; type Tone = "tense" | "harmonic" | "neutral"; const toneOf = (c: ForecastContact): Tone => c.nature === "challenging" ? "tense" : c.nature === "harmonious" ? "harmonic" : "neutral"; function contactTitle(c: ForecastContact, progressed = false): string { const planet = progressed ? `Progresszív ${pointName(c.planet)}` : pointName(c.planet); return `${planet} ${ASPECTS[c.aspect]?.hu ?? c.aspect} – születési ${pointName(c.natal_point)}`; } function periodText(c: ForecastContact, date?: string): string | null { const periods = c.periods ?? []; const p = (date && periods.find((x) => x.start <= date && date <= x.end)) || periods[0]; if (!p) return null; return p.start === p.end ? `hatás: ${longDay(p.start)}` : `hatás: ${longDay(p.start)} – ${longDay(p.end)}`; } interface Event { date: string; tone: Tone; label: string; title: string; detail: string[]; } /** Everything datable in the year, in time order. */ function events(f: Forecast): Event[] { const out: Event[] = []; const inYear = (d: string) => d >= f.start && d <= f.end; for (const c of f.transits) { const glyphs = `${glyph(c.planet)} ${ASPECTS[c.aspect]?.glyph ?? ""} ${glyph(c.natal_point)}`; if (c.exact.length === 0) { out.push({ date: c.peak, tone: toneOf(c), label: glyphs, title: contactTitle(c), detail: [`legközelebb ${orbText(c.min_orb)}`, periodText(c, c.peak) ?? ""].filter(Boolean), }); } c.exact.forEach((e, i) => { const pass = c.exact.length > 1 ? `${i + 1}. pontos fényszög` : "pontos"; out.push({ date: e.date, tone: toneOf(c), label: glyphs, title: contactTitle(c), detail: [ e.retrograde ? `${pass}, retrográd mozgás közben` : pass, periodText(c, e.date) ?? "", c.house ? `a ${c.house}. házadban` : "", ].filter(Boolean), }); }); } for (const h of f.transit_houses) { for (const i of h.ingresses) { out.push({ date: i.date, tone: "neutral", label: glyph(h.planet), title: `${pointName(h.planet)} a ${i.house}. házadba lép`, detail: i.retrograde ? ["retrográd mozgással"] : [], }); } } const p = f.progressions; for (const c of p.contacts) { for (const e of c.exact) { out.push({ date: e.date, tone: toneOf(c), label: `${glyph(c.planet)}ᵖ`, title: contactTitle(c, true), detail: ["progresszió, pontos"], }); } } for (const b of p.bodies) { const name = `A progresszív ${pointName(b.planet)}`; for (const s of b.sign_changes) { out.push({ date: s.date, tone: "neutral", label: `${glyph(b.planet)}ᵖ`, title: `${name} ${SIGN_INTO[s.sign] ?? signName(s.sign)} lép`, detail: [] }); } for (const h of b.house_changes) { out.push({ date: h.date, tone: "neutral", label: `${glyph(b.planet)}ᵖ`, title: `${name} a ${h.house}. házadba lép`, detail: [] }); } } if (p.lunar_phase_change) { out.push({ date: p.lunar_phase_change.date, tone: "neutral", label: "☽ᵖ", title: `Progresszív holdfázis: ${MOON_PHASES[p.lunar_phase_change.phase] ?? p.lunar_phase_change.phase}`, detail: [], }); } for (const e of f.eclipses) { const what = `${ECLIPSE_TYPES[e.eclipse_type] ?? e.eclipse_type} ${e.kind === "solar" ? "napfogyatkozás" : "holdfogyatkozás"}`; out.push({ date: e.date, tone: e.contacts.length > 0 ? "tense" : "neutral", label: e.kind === "solar" ? "☉●" : "☽●", title: `${what}, ${signName(e.sign)} ${dms(e.degree_in_sign_dms).split("′")[0]}′`, detail: [ e.house ? `a ${e.house}. házadban` : "", ...e.contacts.map( (c) => `${ASPECTS[c.aspect]?.hu ?? c.aspect} a születési ${pointName(c.point)} pontoddal (${orbText(c.orb)})`, ), ].filter(Boolean), }); } return out.filter((e) => inYear(e.date)).sort((a, b) => a.date.localeCompare(b.date)); } /** The year month by month: exact transits, ingresses, progressions, eclipses. */ export function ForecastTimeline({ forecast }: { forecast: Forecast }) { const list = events(forecast); const months = new Map(); for (const e of list) { const key = e.date.slice(0, 7); months.set(key, [...(months.get(key) ?? []), e]); } if (list.length === 0) return

Ebben az évben nincs pontos lassú bolygós fényszög.

; return (

A lassú bolygók (Jupiter–Plútó) fényszögei a születési képletedhez 1° hatásfokon belül, a progresszió és a fogyatkozások. Egy tranzit a teljes hatásidő alatt érződik, a pontos napok körül a legerősebben.

{[...months.entries()].map(([key, items]) => (

{monthTitle(key)}

    {items.map((e, i) => (
  1. {shortDay(e.date)} {e.title} {e.detail.length > 0 && {e.detail.join(" · ")}}
  2. ))}
))}
); } /** The main facts of the year at a glance. */ export function ForecastKeys({ forecast, solarReturn }: { forecast: Forecast; solarReturn: SolarReturn | null }) { const sun = solarReturn?.points.find((p) => p.id === "sun"); const moon = solarReturn?.points.find((p) => p.id === "moon"); const asc = solarReturn?.angles?.ascendant; const ascSign = typeof asc === "object" && asc !== null ? asc.sign : null; const prof = forecast.profection; const pmoon = forecast.progressions.bodies.find((b) => b.planet === "moon"); const exact = forecast.transits.filter((t) => t.exact.length > 0).length; return (
Az év kulcsai
{ascSign && ( <>
Szolár Aszcendens
{signName(ascSign)} {solarReturn?.natal_house_of_ascendant ? `, a születési ${solarReturn.natal_house_of_ascendant}. házadban` : ""}
)} {sun?.house && ( <>
Szolár Nap
a {sun.house}. házban: ez az év fő terepe
)} {moon?.house && ( <>
Szolár Hold
{signName(moon.sign)}, a {moon.house}. házban
)} {prof && ( <>
Az év ura
{pointName(prof.lord)} ({prof.house}. ház, {signName(prof.sign)})
)} {pmoon && ( <>
Progresszív Hold
{signName(pmoon.sign)} {pmoon.house ? `, ${pmoon.house}. ház` : ""} ·{" "} {MOON_PHASES[forecast.progressions.lunar_phase] ?? forecast.progressions.lunar_phase} {pmoon.approximate ? " (bizonytalan)" : ""}
)}
Tranzitok
{exact} pontos lassú bolygós fényszög, {forecast.eclipses.length} fogyatkozás
); } /** All slow-planet transits of the year as a list. */ export function ForecastTransits({ forecast }: { forecast: Forecast }) { if (forecast.transits.length === 0) return

Ebben az évben nincs lassú bolygós tranzit.

; return (
    {forecast.transits.map((c, i) => (
  • {contactTitle(c)} {c.planet === c.natal_point && életciklus} {c.exact.length > 0 ? `pontos: ${c.exact.map((e) => longDay(e.date) + (e.retrograde ? " (R)" : "")).join(", ")}` : `nem pontos az évben, legközelebb ${orbText(c.min_orb)}`} {(c.periods ?? []).length > 0 && ` · hatás: ${(c.periods ?? []).map((p) => `${longDay(p.start)} – ${longDay(p.end)}`).join("; ")}`} {c.house ? ` · ${c.house}. ház` : ""}
  • ))}
); }