Free birth chart instead of the sign calculator; free tools in the header
CI / test (push) Successful in 1m44s
CI / build (push) Successful in 5m37s
CI / deploy (push) Skipped

/szuletesi-horoszkop (was /aszcendens-kalkulator) shows the whole natal
chart without an account: the wheel, Sun/Moon/Ascendant with links to
the sign pages, the positions, houses, aspect grid and aspect list, the
same views as the chart pages but without the AI parts. A calculation
only, nothing saved, still 30 an hour per address (POST /v1/public/chart).
The typed birth data are offered on the profile after sign-up.

The visitors' header gets a separate 'Ingyenes' group (birth chart,
signs) next to the paid sections, on phones in its own row; the home
page links them under the hero buttons and in an 'Ingyenes' band.

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-21 20:54:57 +00:00
co-authored by Claude Opus 5.5
parent 2eea1042a5
commit 985b1e872d
15 changed files with 363 additions and 169 deletions
+47 -1
View File
@@ -4,7 +4,7 @@ import { useEffect, useId, useMemo, useRef, useState } from "react";
import { ApiError, api, errorText } from "@/lib/api";
import { countryName } from "@/lib/astro";
import { MONTHS, composeDate, composeTime, daysIn } from "@/lib/birth";
import { BIRTH_DRAFT_KEY, type BirthDraft, MONTHS, composeDate, composeTime, daysIn } from "@/lib/birth";
import type { BirthData, Country, Place } from "@/lib/types";
type Initial = (BirthData & { placeName: string | null; region: string | null }) | null;
@@ -61,6 +61,37 @@ export function BirthForm({
const [error, setError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
const today = useMemo(() => new Date().toISOString().slice(0, 10), []);
const [fromDraft, setFromDraft] = useState(false);
// The own birth data, not given yet: offer what the visitor typed into the
// public birth chart page before signing up.
useEffect(() => {
if (initial || person) return;
let draft: BirthDraft | null = null;
try {
draft = JSON.parse(localStorage.getItem(BIRTH_DRAFT_KEY) ?? "null");
} catch {
return;
}
if (!draft || !/^\d{4}-\d{2}-\d{2}$/.test(draft.date) || !draft.geonames_id) return;
setYear(draft.date.slice(0, 4));
setMonth(String(Number(draft.date.slice(5, 7))));
setDay(String(Number(draft.date.slice(8, 10))));
if (draft.time) {
setHour(draft.time.slice(0, 2));
setMinute(draft.time.slice(3, 5));
}
setTimeUnknown(!draft.time);
setCountry(draft.country);
setPlace({
geonames_id: draft.geonames_id,
name: draft.placeName,
region: draft.region,
population: null,
country_code: draft.country,
});
setFromDraft(true);
}, [initial, person]);
async function submit(e: React.FormEvent) {
e.preventDefault();
@@ -100,6 +131,11 @@ export function BirthForm({
? { label: name.trim(), is_primary: false, birth }
: { label: "Saját képlet", is_primary: true, birth },
});
try {
localStorage.removeItem(BIRTH_DRAFT_KEY);
} catch {
// storage blocked
}
onSaved(saved.id);
} catch (err) {
if (err instanceof ApiError && err.code === "ambiguous_local_time") {
@@ -117,6 +153,11 @@ export function BirthForm({
return (
<form onSubmit={submit} className="field" style={{ gap: 18 }} noValidate>
{fromDraft && (
<p className="msg msg-ok" style={{ margin: 0 }}>
Áthoztuk az adatokat, amelyeket a születési horoszkópnál megadtál. Ellenőrizd, és mentsd el.
</p>
)}
{person && (
<div className="field" style={{ maxWidth: 420 }}>
<label htmlFor="person-name">Név</label>
@@ -346,6 +387,11 @@ export function PlaceSearch({
setResults([]);
}, [country]);
// A place set from outside (e.g. brought over from the public chart page) shows its name.
useEffect(() => {
if (value) setQuery((q) => (q === value.name ? q : value.name));
}, [value]);
useEffect(() => {
const q = query.trim();
if (q.length < 2 || (value && value.name === query)) {