Files
sorsfonalak/services/frontend/src/components/AnalysisView.tsx
T
fecoandClaude Opus 5.5 d46cd7a445
CI / test (push) Successful in 1m12s
CI / build (push) Successful in 5m12s
CI / deploy (push) Skipped
Frontend: justified generated text, mobile layout without sideways scrolling
Summaries, analyses and answers are justified with hyphenation in the
text's own language. Grid tracks can no longer grow past the screen
(minmax(0, 1fr), min(…, 100%)), form fields may shrink, the privacy table
scrolls on its own, and the body clips horizontal overflow as a safety net.
Phones get tighter spacing and smaller headings; the facts lists stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-19 06:10:38 +00:00

74 lines
2.3 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"];
const FORECAST_ORDER = ["theme", "love", "work", "growth", "timeline"];
const ORDER = { natal: NATAL_ORDER, synastry: SYNASTRY_ORDER, forecast: FORECAST_ORDER };
/** A finished detailed analysis (natal, synastry or yearly forecast). */
export function AnalysisView({
content,
kind = "natal",
language,
}: {
content: AnalysisContent;
kind?: "natal" | "synastry" | "forecast";
/** The language of the text, for hyphenation. */
language?: string;
}) {
const order = ORDER[kind];
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
return (
<article className="analysis" lang={language}>
<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>{kind === "forecast" ? "Lehetőségek" : "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>
);
}