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:
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { ApiError, api, errorText } from "@/lib/api";
|
||||
@@ -24,9 +23,8 @@ export function BirthForm({
|
||||
}: {
|
||||
initial: Initial;
|
||||
onCancel?: () => void;
|
||||
onSaved: () => void;
|
||||
onSaved: (chartId: string) => void;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [date, setDate] = useState(initial?.date ?? "");
|
||||
const [time, setTime] = useState(initial?.time?.slice(0, 5) ?? "");
|
||||
const [timeUnknown, setTimeUnknown] = useState(initial ? !initial.time : false);
|
||||
@@ -56,7 +54,7 @@ export function BirthForm({
|
||||
if (!place) return setError("Válaszd ki a születési helyet a listából.");
|
||||
setBusy(true);
|
||||
try {
|
||||
await api("/charts", {
|
||||
const saved = await api<{ id: string }>("/charts", {
|
||||
body: {
|
||||
label: "Saját képlet",
|
||||
is_primary: true,
|
||||
@@ -69,8 +67,7 @@ export function BirthForm({
|
||||
},
|
||||
},
|
||||
});
|
||||
onSaved();
|
||||
router.refresh();
|
||||
onSaved(saved.id);
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.code === "ambiguous_local_time") {
|
||||
setAmbiguous(true);
|
||||
|
||||
Reference in New Issue
Block a user