import Link from "next/link";
import { LandingLocaleToggle } from "@/components/landing/LandingLocaleToggle";
import { landingLocaleHref, 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({
locale = "en-US",
}: {
locale?: LandingLocale;
} = {}) {
const copy = PUBLIC_CONTENT_COPY[locale];
const pages = METHODOLOGY_PAGES.map((page) => localizeMethodologyPage(page, locale));
return (
{pages.map((page) => (
{formatDate(page.updatedAt, locale)}
{page.title}
{page.description}
{copy.readMethodology}
))}
);
}
export function MethodologyDetailPageView({
page,
locale = "en-US",
}: {
page: MethodologyPage;
locale?: LandingLocale;
}) {
const copy = PUBLIC_CONTENT_COPY[locale];
const localizedPage = localizeMethodologyPage(page, locale);
return (
{localizedPage.summary}
{localizedPage.sections.map((section) => (
{section.heading}
{section.body}
{section.bullets.map((bullet) => (
-
{bullet}
))}
))}
);
}
export function SourcesIndexPageView({
locale = "en-US",
}: {
locale?: LandingLocale;
} = {}) {
const copy = PUBLIC_CONTENT_COPY[locale];
const sources = SOURCE_PAGES.map((source) => localizeSourcePage(source, locale));
return (
{sources.map((source) => (
{source.operator}
{source.title}
{source.description}
{copy.readSourceNote}
))}
);
}
export function SourceDetailPageView({
source,
locale = "en-US",
}: {
source: SourcePage;
locale?: LandingLocale;
}) {
const localizedSource = localizeSourcePage(source, locale);
const labels =
locale === "en-US"
? {
cadence: "Cadence",
coverage: "Coverage",
operator: "Operator",
reliability: "Reliability notes",
relatedMethodology: "Related methodology",
settlementUse: "Settlement use",
sourceNote: "Source note",
}
: {
cadence: "频率",
coverage: "覆盖范围",
operator: "运营方",
reliability: "可靠性备注",
relatedMethodology: "相关方法",
settlementUse: "结算用途",
sourceNote: "来源说明",
};
return (
{labels.reliability}
{localizedSource.reliabilityNotes.map((note) => (
-
{note}
))}
{labels.relatedMethodology}
);
}
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, locale: LandingLocale = "en-US") {
return new Intl.DateTimeFormat(locale === "en-US" ? "en" : "zh-CN", {
dateStyle: "medium",
}).format(new Date(value));
}