Visitors now get a home page instead of the login: the example chart's wheel coming alive (planets one by one, aspect lines drawn, a slow orbit, a quiet starfield), the free short summary, excerpts of the detailed analysis, the yearly forecast and the relationship comparison, how it works and a closing call. While sign-up is by invitation it says so: the buttons lead to the Google login with an invitation, and others can join the waitlist. Motion is off for reduced-motion users. Logged-in users still go to their chart. Also: the wheel tooltips (planets, aspects, angles) were empty, since React 19 wants plain text inside <title>; they are template strings now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
306 lines
10 KiB
TypeScript
306 lines
10 KiB
TypeScript
import { ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro";
|
|
import type { ChartPoint, ChartResult, InterAspect, Position } from "@/lib/types";
|
|
|
|
import {
|
|
ASPECT_POINTS,
|
|
SIGN_ELEMENT,
|
|
SIGN_ORDER,
|
|
SIZE,
|
|
WHEEL_ASPECTS,
|
|
WHEEL_POINTS,
|
|
arcPath,
|
|
f,
|
|
spread,
|
|
xy,
|
|
} from "./ChartWheel";
|
|
|
|
const C = SIZE / 2;
|
|
const R_LABEL = 322; // ASC / MC labels of the first person
|
|
const R_OUT = 300; // outer edge of the zodiac ring
|
|
const R_ZOD = 262; // inner edge of the zodiac ring
|
|
const R2_GLYPH = 238; // second person: glyphs
|
|
const R2_DEG = 214;
|
|
const R_MID = 198; // border of the two rings
|
|
const R1_GLYPH = 176; // first person: glyphs
|
|
const R1_DEG = 154;
|
|
const R_HOUSE = 138; // house-number ring of the first person
|
|
const R_INNER = 114; // aspect circle
|
|
|
|
const ANGLE_LABELS: [string, string][] = [
|
|
["ascendant", "ASC"],
|
|
["midheaven", "MC"],
|
|
["descendant", "DSC"],
|
|
["imum_coeli", "IC"],
|
|
];
|
|
|
|
function angleOf(chart: ChartResult, key: string): Position | null {
|
|
const a = chart.angles?.[key];
|
|
return typeof a === "object" && a !== null ? a : null;
|
|
}
|
|
|
|
/** One person's planets on a ring: tick on the outer edge, glyph, degree. */
|
|
function Ring({
|
|
points,
|
|
placed,
|
|
edge,
|
|
glyphR,
|
|
degR,
|
|
start,
|
|
who,
|
|
timeKnown,
|
|
className,
|
|
}: {
|
|
points: ChartPoint[];
|
|
placed: number[];
|
|
edge: number;
|
|
glyphR: number;
|
|
degR: number;
|
|
start: number;
|
|
who: string;
|
|
timeKnown: boolean;
|
|
className: string;
|
|
}) {
|
|
return (
|
|
<g className={className}>
|
|
{points.map((p, i) => {
|
|
const [t1x, t1y] = xy(p.longitude, edge, start);
|
|
const [t2x, t2y] = xy(p.longitude, edge - 8, start);
|
|
const [lx, ly] = xy(placed[i], glyphR + 13, start);
|
|
const [gx, gy] = xy(placed[i], glyphR, start);
|
|
const [dx, dy] = xy(placed[i], degR, start);
|
|
const deg = Number.parseInt(p.degree_in_sign_dms, 10);
|
|
return (
|
|
<g key={p.id} className="w-point">
|
|
<title>
|
|
{`${who}: ${pointName(p.id)} ${dms(p.degree_in_sign_dms)} ${signName(p.sign)}${p.retrograde ? ", retrográd" : ""}${
|
|
timeKnown && p.house ? `, ${p.house}. ház` : ""
|
|
}`}
|
|
</title>
|
|
<line x1={f(t1x)} y1={f(t1y)} x2={f(t2x)} y2={f(t2y)} className="w-point-tick" />
|
|
<line x1={f(t2x)} y1={f(t2y)} x2={f(lx)} y2={f(ly)} className="w-leader" />
|
|
<text x={f(gx)} y={f(gy)} className="w-point-glyph" dominantBaseline="central" textAnchor="middle">
|
|
{POINTS[p.id]?.glyph ?? p.id}
|
|
</text>
|
|
<text x={f(dx)} y={f(dy)} className="w-point-deg" dominantBaseline="central" textAnchor="middle">
|
|
{deg}°{p.retrograde ? "℞" : ""}
|
|
</text>
|
|
</g>
|
|
);
|
|
})}
|
|
</g>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Two charts on one wheel: the first person's planets and houses inside, the
|
|
* second person's planets in the outer ring, the aspects between them in the middle.
|
|
*/
|
|
export function SynastryWheel({
|
|
chart1,
|
|
chart2,
|
|
time1,
|
|
time2,
|
|
aspects,
|
|
name1,
|
|
name2,
|
|
}: {
|
|
chart1: ChartResult;
|
|
chart2: ChartResult;
|
|
time1: boolean;
|
|
time2: boolean;
|
|
aspects: InterAspect[];
|
|
name1: string;
|
|
name2: string;
|
|
}) {
|
|
const asc = time1 ? angleOf(chart1, "ascendant") : null;
|
|
const start = asc?.longitude ?? 0;
|
|
const cusps = time1 ? (chart1.houses?.cusps ?? []) : [];
|
|
|
|
const pick = (chart: ChartResult) =>
|
|
WHEEL_POINTS.map((id) => chart.points.find((p) => p.id === id)).filter((p) => p !== undefined);
|
|
const points1 = pick(chart1);
|
|
const points2 = pick(chart2);
|
|
// The inner ring is shorter, so its glyphs need a wider angle.
|
|
const placed1 = spread(
|
|
points1.map((p) => p.longitude),
|
|
12,
|
|
);
|
|
const placed2 = spread(
|
|
points2.map((p) => p.longitude),
|
|
8,
|
|
);
|
|
|
|
const endsOf = (points: ChartPoint[], placed: number[], chart: ChartResult, timeKnown: boolean) => {
|
|
const ends = new Map<string, number>();
|
|
points.forEach((p, i) => {
|
|
if (ASPECT_POINTS.includes(p.id)) ends.set(p.id, placed[i]);
|
|
});
|
|
if (timeKnown) {
|
|
for (const key of ["ascendant", "midheaven"]) {
|
|
const a = angleOf(chart, key);
|
|
if (a) ends.set(key, a.longitude);
|
|
}
|
|
}
|
|
return ends;
|
|
};
|
|
const ends1 = endsOf(points1, placed1, chart1, time1);
|
|
const ends2 = endsOf(points2, placed2, chart2, time2);
|
|
const lines = aspects
|
|
.filter((a) => WHEEL_ASPECTS.includes(a.aspect) && ends1.has(a.person1) && ends2.has(a.person2))
|
|
.map((a) => ({ ...a, strength: a.max_orb > 0 ? 1 - Math.min(a.orb / a.max_orb, 1) : 0.5 }))
|
|
.sort((x, y) => x.strength - y.strength);
|
|
|
|
return (
|
|
<svg className="chart-wheel" viewBox={`0 0 ${SIZE} ${SIZE}`} role="img" aria-labelledby="biwheel-title biwheel-desc">
|
|
<title id="biwheel-title">
|
|
{name1} és {name2} képlete egy körön
|
|
</title>
|
|
<desc id="biwheel-desc">
|
|
Belül {name1} bolygói{time1 ? " és házai" : ""}, kívül {name2} bolygói; középen a kettejük közti főfényszögek.
|
|
</desc>
|
|
|
|
{/* Zodiac ring */}
|
|
<circle cx={C} cy={C} r={R_OUT} className="w-ring" />
|
|
{SIGN_ORDER.map((sign, i) => {
|
|
const [gx, gy] = xy(i * 30 + 15, (R_OUT + R_ZOD) / 2, start);
|
|
return (
|
|
<g key={sign}>
|
|
<path d={arcPath(R_ZOD, R_OUT, i * 30, i * 30 + 30, start)} className={`w-sign w-${SIGN_ELEMENT[i % 4]}`} />
|
|
<text x={f(gx)} y={f(gy)} className="w-sign-glyph" dominantBaseline="central" textAnchor="middle">
|
|
<title>{SIGNS[sign].hu}</title>
|
|
{SIGNS[sign].glyph}
|
|
</text>
|
|
</g>
|
|
);
|
|
})}
|
|
{Array.from({ length: 72 }, (_, k) => {
|
|
const d = k * 5;
|
|
const [x1, y1] = xy(d, R_ZOD, start);
|
|
const [x2, y2] = xy(d, R_ZOD + (d % 10 === 0 ? 8 : 5), start);
|
|
return <line key={d} x1={f(x1)} y1={f(y1)} x2={f(x2)} y2={f(y2)} className="w-tick" />;
|
|
})}
|
|
<circle cx={C} cy={C} r={R_ZOD} className="w-ring" />
|
|
<circle cx={C} cy={C} r={R_MID} className="w-ring w-faint w-p2-band" />
|
|
|
|
{/* The first person's houses */}
|
|
{cusps.length === 12 && (
|
|
<g>
|
|
<circle cx={C} cy={C} r={R_HOUSE} className="w-ring w-faint" />
|
|
{cusps.map((c, i) => {
|
|
const isAngle = i % 3 === 0;
|
|
const [x1, y1] = xy(c.longitude, R_INNER, start);
|
|
const [x2, y2] = xy(c.longitude, isAngle ? R_OUT : R_MID, start);
|
|
const next = cusps[(i + 1) % 12].longitude;
|
|
const mid = c.longitude + ((next - c.longitude + 360) % 360) / 2;
|
|
const [nx, ny] = xy(mid, (R_HOUSE + R_INNER) / 2, start);
|
|
return (
|
|
<g key={c.house}>
|
|
<line x1={f(x1)} y1={f(y1)} x2={f(x2)} y2={f(y2)} className={isAngle ? "w-axis" : "w-cusp"} />
|
|
<text x={f(nx)} y={f(ny)} className="w-house-num" dominantBaseline="central" textAnchor="middle">
|
|
{c.house}
|
|
</text>
|
|
</g>
|
|
);
|
|
})}
|
|
{ANGLE_LABELS.map(([key, label]) => {
|
|
const a = angleOf(chart1, key);
|
|
if (!a) return null;
|
|
const [x, y] = xy(a.longitude, R_LABEL, start);
|
|
return (
|
|
<text key={key} x={f(x)} y={f(y)} className="w-axis-label" dominantBaseline="central" textAnchor="middle">
|
|
<title>{`${name1}: ${pointName(key)} ${dms(a.degree_in_sign_dms)} ${signName(a.sign)}`}</title>
|
|
{label}
|
|
</text>
|
|
);
|
|
})}
|
|
</g>
|
|
)}
|
|
|
|
{/* Aspects between the two */}
|
|
<circle cx={C} cy={C} r={R_INNER} className="w-ring w-inner" />
|
|
{lines.map((a) => {
|
|
const [x1, y1] = xy(ends1.get(a.person1)!, R_INNER, start);
|
|
const [x2, y2] = xy(ends2.get(a.person2)!, R_INNER, start);
|
|
const s = a.strength;
|
|
return (
|
|
<line
|
|
key={`${a.person1}-${a.person2}-${a.aspect}`}
|
|
x1={f(x1)}
|
|
y1={f(y1)}
|
|
x2={f(x2)}
|
|
y2={f(y2)}
|
|
className={`w-aspect w-asp-${a.aspect}`}
|
|
strokeOpacity={(0.2 + 0.8 * s * s).toFixed(2)}
|
|
strokeWidth={(0.6 + 1.9 * s).toFixed(2)}
|
|
>
|
|
<title>
|
|
{`${name1} ${pointName(a.person1)} ${ASPECTS[a.aspect]?.hu ?? a.aspect} ${name2} ${pointName(a.person2)} (orbis ${orbText(a.orb)})`}
|
|
</title>
|
|
</line>
|
|
);
|
|
})}
|
|
{[...ends1].map(([id, lon]) => {
|
|
const [x, y] = xy(lon, R_INNER, start);
|
|
return <circle key={`e1-${id}`} cx={f(x)} cy={f(y)} r={2.2} className="w-end" />;
|
|
})}
|
|
{[...ends2].map(([id, lon]) => {
|
|
const [x, y] = xy(lon, R_INNER, start);
|
|
return <circle key={`e2-${id}`} cx={f(x)} cy={f(y)} r={2.2} className="w-end w-end-p2" />;
|
|
})}
|
|
|
|
<Ring
|
|
points={points1}
|
|
placed={placed1}
|
|
edge={R_MID}
|
|
glyphR={R1_GLYPH}
|
|
degR={R1_DEG}
|
|
start={start}
|
|
who={name1}
|
|
timeKnown={time1}
|
|
className="w-p1"
|
|
/>
|
|
<Ring
|
|
points={points2}
|
|
placed={placed2}
|
|
edge={R_ZOD}
|
|
glyphR={R2_GLYPH}
|
|
degR={R2_DEG}
|
|
start={start}
|
|
who={name2}
|
|
timeKnown={false}
|
|
className="w-p2"
|
|
/>
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
/** Key to the two rings and the aspect lines. */
|
|
export function SynastryLegend({ name1, name2, time1 }: { name1: string; name2: string; time1: boolean }) {
|
|
return (
|
|
<div className="hint wheel-legend">
|
|
<p className="wheel-legend-items">
|
|
<span className="legend-item">
|
|
<span className="legend-dot legend-p1" aria-hidden="true" /> belül: {name1}
|
|
{time1 ? " (bolygók és házak)" : ""}
|
|
</span>
|
|
<span className="legend-item">
|
|
<span className="legend-dot legend-p2" aria-hidden="true" /> kívül: {name2}
|
|
</span>
|
|
</p>
|
|
<p className="wheel-legend-items">
|
|
{[
|
|
["trine", "trigon"],
|
|
["sextile", "szextil"],
|
|
["square", "kvadrát"],
|
|
["opposition", "szembenállás"],
|
|
].map(([aspect, label]) => (
|
|
<span key={aspect} className="legend-item">
|
|
<span className={`legend-line legend-${aspect}`} aria-hidden="true" /> {label}
|
|
</span>
|
|
))}
|
|
</p>
|
|
<p>A vonalak a két fél bolygói közti főfényszögek; vastagabb vonal: szorosabb fényszög. Az összes a táblázatokban.</p>
|
|
</div>
|
|
);
|
|
}
|