import React from "react"; interface AboutMarkdownSectionProps { content: string; title?: string; locale?: string; ctaHref?: string; ctaLabel?: string; fullHeight?: boolean; } export function AboutMarkdownSection({ content, title, locale = "zh-CN", ctaHref, ctaLabel, fullHeight = false, }: AboutMarkdownSectionProps) { if (!content) { return null; } const isEnglish = locale === "en"; const defaultTitle = isEnglish ? "About Henggan" : "关于衡感智能"; const defaultCtaLabel = isEnglish ? "Download Solution" : "下载了解方案"; const coreKeyword = isEnglish ? "Core Positioning:" : "核心定位"; const rawParagraphs = content .split(/\r?\n+/) .map((paragraph) => paragraph.trim()) .filter(Boolean); const paragraphs = rawParagraphs.filter( (paragraph, index) => rawParagraphs.indexOf(paragraph) === index, ); if (paragraphs.length === 0) { return null; } const [headline, ...rest] = paragraphs; const coreIndex = rest.findIndex((item) => item.startsWith(coreKeyword)); let coreLine: string | undefined; let coreDescription: string | undefined; if (coreIndex >= 0) { // 提取核心定位行 coreLine = rest[coreIndex]; // 提取核心定位后面的描述文本(如果有的话) if (coreIndex + 1 < rest.length) { const nextParagraph = rest[coreIndex + 1]; if (nextParagraph && !nextParagraph.startsWith(coreKeyword)) { coreDescription = nextParagraph; // 移除核心定位行和描述文本 rest.splice(coreIndex, 2); } else { // 只移除核心定位行 rest.splice(coreIndex, 1); } } else { // 只移除核心定位行 rest.splice(coreIndex, 1); } } // 如果没有找到描述文本,使用默认的 if (!coreDescription) { coreDescription = isEnglish ? "Through the synergy of AI perception, intelligent hardware, and digital twins, urban structures can have continuously evolving self-defense capabilities, building an integrated safety decision-making closed loop." : "通过 AI 感知、智能硬件与数字孪生协同,让城市结构具备持续演化的自我防御能力,构建一体化的安全决策闭环。"; } const heightClass = fullHeight ? "min-h-[calc(100vh-4rem)] md:min-h-[calc(100vh-6rem)]" : ""; return (

{title ?? defaultTitle}

{headline}

{rest.map((paragraph, index) => (

{paragraph}

))}
{coreLine && (
Vision

{coreLine}

{coreDescription && (

{coreDescription}

)}
)}
{ctaHref && (
{ctaLabel ?? defaultCtaLabel} AI City Safety Initiative
)}
); }