返回 CodeWhale
layout.tsx
根目录 / web / app / [locale] / docs / layout.tsx
1 import Link from "next/link";
2 import { DocsSidebar } from "@/components/docs-sidebar";
3 import { Whale } from "@/components/whale";
4
5 /* ------------------------------------------------------------------ */
6 /* Layout (Next.js App Router) */
7 /* ------------------------------------------------------------------ */
8
9 export default async function DocsLayout({
10 children,
11 params,
12 }: {
13 children: React.ReactNode;
14 params: Promise<{ locale: string }>;
15 }) {
16 const { locale } = await params;
17 const isZh = locale === "zh";
18
19 return (
20 <div className="docs-theme docs-portal min-h-screen">
21 <section className="docs-portal-hero">
22 <div className="portal-current" aria-hidden="true" />
23 <div className="portal-container docs-portal-hero-inner">
24 <div className="portal-mark">
25 <Whale size={28} />
26 <span>{isZh ? "Codewhale 文档" : "Codewhale documentation"}</span>
27 </div>
28 <h1>{isZh ? "查找准确的使用说明。" : "Find the guidance you need."}</h1>
29 <p>
30 {isZh
31 ? "从新手指引和安装开始,或者直接查找产品名词、模式、权限、工具、提供商、Fleet、钩子、MCP 与运行时 API。这些页面就是正式的产品文档;每页都链接仓库中的源文档,方便查阅完整细节。"
32 : "Start with the getting-started guide and installation, or go straight to vocabulary, modes, permissions, tools, providers, Fleet, hooks, MCP, and the Runtime API. These pages are the product documentation; each one cites the source documents in the repository for full detail."}
33 </p>
34 <div className="portal-actions">
35 <Link href={`/${locale}/install`} className="portal-button portal-button-primary">
36 {isZh ? "安装 Codewhale" : "Install Codewhale"}
37 </Link>
38 <Link
39 href="https://github.com/Hmbown/CodeWhale/tree/main/docs"
40 target="_blank"
41 rel="noreferrer"
42 className="portal-button portal-button-secondary"
43 >
44 {isZh ? "浏览源文档 ↗" : "Browse source docs ↗"}
45 </Link>
46 </div>
47 </div>
48 </section>
49
50 <div className="portal-container docs-shell min-w-0">
51 <article className="docs-content min-w-0">{children}</article>
52 <DocsSidebar locale={locale} />
53 </div>
54 </div>
55 );
56 }
57
57 lines Plain Text