/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
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { useState } from "react";
|
|
|
|
import { api, errorText } from "@/lib/api";
|
|
|
|
/** Compares two charts (or opens their existing comparison). */
|
|
export function CompareButton({
|
|
chart1,
|
|
chart2,
|
|
label = "Összevetés velem",
|
|
className = "btn btn-sm btn-ghost",
|
|
}: {
|
|
chart1: string;
|
|
chart2: string;
|
|
label?: string;
|
|
className?: string;
|
|
}) {
|
|
const router = useRouter();
|
|
const [busy, setBusy] = useState(false);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
async function compare() {
|
|
setBusy(true);
|
|
setError(null);
|
|
try {
|
|
const s = await api<{ id: string }>("/synastries", { body: { chart1_id: chart1, chart2_id: chart2 } });
|
|
router.push(`/osszevetesek/${s.id}`);
|
|
} catch (e) {
|
|
setError(errorText(e));
|
|
setBusy(false);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<button type="button" className={className} onClick={compare} disabled={busy}>
|
|
{busy ? "Számolás…" : label}
|
|
</button>
|
|
{error && (
|
|
<p className="msg msg-error" role="alert">
|
|
{error}
|
|
</p>
|
|
)}
|
|
</>
|
|
);
|
|
}
|