Files
sorsfonalak/services/frontend/src/app/osszevetesek/NewComparison.tsx
T
fecoandClaude Opus 5.5 0bd5c39080
CI / test (push) Successful in 45s
CI / build (push) Successful in 4m19s
CI / deploy (push) Skipped
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
2026-11-17 16:04:44 +00:00

79 lines
2.8 KiB
TypeScript

"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>
);
}