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,5 +1,7 @@
"use client";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { countryName, formatBirthDate } from "@/lib/astro";
@@ -17,8 +19,9 @@ export interface SavedBirth {
dst: boolean;
}
/** Shows the saved birth data (and the chart tables), or the form to enter or correct it. */
export function BirthEditor({ chart, children }: { chart: SavedBirth | null; children: React.ReactNode }) {
/** Shows the saved birth data, or the form to enter or correct it. Saving opens the chart page. */
export function BirthEditor({ chart, chartId }: { chart: SavedBirth | null; chartId: string | null }) {
const router = useRouter();
const [editing, setEditing] = useState(chart === null);
if (editing || !chart) {
@@ -38,7 +41,7 @@ export function BirthEditor({ chart, children }: { chart: SavedBirth | null; chi
<BirthForm
initial={chart ? { ...chart.birth, placeName: chart.placeName, region: chart.region } : null}
onCancel={chart ? () => setEditing(false) : undefined}
onSaved={() => setEditing(false)}
onSaved={(id) => router.push(`/kepletek/${id}`)}
/>
</div>
);
@@ -47,7 +50,7 @@ export function BirthEditor({ chart, children }: { chart: SavedBirth | null; chi
const { birth } = chart;
const country = chart.countryCode ?? birth.country;
return (
<div className="field" style={{ gap: 24 }}>
<div className="field">
<div className="card-head" style={{ alignItems: "flex-start" }}>
<dl className="facts">
<dt>Dátum</dt>
@@ -73,11 +76,17 @@ export function BirthEditor({ chart, children }: { chart: SavedBirth | null; chi
{country && <span className="muted">, {countryName(country)}</span>}
</dd>
</dl>
<button type="button" className="btn" onClick={() => setEditing(true)}>
Adatok javítása
</button>
<div className="row">
{chartId && (
<Link href={`/kepletek/${chartId}`} className="btn btn-primary">
Képlet megnyitása
</Link>
)}
<button type="button" className="btn" onClick={() => setEditing(true)}>
Adatok javítása
</button>
</div>
</div>
{children}
</div>
);
}