返回 CodeWhale
layout.tsx
根目录 / web / app / [locale] / docs / layout.tsx
1 import { DocsBreadcrumb } from "@/components/docs-breadcrumb";
2 import { DocsHelp } from "@/components/docs-help";
3 import { DocsSidebar } from "@/components/docs-sidebar";
4 import { ReleaseTruth } from "@/components/release-truth";
5 import { Whale } from "@/components/whale";
6 import { BUILD_FACTS, getFactsWithProvenance } from "@/lib/facts";
7 import { getDocsShell } from "@/lib/i18n/dictionaries";
8
9 /* ------------------------------------------------------------------ */
10 /* Layout (Next.js App Router) */
11 /* ------------------------------------------------------------------ */
12
13 /**
14 * The docs shell every documentation URL shares: the portal hero with the
15 * version-aware release-truth line, the breadcrumb + content + sidebar
16 * grid, and the contextual help band that closes each page. All copy is
17 * dictionary-driven; the release line reads the facts layer.
18 */
19 export default async function DocsLayout({
20 children,
21 params,
22 }: {
23 children: React.ReactNode;
24 params: Promise<{ locale: string }>;
25 }) {
26 const { locale } = await params;
27 const t = getDocsShell(locale);
28 // These pages describe THIS build: pin the documented facts to the build
29 // snapshot even when the KV snapshot was written by a newer source (a
30 // rollback, or any deployment sharing it). Only the latest published
31 // release is the KV snapshot's to speak for.
32 const resolution = await getFactsWithProvenance();
33 const facts = {
34 ...BUILD_FACTS,
35 latestPublishedRelease: resolution.facts.latestPublishedRelease,
36 };
37
38 return (
39 <div className="docs-theme docs-portal min-h-screen">
40 <section className="hero">
41 <div className="portal-container docs-portal-band">
42 <div className="portal-mark">
43 <Whale size={28} />
44 <span>{t.portalMark}</span>
45 </div>
46 <ReleaseTruth locale={locale} facts={facts} />
47 </div>
48 </section>
49
50 <div className="portal-container docs-shell min-w-0">
51 <article className="docs-content min-w-0">
52 <DocsBreadcrumb locale={locale} />
53 {children}
54 <DocsHelp locale={locale} />
55 </article>
56 <DocsSidebar locale={locale} />
57 </div>
58 </div>
59 );
60 }
61
61 lines Plain Text