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:
@@ -22,6 +22,12 @@ const KINDS: { kind: PromptKind; id: string; label: string; about: string }[] =
|
||||
label: "Részletes elemzés",
|
||||
about: "Fizetős, hat fejezet, erősségek, kihívások és útravaló. Kérésre készül.",
|
||||
},
|
||||
{
|
||||
kind: "synastry",
|
||||
id: "kapcsolati",
|
||||
label: "Kapcsolati elemzés",
|
||||
about: "Fizetős összevetés-elemzés két képletről: öt fejezet, erősségek, kihívások és útravaló. Kérésre készül.",
|
||||
},
|
||||
];
|
||||
|
||||
const LANGUAGES: Record<string, string> = { hu: "Magyar", en: "Angol" };
|
||||
|
||||
@@ -6,7 +6,8 @@ import { AnalysisLoading } from "@/components/AnalysisLoading";
|
||||
import { AnalysisView } from "@/components/AnalysisView";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { formatDate } from "@/lib/astro";
|
||||
import type { ChartListItem, PromptKind, PromptPreview } from "@/lib/types";
|
||||
import { listName } from "@/lib/synastry";
|
||||
import type { ChartListItem, PromptKind, PromptPreview, SynastryListItem } from "@/lib/types";
|
||||
|
||||
const POLL_MS = 4000;
|
||||
const MAX_POLLS = 150; // 10 minutes
|
||||
@@ -34,7 +35,23 @@ export function PromptTrial({
|
||||
charts: ChartListItem[];
|
||||
onLoad: (system: string) => void;
|
||||
}) {
|
||||
const synastry = kind === "synastry";
|
||||
const [chartId, setChartId] = useState(charts.find((c) => c.is_primary)?.id ?? charts[0]?.id ?? "");
|
||||
const [synastries, setSynastries] = useState<SynastryListItem[]>([]);
|
||||
const [synastryId, setSynastryId] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (!synastry) return;
|
||||
api<{ synastries: SynastryListItem[] }>("/synastries")
|
||||
.then((d) => {
|
||||
const own = d.synastries.filter((s) => s.owned);
|
||||
setSynastries(own);
|
||||
setSynastryId((current) => current || own[0]?.id || "");
|
||||
})
|
||||
.catch(() => setSynastries([]));
|
||||
}, [synastry]);
|
||||
const targetId = synastry ? synastryId : chartId;
|
||||
const comparisonName = (s: SynastryListItem) => `${listName(s.chart1, charts)} és ${listName(s.chart2, charts)}`;
|
||||
const [trials, setTrials] = useState<Trial[]>([]);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -45,7 +62,7 @@ export function PromptTrial({
|
||||
setError(null);
|
||||
try {
|
||||
const preview = await api<PromptPreview>(`/admin/prompts/${kind}/${language}/preview`, {
|
||||
body: { system: draft, chart_id: chartId },
|
||||
body: synastry ? { system: draft, synastry_id: synastryId } : { system: draft, chart_id: chartId },
|
||||
});
|
||||
setTrials((all) => [{ preview, system: draft }, ...all]);
|
||||
} catch (e) {
|
||||
@@ -66,11 +83,32 @@ export function PromptTrial({
|
||||
<div className="prompt-trial-head">
|
||||
<h2 id={`${selectId}-title`}>Kipróbálás</h2>
|
||||
<p className="hint">
|
||||
A szerkesztőben lévő szöveggel (mentés nélkül is) megírja az elemzést egy saját képletedre. Az eredmény nem
|
||||
kerül a képlethez, csak itt látod. Valódi modellhívás, ezért költsége van.
|
||||
A szerkesztőben lévő szöveggel (mentés nélkül is) megírja az elemzést egy saját{" "}
|
||||
{synastry ? "összevetésedre" : "képletedre"}. Az eredmény nem kerül {synastry ? "az összevetéshez" : "a képlethez"},
|
||||
csak itt látod. Valódi modellhívás, ezért költsége van.
|
||||
</p>
|
||||
</div>
|
||||
{charts.length === 0 ? (
|
||||
{synastry && synastries.length === 0 ? (
|
||||
<p className="muted">
|
||||
Kipróbáláshoz előbb készíts egy összevetést az <a href="/osszevetesek">Összevetések</a> oldalon.
|
||||
</p>
|
||||
) : synastry ? (
|
||||
<div className="prompt-trial-form">
|
||||
<div className="field">
|
||||
<label htmlFor={selectId}>Összevetés</label>
|
||||
<select id={selectId} className="inp" value={synastryId} onChange={(e) => setSynastryId(e.target.value)}>
|
||||
{synastries.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{comparisonName(s)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" className="btn btn-primary" onClick={start} disabled={busy || !targetId || !draft.trim()}>
|
||||
{busy ? "Indítás…" : "Kipróbálás"}
|
||||
</button>
|
||||
</div>
|
||||
) : charts.length === 0 ? (
|
||||
<p className="muted">Kipróbáláshoz előbb legyen legalább egy képleted.</p>
|
||||
) : (
|
||||
<div className="prompt-trial-form">
|
||||
@@ -99,7 +137,14 @@ export function PromptTrial({
|
||||
<TrialResult
|
||||
key={t.preview.id}
|
||||
trial={t}
|
||||
chartLabel={charts.find((c) => c.id === t.preview.chart_id)?.label ?? "Képlet"}
|
||||
chartLabel={
|
||||
t.preview.synastry_id
|
||||
? (() => {
|
||||
const s = synastries.find((x) => x.id === t.preview.synastry_id);
|
||||
return s ? comparisonName(s) : "Összevetés";
|
||||
})()
|
||||
: (charts.find((c) => c.id === t.preview.chart_id)?.label ?? "Képlet")
|
||||
}
|
||||
changed={t.system.trim() !== draft.trim()}
|
||||
onUpdate={update}
|
||||
onLoad={() => onLoad(t.system)}
|
||||
@@ -186,7 +231,7 @@ function TrialResult({
|
||||
<p className="summary-text">{p.content.summary}</p>
|
||||
</div>
|
||||
) : (
|
||||
<AnalysisView content={p.content} />
|
||||
<AnalysisView content={p.content} kind={p.kind === "synastry" ? "synastry" : "natal"} />
|
||||
)
|
||||
) : null}
|
||||
{meta.length > 0 && !waiting && <p className="hint">{meta.join(" · ")}</p>}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
--harmonic: #7fb0e0;
|
||||
--tense: #e38b8b;
|
||||
--square: #f0a35e;
|
||||
--p2: #c3a6f0; /* the second person of a comparison */
|
||||
--radius: 10px;
|
||||
--font-display: var(--font-cormorant), "Cormorant Garamond", Georgia, serif;
|
||||
--font-body: var(--font-inter), Inter, system-ui, sans-serif;
|
||||
@@ -459,3 +460,60 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.prompt-trial-form .field { flex-basis: 100%; }
|
||||
.prompt-trial-form .btn { width: 100%; }
|
||||
}
|
||||
|
||||
/* Comparisons (synastry) */
|
||||
.w-p2 .w-point-glyph { fill: var(--p2); }
|
||||
.w-p2 .w-point-tick { stroke: var(--p2); }
|
||||
.w-p2 .w-point:hover .w-point-glyph { fill: var(--gold); }
|
||||
.w-end-p2 { fill: var(--p2); }
|
||||
.w-p2-band { stroke-dasharray: 2 4; }
|
||||
.legend-dot, .pair-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
|
||||
.legend-p1 { background: var(--ink); }
|
||||
.legend-p2 { background: var(--p2); }
|
||||
.p2-text, .cross-grid th.p2-head { color: var(--p2); }
|
||||
.cross-grid td.cross-corner { position: relative; min-width: 76px; height: 44px; font: 500 11px var(--font-body); color: var(--muted); }
|
||||
.cross-col { position: absolute; top: 2px; right: 4px; color: var(--p2); white-space: nowrap; }
|
||||
.cross-row { position: absolute; bottom: 2px; left: 2px; white-space: nowrap; }
|
||||
|
||||
.nature { display: flex; flex-direction: column; gap: 12px; }
|
||||
.nature-bar { display: flex; gap: 3px; height: 10px; border-radius: 999px; overflow: hidden; }
|
||||
.nature-bar-sm { height: 6px; margin-top: 4px; }
|
||||
.nature-seg { flex-basis: 0; min-width: 4px; }
|
||||
.nature-harmonious { background: var(--harmonic); }
|
||||
.nature-challenging { background: var(--tense); }
|
||||
.nature-neutral { background: var(--gold); }
|
||||
.nature-list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||
.nature-list > div { display: grid; grid-template-columns: 128px 1fr; gap: 8px; align-items: baseline; }
|
||||
.nature-list dt { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
|
||||
.nature-list dd { margin: 0; }
|
||||
.nature-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
||||
|
||||
.pair-card { gap: 4px; }
|
||||
.pair-row {
|
||||
display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0;
|
||||
color: inherit; text-decoration: none; border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.pair-row:last-child { border-bottom: 0; padding-bottom: 0; }
|
||||
a.pair-row:hover strong { color: var(--gold); }
|
||||
.pair-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.pair-text strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
||||
|
||||
.compare-new { gap: 16px; }
|
||||
.compare-form { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 12px; align-items: end; }
|
||||
.compare-swap { font-size: 20px; padding: 0 10px; }
|
||||
.compare-tile { gap: 6px; padding: 16px 20px; }
|
||||
.compare-tile strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
||||
.compare-tile .muted { font-size: 14px; }
|
||||
.compare-tile .form-actions { margin-top: 6px; }
|
||||
.back-link { font-size: 14px; text-decoration: none; align-self: flex-start; }
|
||||
@media (max-width: 640px) {
|
||||
.compare-form { grid-template-columns: 1fr auto; }
|
||||
.compare-form .field:first-child { grid-column: 1; }
|
||||
.compare-swap { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
|
||||
.compare-form .field:nth-child(3) { grid-column: 1; }
|
||||
.compare-form > .btn-primary { grid-column: 1 / -1; width: 100%; }
|
||||
.nature-list > div { grid-template-columns: 1fr; gap: 2px; }
|
||||
.nav { overflow-x: auto; scrollbar-width: none; }
|
||||
.nav a { white-space: nowrap; padding: 10px 9px; }
|
||||
.cross-grid td.cross-corner { min-width: 56px; font-size: 9px; }
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ChartSummary } from "@/components/ChartSummary";
|
||||
import { ChartSwitcher } from "@/components/ChartSwitcher";
|
||||
import { DetailedAnalysis } from "@/components/DetailedAnalysis";
|
||||
import { ChartWheel, WheelLegend } from "@/components/ChartWheel";
|
||||
import { CompareButton } from "@/components/CompareButton";
|
||||
import { Tabs } from "@/components/Tabs";
|
||||
import { ASPECTS, ELEMENTS, MODALITIES, MOON_PHASES, countryName, formatBirthDate, pointName } from "@/lib/astro";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
@@ -31,6 +32,7 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
|
||||
]);
|
||||
const charts = chartList?.charts ?? [];
|
||||
const persons = charts.filter((c) => c.kind === "person");
|
||||
const own = charts.find((c) => c.is_primary) ?? null;
|
||||
if (!chart) notFound();
|
||||
const list = analyses?.analyses ?? [];
|
||||
const summary = list.find((a) => a.kind === "summary" && a.status !== "failed") ?? null;
|
||||
@@ -51,7 +53,7 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
|
||||
<ChartSwitcher
|
||||
title={chart.is_primary ? "Születési képletem" : chart.label}
|
||||
currentId={chart.id}
|
||||
own={charts.find((c) => c.is_primary) ?? null}
|
||||
own={own}
|
||||
persons={persons}
|
||||
canAdd={me.persons.left !== 0}
|
||||
/>
|
||||
@@ -116,6 +118,16 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{!chart.is_primary && own && (
|
||||
<div className="card compare-tile">
|
||||
<span className="eyebrow">Összevetés</span>
|
||||
<strong>Te és {chart.label}</strong>
|
||||
<span className="muted">Két képlet egy körön: mi vonz, hol súrlódtok, és mit ad a kapcsolat.</span>
|
||||
<div className="form-actions">
|
||||
<CompareButton chart1={own.id} chart2={chart.id} label="Összevetés velem" className="btn" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{chart.is_primary && (
|
||||
<Link href="/szemelyek" className="card persons-tile">
|
||||
<span className="eyebrow">Személyek</span>
|
||||
@@ -144,7 +156,7 @@ export default async function ChartPage({ params }: { params: Promise<{ id: stri
|
||||
label: "Elemzés",
|
||||
content: (
|
||||
<DetailedAnalysis
|
||||
chartId={chart.id}
|
||||
target={{ kind: "natal", chartId: chart.id }}
|
||||
initial={detailed}
|
||||
left={me.analyses_left.natal}
|
||||
isAdmin={me.user.roles.includes("admin")}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import { api, errorText } from "@/lib/api";
|
||||
|
||||
/** Deletes a comparison (and its analysis). */
|
||||
export function ComparisonActions({ id, name }: { id: string; name: string }) {
|
||||
const router = useRouter();
|
||||
const [confirm, setConfirm] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
async function remove() {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
await api(`/synastries/${id}`, { method: "DELETE" });
|
||||
router.refresh();
|
||||
} catch (e) {
|
||||
setError(errorText(e));
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="person-actions">
|
||||
{confirm ? (
|
||||
<>
|
||||
<span className="hint">Törlöd a(z) {name} összevetést és az elemzését?</span>
|
||||
<button type="button" className="btn btn-sm btn-danger" onClick={remove} disabled={busy}>
|
||||
{busy ? "Törlés…" : "Igen, törlöm"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-ghost" onClick={() => setConfirm(false)} disabled={busy}>
|
||||
Mégse
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<button type="button" className="btn btn-sm btn-ghost" onClick={() => setConfirm(true)}>
|
||||
Törlés
|
||||
</button>
|
||||
)}
|
||||
{error && (
|
||||
<p className="msg msg-error" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
||||
import { CompareButton } from "@/components/CompareButton";
|
||||
import { sideName } from "@/lib/synastry";
|
||||
import type { ChartListItem } from "@/lib/types";
|
||||
|
||||
/** Picks two of the user's charts to compare. */
|
||||
export function NewComparison({ charts }: { charts: ChartListItem[] }) {
|
||||
const own = charts.find((c) => c.is_primary);
|
||||
const [first, setFirst] = useState(own?.id ?? charts[0]?.id ?? "");
|
||||
const [second, setSecond] = useState(charts.find((c) => c.id !== (own?.id ?? charts[0]?.id))?.id ?? "");
|
||||
|
||||
if (charts.length < 2) {
|
||||
return (
|
||||
<section className="card compare-new" aria-labelledby="compare-title">
|
||||
<h2 id="compare-title">Új összevetés</h2>
|
||||
<p className="muted">
|
||||
Összevetéshez legalább két képlet kell. Vedd fel társad, családtagod vagy barátod születési adatait, és nézd meg,
|
||||
hogyan hatnak egymásra a képleteitek.
|
||||
</p>
|
||||
<div className="form-actions">
|
||||
<Link href="/szemelyek/uj" className="btn btn-primary">
|
||||
Új személy felvétele
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const option = (c: ChartListItem) => (
|
||||
<option key={c.id} value={c.id}>
|
||||
{sideName(c)}
|
||||
{c.birth.time ? "" : " (idő nélkül)"}
|
||||
</option>
|
||||
);
|
||||
const swap = () => {
|
||||
setFirst(second);
|
||||
setSecond(first);
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="card compare-new" aria-labelledby="compare-title">
|
||||
<h2 id="compare-title">Új összevetés</h2>
|
||||
<div className="compare-form">
|
||||
<div className="field">
|
||||
<label htmlFor="compare-first">Első fél</label>
|
||||
<select id="compare-first" className="inp" value={first} onChange={(e) => setFirst(e.target.value)}>
|
||||
{charts.map(option)}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" className="btn btn-ghost compare-swap" onClick={swap} aria-label="A két fél felcserélése">
|
||||
⇄
|
||||
</button>
|
||||
<div className="field">
|
||||
<label htmlFor="compare-second">Második fél</label>
|
||||
<select id="compare-second" className="inp" value={second} onChange={(e) => setSecond(e.target.value)}>
|
||||
{charts.map(option)}
|
||||
</select>
|
||||
</div>
|
||||
{first && second && first !== second ? (
|
||||
<CompareButton chart1={first} chart2={second} label="Összevetés" className="btn btn-primary" />
|
||||
) : (
|
||||
<button type="button" className="btn btn-primary" disabled>
|
||||
Összevetés
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<p className="hint">
|
||||
{first === second
|
||||
? "Két különböző képletet válassz."
|
||||
: "A körön az első fél képlete és házai vannak belül, a második fél bolygói kívül."}
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
|
||||
import { formatDate } from "@/lib/astro";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import { listName } from "@/lib/synastry";
|
||||
import type { ChartListItem, SynastryListItem } from "@/lib/types";
|
||||
|
||||
import { ComparisonActions } from "./ComparisonActions";
|
||||
import { NewComparison } from "./NewComparison";
|
||||
|
||||
export const metadata: Metadata = { title: "Összevetések" };
|
||||
|
||||
/** The user's comparisons, and a form for a new one. */
|
||||
export default async function ComparisonsPage() {
|
||||
await requireMe("/osszevetesek");
|
||||
const [chartList, synastryList] = await Promise.all([
|
||||
backendGet<{ charts: ChartListItem[] }>("/v1/charts"),
|
||||
backendGet<{ synastries: SynastryListItem[] }>("/v1/synastries"),
|
||||
]);
|
||||
const charts = chartList?.charts ?? [];
|
||||
const synastries = synastryList?.synastries ?? [];
|
||||
|
||||
return (
|
||||
<main className="page" style={{ maxWidth: 1080 }}>
|
||||
<div className="page-head">
|
||||
<h1>Összevetések</h1>
|
||||
<p className="muted">
|
||||
Két képlet egymásra vetítve: mi vonz, hol súrlódtok, és mit ad a kapcsolat. A saját és a felvett személyek
|
||||
képletei közül bármelyik kettőt összevetheted.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<NewComparison charts={charts} />
|
||||
|
||||
{synastries.length > 0 && (
|
||||
<section className="field" aria-labelledby="list-title" style={{ gap: 12 }}>
|
||||
<h2 id="list-title">Korábbi összevetések</h2>
|
||||
<div className="chart-cards">
|
||||
{synastries.map((s) => {
|
||||
const name = `${listName(s.chart1, charts)} és ${listName(s.chart2, charts)}`;
|
||||
const n = s.summary?.by_nature;
|
||||
const total = s.summary?.aspect_count || 1;
|
||||
return (
|
||||
<div key={s.id} className="chart-card">
|
||||
<Link href={`/osszevetesek/${s.id}`} className="chart-card-link">
|
||||
<strong className="chart-card-name">{name}</strong>
|
||||
<span className="muted">{formatDate(s.created_at)}</span>
|
||||
{n && (
|
||||
<>
|
||||
<span className="nature-bar nature-bar-sm" aria-hidden="true">
|
||||
<span className="nature-seg nature-harmonious" style={{ flexGrow: n.harmonious / total }} />
|
||||
<span className="nature-seg nature-challenging" style={{ flexGrow: n.challenging / total }} />
|
||||
<span className="nature-seg nature-neutral" style={{ flexGrow: n.neutral / total }} />
|
||||
</span>
|
||||
<span className="hint">
|
||||
{n.harmonious} harmonikus · {n.challenging} feszültebb · {n.neutral} együttállás
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</Link>
|
||||
{s.owned && <ComparisonActions id={s.id} name={name} />}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ export default async function PersonsPage() {
|
||||
]);
|
||||
const charts = list?.charts ?? [];
|
||||
const persons = charts.filter((c) => c.kind === "person");
|
||||
const ownId = charts.find((c) => c.is_primary)?.id ?? null;
|
||||
const isAdmin = me.user.roles.includes("admin");
|
||||
const slots = me.persons;
|
||||
const full = slots.left === 0;
|
||||
@@ -28,8 +29,8 @@ export default async function PersonsPage() {
|
||||
<div className="page-head">
|
||||
<h1>Személyek</h1>
|
||||
<p className="muted">
|
||||
Társad, családtagjaid, barátaid képlete. Mindegyikhez kérhetsz részletes elemzést, és a képletoldal címére
|
||||
kattintva válthatsz köztük.
|
||||
Társad, családtagjaid, barátaid képlete. Mindegyikhez kérhetsz részletes elemzést, összevetheted a sajátoddal,
|
||||
és a képletoldal címére kattintva válthatsz köztük.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -39,6 +40,7 @@ export default async function PersonsPage() {
|
||||
<PersonActions
|
||||
id={p.id}
|
||||
name={p.label}
|
||||
ownId={ownId}
|
||||
editable={isAdmin || (p.editable_until !== null && Date.parse(p.editable_until) > now)}
|
||||
/>
|
||||
</ChartCard>
|
||||
|
||||
Reference in New Issue
Block a user