Chart page with a drawn wheel; reuse saved charts for identical birth data

- New /kepletek/[id] page: chart wheel (SVG), big three, elements,
  modalities, moon phase, positions and an aspects table. /keplet opens
  the user's own chart; the home page goes there after login.
- The profile only shows the birth data, with a link to the chart.
- Saving the same birth data again returns the stored chart (200)
  instead of calculating a new one.
- Charts without a birth time (angles null) render without houses.

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-16 06:37:59 +00:00
co-authored by Claude Opus 5.5
parent 1f177f859e
commit e789e5a981
15 changed files with 675 additions and 93 deletions
@@ -1,4 +1,4 @@
import { ANGLES, POINTS, SIGNS, dms, signName } from "@/lib/astro";
import { ANGLES, ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro";
import type { Chart, Position } from "@/lib/types";
function Pos({ p }: { p: Position }) {
@@ -9,45 +9,55 @@ function Pos({ p }: { p: Position }) {
);
}
/** The big three and the positions of a natal chart. */
/** 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 (
<div className="big3">
<div>
<span className="muted">Nap</span>
<span className="glyph sym">{SIGNS[chart.highlights.sun ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.sun)}</strong>
{sun && <span className="muted num">{dms(sun.degree_in_sign_dms)}</span>}
</div>
<div>
<span className="muted">Hold{!timeKnown && " (közelítő)"}</span>
<span className="glyph sym">{SIGNS[chart.highlights.moon ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.moon)}</strong>
{moon && <span className="muted num">{dms(moon.degree_in_sign_dms)}</span>}
</div>
<div>
<span className="muted">Aszcendens</span>
{timeKnown ? (
<>
<span className="glyph sym">{SIGNS[chart.highlights.ascendant ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.ascendant)}</strong>
{typeof asc === "object" && asc && <span className="muted num">{dms(asc.degree_in_sign_dms)}</span>}
</>
) : (
<strong className="muted">–</strong>
)}
</div>
</div>
);
}
/** Positions, angles, house cusps and aspects of a natal chart. */
export function ChartTables({ 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(
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;
const sun = result.points.find((p) => p.id === "sun");
const moon = result.points.find((p) => p.id === "moon");
const aspects = [...(result.aspects ?? [])].sort((a, b) => a.orb - b.orb);
return (
<div className="field" style={{ gap: 24 }}>
<div className="big3">
<div>
<span className="muted">Nap</span>
<span className="glyph sym">{SIGNS[chart.highlights.sun ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.sun)}</strong>
{sun && <span className="muted num">{dms(sun.degree_in_sign_dms)}</span>}
</div>
<div>
<span className="muted">Hold{!timeKnown && " (közelítő)"}</span>
<span className="glyph sym">{SIGNS[chart.highlights.moon ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.moon)}</strong>
{moon && <span className="muted num">{dms(moon.degree_in_sign_dms)}</span>}
</div>
<div>
<span className="muted">Aszcendens</span>
{timeKnown ? (
<>
<span className="glyph sym">{SIGNS[chart.highlights.ascendant ?? ""]?.glyph}</span>
<strong>{signName(chart.highlights.ascendant)}</strong>
</>
) : (
<strong className="muted">–</strong>
)}
</div>
</div>
<div className="grid-2" style={{ alignItems: "start" }}>
<div className="table-wrap">
<h3 style={{ marginBottom: 8 }}>Bolygók és pontok</h3>
@@ -129,6 +139,51 @@ export function ChartTables({ chart }: { chart: Chart }) {
</div>
)}
</div>
{aspects.length > 0 && (
<div className="table-wrap">
<h3 style={{ marginBottom: 8 }}>Fényszögek</h3>
<table>
<thead>
<tr>
<th scope="col">Fényszög</th>
<th scope="col">Orbisz</th>
<th scope="col">
<span className="sr-only">Közeledő vagy távolodó</span>
</th>
</tr>
</thead>
<tbody>
{aspects.map((a) => {
const info = ASPECTS[a.aspect];
return (
<tr key={`${a.point1}-${a.point2}-${a.aspect}`}>
<td>
<span className="sym" aria-hidden="true">
{POINTS[a.point1]?.glyph}
</span>{" "}
{pointName(a.point1)}{" "}
<span className={`aspect-tag aspect-${info?.kind ?? "neutral"}`}>
<span className="sym" aria-hidden="true">
{info?.glyph}
</span>{" "}
{info?.hu ?? a.aspect}
</span>{" "}
<span className="sym" aria-hidden="true">
{POINTS[a.point2]?.glyph}
</span>{" "}
{pointName(a.point2)}
</td>
<td className="num">{orbText(a.orb)}</td>
<td className="muted" style={{ fontSize: 13 }}>
{a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""}
</td>
</tr>
);
})}
</tbody>
</table>
</div>
)}
{!timeKnown && (
<p className="hint">
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