Comparisons (synastry) of the own chart and persons
/osszevetesek compares any two of the user's charts (own and persons); the person card and the person's chart page have "Összevetés velem". The comparison page shows a double wheel (first person inside with houses, second outside, aspects between them), the aspects by character, and tabs: paid relationship analysis (synastry unit), the cross aspect grid, house overlays, composite and the full aspect list. Correcting a person within the hour now deletes the user's own comparisons with them instead of being refused; still refused after a paid analysis or when someone else's comparison uses the chart. The relationship analysis prompt is editable on /admin/promptok too, and can be tried on one of the admin's comparisons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,314 @@
|
||||
import { ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro";
|
||||
import type { HouseOverlay, InterAspect, Synastry, SynastryResult } from "@/lib/types";
|
||||
|
||||
import { GRID_POINTS, Pos } from "./ChartTables";
|
||||
|
||||
const NATURES: { key: keyof SynastryResult["summary"]["by_nature"]; label: string; hint: string }[] = [
|
||||
{ key: "harmonious", label: "Harmonikus", hint: "trigon, szextil: ami könnyen megy köztetek" },
|
||||
{ key: "challenging", label: "Feszültebb", hint: "kvadrát, szembenállás: súrlódás, de mozgatóerő is" },
|
||||
{ key: "neutral", label: "Együttállás", hint: "összeolvadás: erős, a bolygóktól függő hatás" },
|
||||
];
|
||||
|
||||
/** The inter-chart aspects by character, as a bar and counts. */
|
||||
export function NatureBar({ summary }: { summary: SynastryResult["summary"] }) {
|
||||
const total = summary.aspect_count || 1;
|
||||
return (
|
||||
<div className="nature">
|
||||
<div className="nature-bar" aria-hidden="true">
|
||||
{NATURES.map((n) => (
|
||||
<span
|
||||
key={n.key}
|
||||
className={`nature-seg nature-${n.key}`}
|
||||
style={{ flexGrow: summary.by_nature[n.key] / total }}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<dl className="nature-list">
|
||||
{NATURES.map((n) => (
|
||||
<div key={n.key}>
|
||||
<dt>
|
||||
<span className={`nature-dot nature-${n.key}`} aria-hidden="true" /> {n.label}
|
||||
</dt>
|
||||
<dd>
|
||||
<strong>{summary.by_nature[n.key]}</strong> <span className="hint">{n.hint}</span>
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const GRID_ANGLES: [string, string][] = [
|
||||
["ascendant", "AC"],
|
||||
["midheaven", "MC"],
|
||||
];
|
||||
|
||||
function gridPoints(s: Synastry["chart1"]): [string, string][] {
|
||||
const present = new Set(s.chart.points.map((p) => p.id));
|
||||
const rows: [string, string][] = GRID_POINTS.filter((id) => present.has(id)).map((id) => [id, POINTS[id]?.glyph ?? id]);
|
||||
if (s.highlights.time_known) {
|
||||
for (const [key, label] of GRID_ANGLES) if (s.chart.angles?.[key]) rows.push([key, label]);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/** The aspects between the two charts: the first person in the rows, the second in the columns. */
|
||||
export function CrossGrid({ synastry, name1, name2 }: { synastry: Synastry; name1: string; name2: string }) {
|
||||
const rows = gridPoints(synastry.chart1);
|
||||
const cols = gridPoints(synastry.chart2);
|
||||
const byPair = new Map<string, InterAspect>();
|
||||
for (const a of synastry.synastry.aspects) byPair.set(`${a.person1}|${a.person2}`, a);
|
||||
const label = ([id, text]: [string, string], who: string) => (
|
||||
<span className={text.length > 2 ? "sym" : "grid-angle"} aria-label={`${who}: ${pointName(id)}`} role="img">
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="aspect-grid-wrap">
|
||||
<table className="aspect-grid cross-grid" aria-label={`Fényszögek: sorokban ${name1}, oszlopokban ${name2}`}>
|
||||
<thead>
|
||||
<tr>
|
||||
<td className="corner cross-corner">
|
||||
<span className="cross-col">{name2} →</span>
|
||||
<span className="cross-row">↓ {name1}</span>
|
||||
</td>
|
||||
{cols.map((c) => (
|
||||
<th key={c[0]} scope="col" title={`${name2}: ${pointName(c[0])}`} className="p2-head">
|
||||
{label(c, name2)}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => {
|
||||
const [id] = row;
|
||||
return (
|
||||
<tr key={id}>
|
||||
<th scope="row" title={`${name1}: ${pointName(id)}`}>
|
||||
{label(row, name1)}
|
||||
</th>
|
||||
{cols.map(([other]) => {
|
||||
const a = byPair.get(`${id}|${other}`);
|
||||
const info = a ? ASPECTS[a.aspect] : undefined;
|
||||
const text = a
|
||||
? `${name1} ${pointName(id)} ${info?.hu ?? a.aspect} ${name2} ${pointName(other)}, orbis ${orbText(a.orb)}`
|
||||
: undefined;
|
||||
return (
|
||||
<td key={other} title={text}>
|
||||
{a && (
|
||||
<span className={`sym asp asp-${a.aspect}`} aria-label={text} role="img">
|
||||
{info?.glyph ?? "?"}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function OverlayTable({ title, overlays, missing }: { title: string; overlays: HouseOverlay[] | null; missing: string }) {
|
||||
return (
|
||||
<div className="table-wrap">
|
||||
<h3 style={{ marginBottom: 8 }}>{title}</h3>
|
||||
{overlays ? (
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Pont</th>
|
||||
<th scope="col">Jegy</th>
|
||||
<th scope="col">Ház</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{overlays.map((o) => (
|
||||
<tr key={o.point}>
|
||||
<td>
|
||||
<span className="sym" aria-hidden="true">
|
||||
{POINTS[o.point]?.glyph}
|
||||
</span>{" "}
|
||||
{pointName(o.point)}
|
||||
</td>
|
||||
<td>
|
||||
<span className="sym" aria-hidden="true">
|
||||
{SIGNS[o.sign]?.glyph}
|
||||
</span>{" "}
|
||||
{signName(o.sign)}
|
||||
</td>
|
||||
<td className="num">{o.house}.</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<p className="muted">{missing}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Each person's points in the other's houses (needs the other's birth time). */
|
||||
export function HouseOverlays({ synastry, name1, name2 }: { synastry: Synastry; name1: string; name2: string }) {
|
||||
const o = synastry.synastry.house_overlays;
|
||||
return (
|
||||
<div className="field" style={{ gap: 16 }}>
|
||||
<p className="hint">
|
||||
Melyik életterületét érinti a másik: az egyik fél bolygói a másik házaiban. Ehhez a ház „gazdájának” pontos
|
||||
születési ideje kell.
|
||||
</p>
|
||||
<div className="grid-2" style={{ alignItems: "start" }}>
|
||||
<OverlayTable
|
||||
title={`${name2} bolygói ${name1} házaiban`}
|
||||
overlays={o.person2_in_person1}
|
||||
missing={`${name1} születési ideje ismeretlen, ezért a házai nem számolhatók.`}
|
||||
/>
|
||||
<OverlayTable
|
||||
title={`${name1} bolygói ${name2} házaiban`}
|
||||
overlays={o.person1_in_person2}
|
||||
missing={`${name2} születési ideje ismeretlen, ezért a házai nem számolhatók.`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** The composite chart (midpoints of the two charts). */
|
||||
export function CompositeTables({ synastry }: { synastry: Synastry }) {
|
||||
const c = synastry.synastry.composite;
|
||||
const hasHouses = Boolean(c.houses);
|
||||
const angles = (
|
||||
[
|
||||
["ascendant", "ASC"],
|
||||
["midheaven", "MC"],
|
||||
] as const
|
||||
).filter(([key]) => c.angles?.[key]);
|
||||
const aspects = [...c.aspects].filter((a) => a.orb <= 3).sort((a, b) => a.orb - b.orb);
|
||||
return (
|
||||
<div className="field" style={{ gap: 16 }}>
|
||||
<p className="hint">
|
||||
A kompozit képlet a két képlet felezőpontjaiból áll: a kapcsolatot mint önálló harmadik „személyt” írja le.
|
||||
{!c.angles && " Tengelyek és házak nélkül, mert legalább az egyik születési idő ismeretlen."}
|
||||
</p>
|
||||
<div className="grid-2" style={{ alignItems: "start" }}>
|
||||
<div className="table-wrap">
|
||||
<h3 style={{ marginBottom: 8 }}>Pontok</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Pont</th>
|
||||
<th scope="col">Pozíció</th>
|
||||
{hasHouses && <th scope="col">Ház</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{c.points.map((p) => (
|
||||
<tr key={p.id}>
|
||||
<td>
|
||||
<span className="sym" aria-hidden="true">
|
||||
{POINTS[p.id]?.glyph}
|
||||
</span>{" "}
|
||||
{pointName(p.id)}
|
||||
</td>
|
||||
<td className="num">
|
||||
<Pos p={p} />
|
||||
</td>
|
||||
{hasHouses && <td className="num">{p.house ? `${p.house}.` : "–"}</td>}
|
||||
</tr>
|
||||
))}
|
||||
{angles.map(([key, label]) => (
|
||||
<tr key={key}>
|
||||
<td>{label}</td>
|
||||
<td className="num">
|
||||
{dms(c.angles![key].degree_in_sign_dms)} <span className="sym">{SIGNS[c.angles![key].sign]?.glyph}</span>{" "}
|
||||
{signName(c.angles![key].sign)}
|
||||
</td>
|
||||
{hasHouses && <td />}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="table-wrap">
|
||||
<h3 style={{ marginBottom: 8 }}>Szoros fényszögek</h3>
|
||||
{aspects.length === 0 ? (
|
||||
<p className="muted">Nincs 3°-nál szorosabb fényszög.</p>
|
||||
) : (
|
||||
<table>
|
||||
<tbody>
|
||||
{aspects.map((a) => (
|
||||
<tr key={`${a.point1}-${a.point2}-${a.aspect}`}>
|
||||
<td>
|
||||
{pointName(a.point1)} <AspectTag aspect={a.aspect} /> {pointName(a.point2)}
|
||||
</td>
|
||||
<td className="num">{orbText(a.orb)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AspectTag({ aspect }: { aspect: string }) {
|
||||
const info = ASPECTS[aspect];
|
||||
return (
|
||||
<span className={`aspect-tag aspect-${info?.kind ?? "neutral"}`}>
|
||||
<span className="sym" aria-hidden="true">
|
||||
{info?.glyph}
|
||||
</span>{" "}
|
||||
{info?.hu ?? aspect}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Every aspect between the two charts, closest first. */
|
||||
export function InterAspectList({ synastry, name1, name2 }: { synastry: Synastry; name1: string; name2: string }) {
|
||||
const aspects = [...synastry.synastry.aspects].sort((a, b) => a.orb - b.orb);
|
||||
if (aspects.length === 0) return <p className="muted">Nincs fényszög a két képlet között.</p>;
|
||||
return (
|
||||
<div className="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{name1}</th>
|
||||
<th scope="col">Fényszög</th>
|
||||
<th scope="col">{name2}</th>
|
||||
<th scope="col">Orbisz</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{aspects.map((a) => (
|
||||
<tr key={`${a.person1}-${a.person2}-${a.aspect}`}>
|
||||
<td>
|
||||
<span className="sym" aria-hidden="true">
|
||||
{POINTS[a.person1]?.glyph}
|
||||
</span>{" "}
|
||||
{pointName(a.person1)}
|
||||
</td>
|
||||
<td>
|
||||
<AspectTag aspect={a.aspect} />
|
||||
</td>
|
||||
<td>
|
||||
<span className="sym p2-text" aria-hidden="true">
|
||||
{POINTS[a.person2]?.glyph}
|
||||
</span>{" "}
|
||||
{pointName(a.person2)}
|
||||
</td>
|
||||
<td className="num">{orbText(a.orb)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user