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,166 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { SignTrio } from "@/components/ChartCard";
|
||||
import { DetailedAnalysis } from "@/components/DetailedAnalysis";
|
||||
import { CompositeTables, CrossGrid, HouseOverlays, InterAspectList, NatureBar } from "@/components/SynastryTables";
|
||||
import { SynastryLegend, SynastryWheel } from "@/components/SynastryWheel";
|
||||
import { Tabs } from "@/components/Tabs";
|
||||
import { ASPECTS, formatBirthDate } from "@/lib/astro";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import { sideName, sideTimeKnown } from "@/lib/synastry";
|
||||
import type { Analysis, ChartListItem, PublicConfig, Synastry, SynastrySide } from "@/lib/types";
|
||||
|
||||
export const metadata: Metadata = { title: "Összevetés" };
|
||||
|
||||
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
const GRID_LEGEND = ["conjunction", "sextile", "square", "trine", "opposition"];
|
||||
|
||||
function Person({ side, which }: { side: SynastrySide; which: "p1" | "p2" }) {
|
||||
const time = sideTimeKnown(side);
|
||||
const birth = side.birth_data;
|
||||
const name = sideName(side);
|
||||
const body = (
|
||||
<>
|
||||
<span className={`pair-dot legend-${which}`} aria-hidden="true" />
|
||||
<span className="pair-text">
|
||||
<strong>{name}</strong>
|
||||
{birth && (
|
||||
<span className="hint">
|
||||
{formatBirthDate(birth.date)}
|
||||
{time && birth.time ? `, ${birth.time.slice(0, 5)}` : ", ismeretlen időpont"}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{side.highlights && (
|
||||
<SignTrio chart={{ highlights: { ...side.highlights, time_known: time } } as ChartListItem} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
return side.owned ? (
|
||||
<Link href={`/kepletek/${side.id}`} className="pair-row">
|
||||
{body}
|
||||
</Link>
|
||||
) : (
|
||||
<div className="pair-row">{body}</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** One comparison of two charts: the double wheel, the numbers, the analysis and the tables. */
|
||||
export default async function ComparisonPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const me = await requireMe(`/osszevetesek/${id}`);
|
||||
if (!UUID.test(id)) notFound();
|
||||
const [synastry, analyses, config] = await Promise.all([
|
||||
backendGet<Synastry>(`/v1/synastries/${id}`),
|
||||
backendGet<{ analyses: Analysis[] }>(`/v1/synastries/${id}/analyses`),
|
||||
backendGet<PublicConfig>("/v1/config"),
|
||||
]);
|
||||
if (!synastry) notFound();
|
||||
const list = analyses?.analyses ?? [];
|
||||
const detailed = list.find((a) => a.status !== "failed") ?? list[0] ?? null;
|
||||
|
||||
const { chart1, chart2 } = synastry;
|
||||
const name1 = sideName(chart1);
|
||||
const name2 = sideName(chart2);
|
||||
const time1 = sideTimeKnown(chart1);
|
||||
const time2 = sideTimeKnown(chart2);
|
||||
const result = synastry.synastry;
|
||||
const unknown = [!time1 && name1, !time2 && name2].filter(Boolean);
|
||||
|
||||
return (
|
||||
<main className="page" style={{ maxWidth: 1180 }}>
|
||||
<div className="page-head">
|
||||
<Link href="/osszevetesek" className="back-link">
|
||||
← Összevetések
|
||||
</Link>
|
||||
<h1>
|
||||
{name1} és {name2}
|
||||
</h1>
|
||||
<p className="muted">Összevetés · két képlet egymásra vetítve</p>
|
||||
</div>
|
||||
|
||||
<section className="chart-layout" aria-label="Kettős képletrajz">
|
||||
<div className="card chart-wheel-card">
|
||||
<SynastryWheel
|
||||
chart1={chart1.chart}
|
||||
chart2={chart2.chart}
|
||||
time1={time1}
|
||||
time2={time2}
|
||||
aspects={result.aspects}
|
||||
name1={name1}
|
||||
name2={name2}
|
||||
/>
|
||||
<SynastryLegend name1={name1} name2={name2} time1={time1} />
|
||||
</div>
|
||||
<div className="field chart-side">
|
||||
<div className="card pair-card">
|
||||
<span className="eyebrow">A két fél</span>
|
||||
<Person side={chart1} which="p1" />
|
||||
<Person side={chart2} which="p2" />
|
||||
</div>
|
||||
<div className="card summary-card">
|
||||
<span className="eyebrow">Számokban</span>
|
||||
<h2 className="summary-title">{result.summary.aspect_count} fényszög köztetek</h2>
|
||||
<NatureBar summary={result.summary} />
|
||||
{unknown.length > 0 && (
|
||||
<p className="hint">
|
||||
{unknown.join(" és ")} születési ideje ismeretlen: az ő tengelyei és házai kimaradnak, a Hold helyzete
|
||||
közelítő.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="card chart-tabs" aria-label="Elemzés és táblázatok">
|
||||
<Tabs
|
||||
label="Összevetés részletei"
|
||||
tabs={[
|
||||
{
|
||||
id: "elemzes",
|
||||
label: "Elemzés",
|
||||
content: (
|
||||
<DetailedAnalysis
|
||||
target={{ kind: "synastry", synastryId: synastry.id }}
|
||||
initial={detailed}
|
||||
left={me.analyses_left.synastry}
|
||||
isAdmin={me.user.roles.includes("admin")}
|
||||
canPay={config?.mock_payments ?? false}
|
||||
note={`Az elemzésben az első fél: ${name1}, a második fél: ${name2}.`}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "fenyszogek",
|
||||
label: "Fényszögek",
|
||||
content: (
|
||||
<div className="field" style={{ gap: 16 }}>
|
||||
<CrossGrid synastry={synastry} name1={name1} name2={name2} />
|
||||
<ul className="grid-legend" aria-label="Jelmagyarázat">
|
||||
{GRID_LEGEND.map((k) => (
|
||||
<li key={k}>
|
||||
<span className={`sym asp asp-${k}`} aria-hidden="true">
|
||||
{ASPECTS[k]?.glyph}
|
||||
</span>{" "}
|
||||
{ASPECTS[k]?.hu}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{ id: "hazak", label: "Házak", content: <HouseOverlays synastry={synastry} name1={name1} name2={name2} /> },
|
||||
{ id: "kompozit", label: "Kompozit", content: <CompositeTables synastry={synastry} /> },
|
||||
{
|
||||
id: "reszletek",
|
||||
label: "Részletek",
|
||||
content: <InterAspectList synastry={synastry} name1={name1} name2={name2} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user