2026-11-16 17:39:15 +00:00
|
|
|
import type { AnalysisContent } from "@/lib/types";
|
|
|
|
|
|
|
|
|
|
import { Paragraphs, Rich } from "./Rich";
|
|
|
|
|
|
|
|
|
|
const NATAL_ORDER = ["personality", "emotions", "mind", "love", "work", "growth"];
|
|
|
|
|
const SYNASTRY_ORDER = ["attraction", "communication", "emotional_bond", "friction", "long_term"];
|
2026-11-18 08:19:13 +00:00
|
|
|
const FORECAST_ORDER = ["theme", "love", "work", "growth", "timeline"];
|
|
|
|
|
const ORDER = { natal: NATAL_ORDER, synastry: SYNASTRY_ORDER, forecast: FORECAST_ORDER };
|
2026-11-16 17:39:15 +00:00
|
|
|
|
2026-11-18 08:19:13 +00:00
|
|
|
/** A finished detailed analysis (natal, synastry or yearly forecast). */
|
|
|
|
|
export function AnalysisView({
|
|
|
|
|
content,
|
|
|
|
|
kind = "natal",
|
|
|
|
|
}: {
|
|
|
|
|
content: AnalysisContent;
|
|
|
|
|
kind?: "natal" | "synastry" | "forecast";
|
|
|
|
|
}) {
|
|
|
|
|
const order = ORDER[kind];
|
2026-11-16 17:39:15 +00:00
|
|
|
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
|
|
|
|
|
return (
|
|
|
|
|
<article className="analysis">
|
|
|
|
|
<header className="analysis-head">
|
|
|
|
|
<h2>{content.title}</h2>
|
|
|
|
|
{content.summary && (
|
|
|
|
|
<p className="analysis-lead">
|
|
|
|
|
<Rich text={content.summary} />
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</header>
|
|
|
|
|
{sections.map((s, i) => (
|
|
|
|
|
<section key={i} className="analysis-section">
|
|
|
|
|
<h3>{s.title}</h3>
|
|
|
|
|
<Paragraphs text={s.body} />
|
|
|
|
|
</section>
|
|
|
|
|
))}
|
|
|
|
|
<div className="analysis-lists">
|
|
|
|
|
{content.strengths && content.strengths.length > 0 && (
|
|
|
|
|
<section>
|
2026-11-18 08:19:13 +00:00
|
|
|
<h3>{kind === "forecast" ? "Lehetőségek" : "Erősségek"}</h3>
|
2026-11-16 17:39:15 +00:00
|
|
|
<ul>
|
|
|
|
|
{content.strengths.map((t, i) => (
|
|
|
|
|
<li key={i}>
|
|
|
|
|
<Rich text={t} />
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
|
|
|
|
{content.challenges && content.challenges.length > 0 && (
|
|
|
|
|
<section>
|
|
|
|
|
<h3>Kihívások</h3>
|
|
|
|
|
<ul>
|
|
|
|
|
{content.challenges.map((t, i) => (
|
|
|
|
|
<li key={i}>
|
|
|
|
|
<Rich text={t} />
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
{content.advice && (
|
|
|
|
|
<section className="analysis-section analysis-advice">
|
|
|
|
|
<h3>Útravaló</h3>
|
|
|
|
|
<Paragraphs text={content.advice} />
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
|
|
|
|
</article>
|
|
|
|
|
);
|
|
|
|
|
}
|