Yearly forecast: solar return, transits, progressions, profection, eclipses
CI / test (push) Successful in 56s
CI / build (push) Successful in 4m41s
CI / deploy (push) Skipped

- astro-engine: forecast module (solar return moment, slow-planet transits
  with exact dates and periods, natal house ingresses, secondary
  progressions, annual profection, eclipses via Swiss Ephemeris)
- horoscope-api: POST /v1/forecast, solar return chart cast for the place
  of the birthday
- backend: forecasts table, /v1/charts/{id}/forecasts, /v1/forecasts/{id}
  and its analyses using a new 'forecast' unit; current year of life open,
  the next one 30 days before the birthday
- packages: Páros and Család include forecasts (6 000 / 11 000 Ft),
  +1 éves előrejelzés add-on 2 500 Ft; Egy elemzés unchanged
- worker and prompt: forecast kind with five sections and forecast rules
  (trends, no event predictions); no birth data, place or exact age sent
- frontend: /kepletek/{id}/elorejelzes with the solar return wheel, the
  keys of the year, a monthly timeline, transit list and detailed forecast
- data export: forecasts added, model name removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 08:19:13 +00:00
co-authored by Claude Opus 5.5
parent 829c33e52f
commit f1bd34c394
42 changed files with 4764 additions and 85 deletions
@@ -8,9 +8,12 @@ import { ROLE_LABELS, formatDate } from "@/lib/astro";
import type { AdminUser, Package, Role } from "@/lib/types";
const EDITABLE_ROLES: Role[] = ["user", "creator", "admin"];
const UNITS: { value: "natal" | "synastry"; label: string }[] = [
type UnitKind = "natal" | "synastry" | "forecast";
const UNITS: { value: UnitKind; label: string }[] = [
{ value: "natal", label: "képlet" },
{ value: "synastry", label: "szinasztria" },
{ value: "forecast", label: "előrejelzés" },
];
export function AdminUsers({ selfId }: { selfId: string }) {
@@ -102,7 +105,7 @@ function UserRow({
const [status, setStatus] = useState<{ ok: boolean; text: string } | null>(null);
const [busy, setBusy] = useState(false);
const [delta, setDelta] = useState("");
const [unit, setUnit] = useState<"natal" | "synastry">("natal");
const [unit, setUnit] = useState<UnitKind>("natal");
async function toggleRole(role: Role, on: boolean) {
const roles = on ? [...user.roles, role] : user.roles.filter((r) => r !== role);
@@ -175,6 +178,8 @@ function UserRow({
képlet {user.analyses_left.natal}
<br />
szinasztria {user.analyses_left.synastry}
<br />
előrejelzés {user.analyses_left.forecast ?? 0}
</span>
<label className="sr-only" htmlFor={`unit-${user.id}`}>
Elemzés fajtája
@@ -184,7 +189,7 @@ function UserRow({
className="inp"
style={{ width: 118, minHeight: 36 }}
value={unit}
onChange={(e) => setUnit(e.target.value as "natal" | "synastry")}
onChange={(e) => setUnit(e.target.value as UnitKind)}
>
{UNITS.map((u) => (
<option key={u.value} value={u.value}>
@@ -16,6 +16,10 @@ const FAQ: [string, string][] = [
"Mi a különbség a képletelemzés és a kapcsolati elemzés között?",
"A képletelemzés egy ember születési képletét írja le hat fejezetben. A kapcsolati elemzés két képletet vet össze: mi vonz, hol súrlódtok, és mit ad a kapcsolat.",
],
[
"Mi az éves előrejelzés?",
"Egy év születésnaptól születésnapig. A szolár képletből (a Nap visszatérése a születési helyére), a lassú bolygók tranzitjaiból, a progresszióból, az év urából és a fogyatkozásokból áll össze, öt fejezetben és negyedévenkénti idővonallal. A számított idővonal ingyenes, a részletes szöveg egy előrejelzést használ.",
],
[
"Mire kell a személyhely?",
"A saját képleted mellé felvett emberekhez (társ, gyerek, barát). Egy személy felvétele egy helyet használ; a képlete és a rövid összefoglalója ingyenes, a részletes elemzés külön jár.",
@@ -49,6 +53,7 @@ export default async function PackagesPage() {
<span className="eyebrow">Most</span>
<p>
<strong>{left.natal}</strong> képletelemzés · <strong>{left.synastry}</strong> kapcsolati elemzés ·{" "}
<strong>{left.forecast}</strong> éves előrejelzés ·{" "}
{slots.unlimited ? (
"korlátlan személy"
) : (
+27
View File
@@ -583,3 +583,30 @@ a.pair-row:hover strong { color: var(--gold); }
.ai-note h2 { font-size: 24px; }
.ai-note p { margin: 0; max-width: 72ch; line-height: 1.65; }
.ai-line { margin: 0; color: var(--ink-2); line-height: 1.6; padding-left: 12px; border-left: 2px solid var(--gold); max-width: 64ch; }
/* Yearly forecast: timeline and transit list */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.timeline-month h3 { font-size: 20px; margin: 0 0 8px; text-transform: capitalize; }
.timeline-month ol, .transit-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.timeline-item {
display: grid; grid-template-columns: 64px 56px 1fr; gap: 10px; align-items: baseline;
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px; background: rgba(255, 255, 255, 0.02);
}
.timeline-date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline-glyph { font-size: 17px; color: var(--gold); white-space: nowrap; }
.timeline-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timeline-item.tone-tense, .transit-list .tone-tense { border-left-color: var(--tense); }
.timeline-item.tone-harmonic, .transit-list .tone-harmonic { border-left-color: var(--harmonic); }
.timeline-item.tone-neutral, .transit-list .tone-neutral { border-left-color: var(--gold); }
.transit-list li {
display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: baseline;
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px;
}
.transit-list li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.transit-list .sym { font-size: 17px; color: var(--gold); white-space: nowrap; }
.transit-list .pill { align-self: flex-start; font-size: 12px; padding: 1px 8px; border: 1px solid var(--gold); border-radius: 999px; color: var(--gold); }
.plain-list { margin: 8px 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) {
.timeline-item { grid-template-columns: 52px 1fr; }
.timeline-glyph { display: none; }
}
@@ -0,0 +1,127 @@
"use client";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { CountrySelect, PlaceSearch } from "@/app/profil/BirthForm";
import { api, errorText } from "@/lib/api";
import type { ForecastDetail, Place } from "@/lib/types";
/**
* Calculates a year: which year (when two are open) and where the person is
* on the birthday (the solar return chart is cast for that place).
*/
export function ForecastStart({
chartId,
years,
birthPlace,
timeKnown,
compact = false,
}: {
chartId: string;
years: number[];
birthPlace: string | null;
timeKnown: boolean;
compact?: boolean;
}) {
const router = useRouter();
const [year, setYear] = useState(years[0]);
const [elsewhere, setElsewhere] = useState(false);
const [country, setCountry] = useState("HU");
const [place, setPlace] = useState<Place | null>(null);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
async function submit(e: React.FormEvent) {
e.preventDefault();
if (elsewhere && !place) return setError("Válaszd ki a települést a listából.");
setBusy(true);
setError(null);
try {
const body: Record<string, unknown> = { year };
if (elsewhere && place) body.location = { country, geonames_id: place.geonames_id, place: place.name };
const f = await api<ForecastDetail>(`/charts/${chartId}/forecasts`, { body });
router.push(`/kepletek/${chartId}/elorejelzes?f=${f.id}`);
router.refresh();
} catch (err) {
setError(errorText(err));
setBusy(false);
}
}
return (
<form className={compact ? "field" : "card field"} onSubmit={submit} style={{ gap: 14 }}>
{!compact && (
<>
<span className="eyebrow">Éves előrejelzés</span>
<h2>Mit hoz az éved?</h2>
<p className="muted">
Egy év születésnaptól születésnapig. Az év képlete a szolár: az a pillanat, amikor a Nap visszatér a
születéskori helyére. Ehhez jönnek a lassú bolygók tranzitjai pontos dátumokkal, a progresszív Hold, az év ura
és a fogyatkozások. A számítás és az idővonal ingyenes.
</p>
</>
)}
{years.length > 1 && (
<fieldset className="field" style={{ border: 0, padding: 0, margin: 0 }}>
<legend className="label" style={{ marginBottom: 8 }}>
Melyik év?
</legend>
{years.map((y) => (
<label key={y} className="check">
<input type="radio" name="year" checked={year === y} onChange={() => setYear(y)} />
{y === years[0] ? `A mostani év (${y}-es születésnaptól)` : `A következő év (${y}-es születésnaptól)`}
</label>
))}
</fieldset>
)}
{timeKnown && (
<fieldset className="field" style={{ border: 0, padding: 0, margin: 0 }}>
<legend className="label" style={{ marginBottom: 8 }}>
Hol vagy a születésnapodon?
</legend>
<label className="check">
<input type="radio" name="where" checked={!elsewhere} onChange={() => setElsewhere(false)} />
A születési helyemen{birthPlace ? ` (${birthPlace})` : ""}
</label>
<label className="check">
<input type="radio" name="where" checked={elsewhere} onChange={() => setElsewhere(true)} />
Máshol (lakóhely, nyaralás)
</label>
<span className="hint">
A szolár képlet házai attól függnek, hol tartózkodsz a születésnapod pillanatában. Ha nem tudod, add meg
a lakóhelyed.
</span>
</fieldset>
)}
{timeKnown && elsewhere && (
<div className="grid-2">
<CountrySelect
value={country}
onChange={(c) => {
setCountry(c);
setPlace(null);
}}
/>
<PlaceSearch country={country} value={place} onChange={setPlace} />
</div>
)}
{!timeKnown && (
<p className="hint">
A születési idő ismeretlen, ezért szolár képlet és az év ura nem számolható; az előrejelzés a tranzitokra és a
progresszióra épül.
</p>
)}
{error && (
<p className="msg msg-error" role="alert">
{error}
</p>
)}
<div className="form-actions">
<button type="submit" className="btn btn-primary" disabled={busy}>
{busy ? "Számolás…" : compact ? "Kiszámítás" : "Előrejelzés kiszámítása"}
</button>
</div>
</form>
);
}
@@ -0,0 +1,150 @@
import type { Metadata } from "next";
import Link from "next/link";
import { notFound } from "next/navigation";
import { ChartWheel } from "@/components/ChartWheel";
import { DetailedAnalysis } from "@/components/DetailedAnalysis";
import { ForecastKeys, ForecastTimeline, ForecastTransits, longDay } from "@/components/ForecastViews";
import { Tabs } from "@/components/Tabs";
import { backendGet, requireMe } from "@/lib/server";
import type { Analysis, Chart, ForecastDetail, ForecastList, PublicConfig } from "@/lib/types";
import { ForecastStart } from "./ForecastStart";
export const metadata: Metadata = { title: "Éves előrejelzés" };
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
/** One year of a chart: the solar return, the year's keys, the timeline and the detailed forecast. */
export default async function ForecastPage({
params,
searchParams,
}: {
params: Promise<{ id: string }>;
searchParams: Promise<{ f?: string }>;
}) {
const { id } = await params;
const { f } = await searchParams;
const me = await requireMe(`/kepletek/${id}/elorejelzes`);
if (!UUID.test(id)) notFound();
const [chart, list, config] = await Promise.all([
backendGet<Chart>(`/v1/charts/${id}`),
backendGet<ForecastList>(`/v1/charts/${id}/forecasts`),
backendGet<PublicConfig>("/v1/config"),
]);
if (!chart || !list) notFound();
const chosenId = f && UUID.test(f) ? f : (list.forecasts[0]?.id ?? null);
const [forecast, analyses] = chosenId
? await Promise.all([
backendGet<ForecastDetail>(`/v1/forecasts/${chosenId}`),
backendGet<{ analyses: Analysis[] }>(`/v1/forecasts/${chosenId}/analyses`),
])
: [null, null];
const detailed = (analyses?.analyses ?? []).find((a) => a.status !== "failed") ?? analyses?.analyses[0] ?? null;
const name = chart.is_primary ? "Az éved" : `${chart.label} éve`;
const sr = forecast?.result.solar_return ?? null;
const fc = forecast?.result.forecast;
const others = list.forecasts.filter((x) => x.id !== forecast?.id);
return (
<main className="page" style={{ maxWidth: 1180 }}>
<div className="page-head">
<p className="hint">
<Link href={`/kepletek/${chart.id}`}>← {chart.is_primary ? "Születési képletem" : chart.label}</Link>
</p>
<h1>{forecast ? `${name}: ${forecast.year}–${forecast.year + 1}` : "Éves előrejelzés"}</h1>
{forecast && fc && (
<p className="muted">
{longDay(fc.start)} – {longDay(fc.end)} · {forecast.place ?? "születési hely"}
</p>
)}
</div>
{!forecast && list.years.length > 0 && (
<ForecastStart
chartId={chart.id}
years={list.years}
birthPlace={list.birth_place}
timeKnown={list.time_known}
/>
)}
{!forecast && list.years.length === 0 && (
<p className="card muted">Az első születésnap előtt még nincs éves előrejelzés.</p>
)}
{forecast && fc && (
<>
<section className="chart-layout" aria-label="Szolár képlet">
{sr ? (
<div className="card chart-wheel-card">
<ChartWheel chart={sr} timeKnown title="Szolár képlet" />
<p className="hint">
Szolár képlet: {longDay(sr.local_time.slice(0, 10))} {sr.local_time.slice(11, 16)} helyi idő
szerint, {forecast.place}. A Nap ekkor ér vissza pontosan a születéskori helyére.
</p>
</div>
) : (
<div className="card">
<p className="muted">
Szolár képlet nincs, mert a születési idő ismeretlen: a Nap visszatérésének pillanata így akár fél napot
is tévedhet. Az előrejelzés a tranzitokra és a progresszióra épül.
</p>
</div>
)}
<div className="field chart-side">
<ForecastKeys forecast={fc} solarReturn={sr} />
{(list.years.length > 0 || others.length > 0) && (
<details className="card">
<summary>Másik év vagy helyszín</summary>
{others.length > 0 && (
<ul className="plain-list">
{others.map((o) => (
<li key={o.id}>
<Link href={`/kepletek/${chart.id}/elorejelzes?f=${o.id}`}>
{o.year}–{o.year + 1} · {o.place ?? "születési hely"}
</Link>
</li>
))}
</ul>
)}
{list.years.length > 0 && (
<ForecastStart
chartId={chart.id}
years={list.years}
birthPlace={list.birth_place}
timeKnown={list.time_known}
compact
/>
)}
</details>
)}
</div>
</section>
<section className="card chart-tabs" aria-label="Előrejelzés">
<Tabs
label="Előrejelzés részletei"
tabs={[
{
id: "elemzes",
label: "Előrejelzés",
content: (
<DetailedAnalysis
target={{ kind: "forecast", forecastId: forecast.id }}
initial={detailed}
left={me.analyses_left.forecast}
isAdmin={me.user.roles.includes("admin")}
canPay={config?.mock_payments ?? false}
/>
),
},
{ id: "idovonal", label: "Idővonal", content: <ForecastTimeline forecast={fc} /> },
{ id: "tranzitok", label: "Tranzitok", content: <ForecastTransits forecast={fc} /> },
]}
/>
</section>
</>
)}
</main>
);
}
@@ -118,6 +118,16 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
)}
</div>
)}
<Link href={`/kepletek/${chart.id}/elorejelzes`} className="card persons-tile">
<span className="eyebrow">Éves előrejelzés</span>
<strong>{chart.is_primary ? "Mit hoz az éved?" : `Mit hoz ${chart.label} éve?`}</strong>
<span className="muted">
Szolár képlet, tranzitok pontos dátumokkal, progresszió: egy év születésnaptól születésnapig.
</span>
<span className="persons-tile-arrow" aria-hidden="true">
→
</span>
</Link>
{!chart.is_primary && own && (
<div className="card compare-tile">
<span className="eyebrow">Összevetés</span>
@@ -199,7 +199,7 @@ export function BirthForm({
);
}
function CountrySelect({ value, onChange }: { value: string; onChange: (iso2: string) => void }) {
export function CountrySelect({ value, onChange }: { value: string; onChange: (iso2: string) => void }) {
const [countries, setCountries] = useState<Country[]>([]);
useEffect(() => {
fetch("/api/geo/countries")
@@ -226,7 +226,7 @@ function CountrySelect({ value, onChange }: { value: string; onChange: (iso2: st
);
}
function PlaceSearch({
export function PlaceSearch({
country,
value,
onChange,
+1 -1
View File
@@ -46,7 +46,7 @@ export default async function ProfilePage() {
<dd>{me.providers.map((p) => PROVIDERS[p] ?? p).join(", ") || "–"}</dd>
<dt>Részletes elemzések</dt>
<dd>
{`${me.analyses_left.natal} képlet, ${me.analyses_left.synastry} kapcsolati`}{" "}
{`${me.analyses_left.natal} képlet, ${me.analyses_left.synastry} kapcsolati, ${me.analyses_left.forecast} előrejelzés`}{" "}
· <Link href="/csomagok">Csomagok</Link>
</dd>
<dt>Személyek</dt>
@@ -4,10 +4,18 @@ import { Paragraphs, Rich } from "./Rich";
const NATAL_ORDER = ["personality", "emotions", "mind", "love", "work", "growth"];
const SYNASTRY_ORDER = ["attraction", "communication", "emotional_bond", "friction", "long_term"];
const FORECAST_ORDER = ["theme", "love", "work", "growth", "timeline"];
const ORDER = { natal: NATAL_ORDER, synastry: SYNASTRY_ORDER, forecast: FORECAST_ORDER };
/** A finished detailed analysis (natal or synastry). */
export function AnalysisView({ content, kind = "natal" }: { content: AnalysisContent; kind?: "natal" | "synastry" }) {
const order = kind === "synastry" ? SYNASTRY_ORDER : NATAL_ORDER;
/** A finished detailed analysis (natal, synastry or yearly forecast). */
export function AnalysisView({
content,
kind = "natal",
}: {
content: AnalysisContent;
kind?: "natal" | "synastry" | "forecast";
}) {
const order = ORDER[kind];
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
return (
<article className="analysis">
@@ -28,7 +36,7 @@ export function AnalysisView({ content, kind = "natal" }: { content: AnalysisCon
<div className="analysis-lists">
{content.strengths && content.strengths.length > 0 && (
<section>
<h3>Erősségek</h3>
<h3>{kind === "forecast" ? "Lehetőségek" : "Erősségek"}</h3>
<ul>
{content.strengths.map((t, i) => (
<li key={i}>
@@ -83,7 +83,15 @@ export function arcPath(r1: number, r2: number, from: number, to: number, start:
}
/** The natal chart as a wheel: zodiac, houses, planets and aspect lines. */
export function ChartWheel({ chart, timeKnown }: { chart: ChartResult; timeKnown: boolean }) {
export function ChartWheel({
chart,
timeKnown,
title = "Születési képlet",
}: {
chart: ChartResult;
timeKnown: boolean;
title?: string;
}) {
const angle = (key: string): Position | null => {
const a = chart.angles?.[key];
return typeof a === "object" && a !== null ? a : null;
@@ -128,7 +136,7 @@ export function ChartWheel({ chart, timeKnown }: { chart: ChartResult; timeKnown
role="img"
aria-labelledby="wheel-title wheel-desc"
>
<title id="wheel-title">Születési képlet</title>
<title id="wheel-title">{title}</title>
<desc id="wheel-desc">
{timeKnown && asc ? `Aszcendens ${signName(asc.sign)}. ` : "Születési idő nélkül, házak nélkül. "}
{description}
@@ -16,8 +16,11 @@ const MAX_POLLS = 120; // 10 minutes
type Step = "offer" | "confirm" | "pay";
/** What is analysed: a natal chart, or a comparison of two charts. */
export type AnalysisTarget = { kind: "natal"; chartId: string } | { kind: "synastry"; synastryId: string };
/** What is analysed: a natal chart, a comparison of two charts, or one year of a chart. */
export type AnalysisTarget =
| { kind: "natal"; chartId: string }
| { kind: "synastry"; synastryId: string }
| { kind: "forecast"; forecastId: string };
const TEXTS = {
natal: {
@@ -46,8 +49,32 @@ const TEXTS = {
unitName: "kapcsolati elemzés",
packages: ["addon_synastry", "couple", "family"],
},
forecast: {
eyebrow: "Éves előrejelzés",
title: "Az éved, fejezetekre bontva",
about:
"Kb. 1800 szó öt fejezetben: az év fő témája, kapcsolatok, munka és pénz, belső fejlődés, és negyedévenként az év menete " +
"a fontos dátumokkal. A végén lehetőségek, kihívások és útravaló. Trendekről és lehetőségekről szól, nem jósol meg biztos eseményeket.",
loadingTitle: "Készül az éves előrejelzésed",
loading:
"Most íródik az öt fejezet a szolár képlet, a tranzitok és a progresszió alapján. Ez általában 1–3 perc; nyugodtan elhagyhatod az oldalt, az előrejelzés elkészül és itt vár.",
item: "Részletes éves előrejelzés",
unitName: "előrejelzés",
packages: ["addon_forecast", "couple", "family"],
},
};
function targetPath(target: AnalysisTarget): string {
switch (target.kind) {
case "natal":
return `/charts/${target.chartId}`;
case "synastry":
return `/synastries/${target.synastryId}`;
case "forecast":
return `/forecasts/${target.forecastId}`;
}
}
/**
* The detailed analysis of a chart or a comparison. A saved one is shown at once; otherwise
* the offer: admins start it free, users with units confirm, others pay
@@ -76,7 +103,7 @@ export function DetailedAnalysis({
const [error, setError] = useState<string | null>(null);
const waiting = analysis?.status === "pending" || analysis?.status === "running";
const t = TEXTS[target.kind];
const path = target.kind === "natal" ? `/charts/${target.chartId}` : `/synastries/${target.synastryId}`;
const path = targetPath(target);
useEffect(() => {
if (!waiting || !analysis) return;
@@ -175,7 +202,7 @@ export function DetailedAnalysis({
) : (
<div className="form-actions">
<button type="button" className="btn btn-primary" onClick={() => setStep("confirm")}>
Részletes elemzés kérése
{target.kind === "forecast" ? "Részletes előrejelzés kérése" : "Részletes elemzés kérése"}
</button>
<span className="hint">
Még {left} {t.unitName}ed van.
@@ -198,7 +225,7 @@ export function DetailedAnalysis({
) : (
<div className="form-actions">
<button type="button" className="btn btn-primary" onClick={() => setStep("pay")}>
Részletes elemzés kérése
{target.kind === "forecast" ? "Részletes előrejelzés kérése" : "Részletes elemzés kérése"}
</button>
{target.kind === "natal" && (
<Link href="/pelda" className="btn btn-ghost">
@@ -0,0 +1,295 @@
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<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",
};
const ECLIPSE_TYPES: Record<string, string> = {
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<string, Event[]>();
for (const e of list) {
const key = e.date.slice(0, 7);
months.set(key, [...(months.get(key) ?? []), e]);
}
if (list.length === 0) return <p className="muted">Ebben az évben nincs pontos lassú bolygós fényszög.</p>;
return (
<div className="timeline">
<p className="hint">
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.
</p>
{[...months.entries()].map(([key, items]) => (
<section key={key} className="timeline-month" aria-label={monthTitle(key)}>
<h3>{monthTitle(key)}</h3>
<ol>
{items.map((e, i) => (
<li key={i} className={`timeline-item tone-${e.tone}`}>
<span className="timeline-date">{shortDay(e.date)}</span>
<span className="timeline-glyph" aria-hidden="true">
{e.label}
</span>
<span className="timeline-text">
<strong>{e.title}</strong>
{e.detail.length > 0 && <span className="hint">{e.detail.join(" · ")}</span>}
</span>
</li>
))}
</ol>
</section>
))}
</div>
);
}
/** 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 (
<div className="card" style={{ gap: 12 }}>
<span className="eyebrow">Az év kulcsai</span>
<dl className="facts">
{ascSign && (
<>
<dt>Szolár Aszcendens</dt>
<dd>
{signName(ascSign)}
{solarReturn?.natal_house_of_ascendant ? `, a születési ${solarReturn.natal_house_of_ascendant}. házadban` : ""}
</dd>
</>
)}
{sun?.house && (
<>
<dt>Szolár Nap</dt>
<dd>a {sun.house}. házban: ez az év fő terepe</dd>
</>
)}
{moon?.house && (
<>
<dt>Szolár Hold</dt>
<dd>
{signName(moon.sign)}, a {moon.house}. házban
</dd>
</>
)}
{prof && (
<>
<dt>Az év ura</dt>
<dd>
{pointName(prof.lord)} ({prof.house}. ház, {signName(prof.sign)})
</dd>
</>
)}
{pmoon && (
<>
<dt>Progresszív Hold</dt>
<dd>
{signName(pmoon.sign)}
{pmoon.house ? `, ${pmoon.house}. ház` : ""} ·{" "}
{MOON_PHASES[forecast.progressions.lunar_phase] ?? forecast.progressions.lunar_phase}
{pmoon.approximate ? " (bizonytalan)" : ""}
</dd>
</>
)}
<dt>Tranzitok</dt>
<dd>
{exact} pontos lassú bolygós fényszög, {forecast.eclipses.length} fogyatkozás
</dd>
</dl>
</div>
);
}
/** All slow-planet transits of the year as a list. */
export function ForecastTransits({ forecast }: { forecast: Forecast }) {
if (forecast.transits.length === 0) return <p className="muted">Ebben az évben nincs lassú bolygós tranzit.</p>;
return (
<ul className="transit-list">
{forecast.transits.map((c, i) => (
<li key={i} className={`tone-${toneOf(c)}`}>
<span className="sym" aria-hidden="true">
{glyph(c.planet)} {ASPECTS[c.aspect]?.glyph} {glyph(c.natal_point)}
</span>
<span>
<strong>{contactTitle(c)}</strong>
{c.planet === c.natal_point && <span className="pill">életciklus</span>}
<span className="hint">
{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` : ""}
</span>
</span>
</li>
))}
</ul>
);
}
@@ -14,6 +14,7 @@ export function contents(p: Package): string[] {
const lines: string[] = [];
if (p.natal) lines.push(`${p.natal} részletes képletelemzés`);
if (p.synastry) lines.push(`${p.synastry} kapcsolati elemzés`);
if (p.forecast) lines.push(`${p.forecast} éves előrejelzés`);
if (p.persons) lines.push(`${p.persons} személy felvétele`);
return lines;
}
+100 -1
View File
@@ -32,6 +32,7 @@ export interface Package {
price_huf: number;
natal: number;
synastry: number;
forecast: number;
persons: number;
badge: string | null;
list_price_huf: number;
@@ -58,6 +59,7 @@ export interface BirthChange {
export interface UnitBalance {
natal: number;
synastry: number;
forecast: number;
}
export interface PublicConfig {
@@ -204,7 +206,7 @@ export interface SynastryListItem {
export interface Analysis {
id: string;
kind: "natal" | "synastry" | "summary";
kind: "natal" | "synastry" | "summary" | "forecast";
status: "pending" | "running" | "done" | "failed";
model: string;
language: string;
@@ -338,3 +340,100 @@ export interface InvitationResult {
id?: string;
url?: string;
}
/** A calculated year in a list (`GET /v1/charts/{id}/forecasts`). */
export interface ForecastSummary {
id: string;
chart_id: string;
year: number;
/** First and last day, `YYYY-MM-DD`. */
start: string;
end: string;
place: string | null;
/** Reckoned at the birth place. */
birth_place: boolean;
created_at: string;
}
export interface ForecastList {
/** Years that can be calculated now. */
years: number[];
birth_place: string | null;
time_known: boolean;
forecasts: ForecastSummary[];
}
export interface ForecastExact {
date: string;
retrograde: boolean;
}
/** A transiting or progressed planet in aspect to a natal point. */
export interface ForecastContact {
planet: string;
natal_point: string;
aspect: string;
nature: "harmonious" | "challenging" | "neutral";
exact: ForecastExact[];
periods?: { start: string; end: string }[];
peak: string;
min_orb: number;
house?: number;
}
export interface HouseIngress {
house: number;
date: string;
retrograde: boolean;
}
export interface Forecast {
start: string;
end: string;
age: number;
profection: {
house: number;
sign: string;
lord: string;
lord_sign: string;
lord_house: number;
planets_in_sign: string[];
} | null;
transits: ForecastContact[];
transit_houses: { planet: string; house_at_start: number; ingresses: HouseIngress[] }[];
progressions: {
bodies: (Position & {
planet: string;
house: number | null;
retrograde: boolean;
approximate: boolean;
sign_changes: { sign: string; date: string }[];
house_changes: HouseIngress[];
})[];
lunar_phase: string;
lunar_phase_change: { phase: string; date: string } | null;
contacts: ForecastContact[];
};
eclipses: (Position & {
date: string;
kind: "solar" | "lunar";
eclipse_type: "total" | "annular" | "hybrid" | "partial" | "penumbral";
house: number | null;
contacts: { point: string; aspect: string; orb: number }[];
})[];
warnings?: string[];
}
export type SolarReturn = ChartResult & {
moment_utc: string;
local_time: string;
timezone: string;
utc_offset: string;
natal_house_of_ascendant: number | null;
};
/** One calculated year (`GET /v1/forecasts/{id}`). */
export interface ForecastDetail extends ForecastSummary {
location: { country: string; place?: string; geonames_id?: number } | null;
result: { year: number; solar_return: SolarReturn | null; forecast: Forecast };
}