63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
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"];
|
||
|
|
|
||
|
|
/** A finished detailed analysis (natal or synastry). */
|
||
|
|
export function AnalysisView({ content, kind = "natal" }: { content: AnalysisContent; kind?: "natal" | "synastry" }) {
|
||
|
|
const order = kind === "synastry" ? SYNASTRY_ORDER : NATAL_ORDER;
|
||
|
|
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>
|
||
|
|
<h3>Erősségek</h3>
|
||
|
|
<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>
|
||
|
|
);
|
||
|
|
}
|