import Link from "next/link";
import { LandingLocaleToggle } from "@/components/landing/LandingLocaleToggle";
import type { LandingLocale } from "@/components/landing/landingLocale";
import {
METHODOLOGY_PAGES,
PUBLIC_CONTENT_COPY,
PUBLIC_BRIEFS,
SOURCE_PAGES,
absolutePublicUrl,
briefPath,
methodologyPath,
sourcePath,
localizeBrief,
localizeBriefs,
localizeMethodologyPage,
localizeSourcePage,
type MethodologyPage,
type PublicBrief,
type SourcePage,
} from "@/content/public-content";
import {
PublicContentAnalytics,
PublicContentCta,
PublicContentOutboundLink,
} from "./PublicContentAnalytics";
const pageShell =
"min-h-screen bg-[#f4f7fb] text-slate-950";
const contentWrap =
"mx-auto flex w-full max-w-6xl flex-col gap-8 px-4 py-6 sm:px-6 lg:px-8";
const panel =
"rounded-lg border border-slate-200 bg-white shadow-[0_1px_3px_rgba(15,23,42,0.05)]";
const sectionTitle =
"text-sm font-semibold uppercase tracking-[0.08em] text-slate-500";
const bodyText = "text-sm leading-6 text-slate-700";
const primaryButton =
"inline-flex min-h-10 items-center justify-center rounded-md bg-slate-950 px-4 py-2 text-sm font-semibold text-white transition hover:bg-slate-800";
const secondaryButton =
"inline-flex min-h-10 items-center justify-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-semibold text-slate-900 transition hover:border-slate-400 hover:bg-slate-50";
function PublicHeader({ locale = "en-US" }: { locale?: LandingLocale }) {
const copy = PUBLIC_CONTENT_COPY[locale];
return (
);
}
function PageIntro({
eyebrow,
title,
description,
}: {
eyebrow: string;
title: string;
description: string;
}) {
return (
);
}
function SourceLinks({ locale = "en-US", slugs }: { locale?: LandingLocale; slugs: string[] }) {
return (
{slugs.map((slug) => {
const source = SOURCE_PAGES.find((entry) => entry.slug === slug);
if (!source) return null;
const localizedSource = localizeSourcePage(source, locale);
return (
{localizedSource.title}
);
})}
);
}
function MethodologyLinks({ locale = "en-US", slugs }: { locale?: LandingLocale; slugs: string[] }) {
return (
{slugs.map((slug) => {
const page = METHODOLOGY_PAGES.find((entry) => entry.slug === slug);
if (!page) return null;
const localizedPage = localizeMethodologyPage(page, locale);
return (
{localizedPage.title}
);
})}
);
}
function BriefCard({
brief,
locale = "en-US",
readBriefLabel,
}: {
brief: PublicBrief;
locale?: LandingLocale;
readBriefLabel: string;
}) {
return (
{brief.cityName} / {brief.date}
{brief.title}
{brief.settlementSource}
{brief.description}
{brief.signals.map((signal) => (
{signal.label}
{signal.value}
{signal.detail}
))}
{readBriefLabel}
);
}
export function BriefsIndexPageView({ locale = "en-US" }: { locale?: LandingLocale }) {
const copy = PUBLIC_CONTENT_COPY[locale];
const briefs = localizeBriefs(locale);
return (
{briefs.map((brief) => (
))}
{copy.methodology}
{copy.methodologyPanelTitle}
{copy.methodologyPanelBody}
{copy.sourceNotes}
{copy.sourcePanelTitle}
{copy.sourcePanelBody}
);
}
export function BriefDetailPageView({
brief,
locale = "en-US",
}: {
brief: PublicBrief;
locale?: LandingLocale;
}) {
const copy = PUBLIC_CONTENT_COPY[locale];
const localizedBrief = localizeBrief(brief, locale);
return (
{localizedBrief.signals.map((signal) => (
{signal.label}
{signal.value}
{signal.detail}
))}
{copy.checksBeforeActing}
{localizedBrief.checkpoints.map((checkpoint) => (
-
{checkpoint}
))}
{copy.distributionCopy}
{localizedBrief.distributionText}
{localizedBrief.notFinancialAdvice}
);
}
function BriefSection({ body, title }: { body: string; title: string }) {
return (
);
}
function InfoRow({ label, value }: { label: string; value: string }) {
return (
{label}
{value}
);
}
export function MethodologyIndexPageView() {
return (
{METHODOLOGY_PAGES.map((page) => (
{formatDate(page.updatedAt)}
{page.title}
{page.description}
Read methodology
))}
);
}
export function MethodologyDetailPageView({ page }: { page: MethodologyPage }) {
return (
{page.summary}
{page.sections.map((section) => (
{section.heading}
{section.body}
{section.bullets.map((bullet) => (
-
{bullet}
))}
))}
);
}
export function SourcesIndexPageView() {
return (
{SOURCE_PAGES.map((source) => (
{source.operator}
{source.title}
{source.description}
Read source note
))}
);
}
export function SourceDetailPageView({ source }: { source: SourcePage }) {
return (
Reliability notes
{source.reliabilityNotes.map((note) => (
-
{note}
))}
);
}
function formatDateTime(value: string, locale: LandingLocale = "en-US") {
return new Intl.DateTimeFormat(locale === "en-US" ? "en" : "zh-CN", {
dateStyle: "medium",
timeStyle: "short",
}).format(new Date(value));
}
function formatDate(value: string) {
return new Intl.DateTimeFormat("en", {
dateStyle: "medium",
}).format(new Date(value));
}