返回 CodeWhale
page.tsx
根目录 / web / app / [locale] / docs / tools / page.tsx
1 import Link from "next/link";
2 import { buildPageMetadata } from "@/lib/page-meta";
3 import { TOOLS_COPY, toolRowsFor, type ToolRow } from "@/lib/content/tools";
4 import type { LocalizedText } from "@/lib/content/vocabulary";
5 import { docsCapabilityContext, publishedDocUrl } from "@/lib/docs-release";
6 import { getChrome, getDocsShell, pickText } from "@/lib/i18n/dictionaries";
7 import { renderInline } from "../_components/doc-article";
8
9 export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
10 const { locale } = await params;
11 return buildPageMetadata({
12 path: "/docs/tools", locale,
13 title: pickText(TOOLS_COPY.metaTitle, locale),
14 description: pickText(TOOLS_COPY.metaDescription, locale),
15 });
16 }
17
18 export default async function ToolsPage({ params }: { params: Promise<{ locale: string }> }) {
19 const { locale } = await params;
20 const t = (copy: LocalizedText) => pickText(copy, locale);
21 const referenceUrl = await publishedDocUrl("docs/TOOL_SURFACE.md");
22 const { body: bodyRows, source: sourceRows, released } = toolRowsFor(await docsCapabilityContext());
23 const lead = released ? TOOLS_COPY.lead : TOOLS_COPY.leadSource;
24 const grid = (rows: readonly ToolRow[]) => (
25 <div className="hairline-t hairline-b mt-6">
26 {rows.map((row) => (
27 <div key={row.name} className="grid md:grid-cols-12 gap-0 hairline-t py-3 px-4 hover:bg-paper-deep transition-colors min-w-0">
28 <div className="md:col-span-3 font-display text-sm font-semibold break-words">{row.name}</div>
29 <div className="md:col-span-9 font-mono text-[0.78rem] text-ink-soft leading-relaxed break-words min-w-0">{t(row.detail)}</div>
30 </div>
31 ))}
32 </div>
33 );
34 return (
35 <section className="space-y-10">
36 <section id="overview" className="scroll-mt-32">
37 <h1 className="font-display text-3xl mb-1">{t(TOOLS_COPY.title)}</h1>
38 <p className="text-ink-soft mt-3 leading-relaxed">{t(lead)}</p>
39 <Link href={referenceUrl} className="body-link">
40 {t(TOOLS_COPY.reference)}
41 </Link>
42 {grid(bodyRows)}
43 </section>
44 {sourceRows.length > 0 && (
45 <section id="in-source" className="scroll-mt-32" data-release-scope="source">
46 <h2 className="font-display text-2xl mb-1">{getChrome(locale).stateInSource}</h2>
47 <p className="text-ink-soft mt-3 leading-relaxed">{renderInline(getDocsShell(locale).sourceLead, locale)}</p>
48 <p className="text-ink-soft mt-3 leading-relaxed">{t(TOOLS_COPY.leadSource)}</p>
49 {grid(sourceRows)}
50 </section>
51 )}
52 <section id="lsp" className="scroll-mt-32">
53 <h2 className="font-display text-2xl mb-1">{t(TOOLS_COPY.lspTitle)}</h2>
54 <p className="text-ink-soft mt-3 leading-relaxed">{t(TOOLS_COPY.lspBody)}</p>
55 <a href="https://github.com/codewhale-hq/CodeWhale/blob/main/docs/LSP_PHP_CUSTOM.md" className="body-link">{t(TOOLS_COPY.lspDocs)}</a>
56 </section>
57 <section id="compatibility" className="scroll-mt-32">
58 <h2 className="font-display text-2xl mb-1">{t(TOOLS_COPY.compatibilityTitle)}</h2>
59 <p className="text-ink-soft mt-3 leading-relaxed">{t(TOOLS_COPY.compatibility)}</p>
60 <Link href="https://github.com/codewhale-hq/CodeWhale/blob/main/docs/RUNTIME_SIMPLIFICATION_DESIGN.md" className="inline-block mt-3 text-xs text-indigo hover:underline">
61 docs/RUNTIME_SIMPLIFICATION_DESIGN.md →
62 </Link>
63 </section>
64 </section>
65 );
66 }
67
67 lines Plain Text