import { ANGLES, ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro";
import type { Aspect, Chart, Position } from "@/lib/types";
export function Pos({ p }: { p: Position }) {
return (
<>
{dms(p.degree_in_sign_dms)} {SIGNS[p.sign]?.glyph} {signName(p.sign)}
>
);
}
/** Sun, Moon and Ascendant signs. */
export function BigThree({ chart }: { chart: Chart }) {
const result = chart.chart;
const timeKnown = chart.highlights.time_known;
const sun = result.points.find((p) => p.id === "sun");
const moon = result.points.find((p) => p.id === "moon");
const asc = result.angles?.ascendant;
return (
Nap
{SIGNS[chart.highlights.sun ?? ""]?.glyph}
{signName(chart.highlights.sun)}
{sun && {dms(sun.degree_in_sign_dms)}}
Hold{!timeKnown && " (közelítő)"}
{SIGNS[chart.highlights.moon ?? ""]?.glyph}
{signName(chart.highlights.moon)}
{moon && {dms(moon.degree_in_sign_dms)}}
Aszcendens
{timeKnown ? (
<>
{SIGNS[chart.highlights.ascendant ?? ""]?.glyph}
{signName(chart.highlights.ascendant)}
{typeof asc === "object" && asc && {dms(asc.degree_in_sign_dms)}}
>
) : (
–
)}
);
}
// Rows and columns of the aspect grid: the points drawn on the wheel, then the angles.
export const GRID_POINTS = [
"sun",
"moon",
"mercury",
"venus",
"mars",
"jupiter",
"saturn",
"uranus",
"neptune",
"pluto",
"north_node",
"lilith",
"chiron",
];
const GRID_ANGLES: [string, string][] = [
["ascendant", "AC"],
["midheaven", "MC"],
];
/** The aspect grid: a square matrix with the points on both sides, only the aspect symbols in it. */
export function AspectGrid({ chart }: { chart: Chart }) {
const result = chart.chart;
const present = new Set(result.points.map((p) => p.id));
const rows: [string, string][] = GRID_POINTS.filter((id) => present.has(id)).map((id) => [
id,
POINTS[id]?.glyph ?? id,
]);
if (chart.highlights.time_known) {
for (const [key, label] of GRID_ANGLES) if (result.angles?.[key]) rows.push([key, label]);
}
const byPair = new Map();
for (const a of result.aspects ?? []) {
byPair.set(`${a.point1}|${a.point2}`, a);
byPair.set(`${a.point2}|${a.point1}`, a);
}
const label = ([id, text]: [string, string]) => (
2 ? "sym" : "grid-angle"} aria-label={pointName(id)} role="img">
{text}
);
return (
|
{rows.map((c) => (
{label(c)}
|
))}
{rows.map((row) => {
const [id] = row;
return (
|
{label(row)}
|
{rows.map(([other]) => {
if (other === id) return | ;
const a = byPair.get(`${id}|${other}`);
const info = a ? ASPECTS[a.aspect] : undefined;
const text = a ? `${pointName(id)} ${info?.hu ?? a.aspect} ${pointName(other)}` : undefined;
return (
{a && (
{info?.glyph ?? "?"}
)}
|
);
})}
);
})}
);
}
/** Positions, angles and house cusps of a natal chart. */
export function PositionTables({ chart }: { chart: Chart }) {
const result = chart.chart;
const timeKnown = chart.highlights.time_known;
const angles = ANGLES.map(([key, label]) => [label, result.angles?.[key]] as const).filter(
(a): a is readonly [string, Position] => typeof a[1] === "object" && a[1] !== null,
);
const fortune = result.lots?.fortune;
return (
Bolygók és pontok
| Pont |
Pozíció |
{timeKnown && Ház | }
{result.points.map((p) => (
|
{POINTS[p.id]?.glyph}
{" "}
{POINTS[p.id]?.hu ?? p.id}
{p.retrograde && (
R
)}
|
|
{timeKnown && {p.house ? `${p.house}.` : "–"} | }
))}
{timeKnown && fortune && (
| Szerencsepont |
|
{fortune.house ? `${fortune.house}.` : "–"} |
)}
{timeKnown && (
Tengelyek
{angles.map(([label, p]) => (
| {label} |
|
))}
{result.houses && (
Házcsúcsok (Placidus)
{result.houses.cusps.map((c) => (
| {c.house}. ház |
|
))}
)}
)}
{!timeKnown && (
Születési idő nélkül a házak, a tengelyek és az Aszcendens nem számolhatók; a Hold helyzete a nap folyamán akár
jegyet is válthat, ezért közelítő.
)}
);
}
/** Every aspect with its orb and whether it is applying, closest first. */
export function AspectList({ chart }: { chart: Chart }) {
const aspects = [...(chart.chart.aspects ?? [])].sort((a, b) => a.orb - b.orb);
if (aspects.length === 0) return Nincs fényszög.
;
return (
| Fényszög |
Orbisz |
Közeledő vagy távolodó
|
{aspects.map((a) => {
const info = ASPECTS[a.aspect];
return (
|
{POINTS[a.point1]?.glyph}
{" "}
{pointName(a.point1)}{" "}
{info?.glyph}
{" "}
{info?.hu ?? a.aspect}
{" "}
{POINTS[a.point2]?.glyph}
{" "}
{pointName(a.point2)}
|
{orbText(a.orb)} |
{a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""}
|
);
})}
);
}