返回 CodeWhale
page.tsx
根目录 / web / app / [locale] / docs / guide / page.tsx
1 import Link from "next/link";
2 import { GettingStartedSteps } from "@/components/getting-started-steps";
3 import { SessionFrames, type SessionFrame } from "@/components/route/session-frames";
4 import { TerminalCapture } from "@/components/terminal-capture";
5 import { GUIDE_NEXT_LINKS } from "@/lib/content/getting-started";
6 import { getDocsGuide, getHome, pickText } from "@/lib/i18n/dictionaries";
7 import { RELEASED_CAPTURE_FRAMES } from "@/lib/released-capture.generated";
8 import { buildPageMetadata } from "@/lib/page-meta";
9 import { getNativeTerminalCopy } from "@/lib/content/native-terminal";
10
11 export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
12 const { locale } = await params;
13 const t = getDocsGuide(locale);
14 return buildPageMetadata({
15 path: "/docs/guide",
16 locale,
17 title: t.metaTitle,
18 description: t.metaDescription,
19 });
20 }
21
22 export default async function GuidePage({ params }: { params: Promise<{ locale: string }> }) {
23 const { locale } = await params;
24 const t = getDocsGuide(locale);
25 const terminal = getNativeTerminalCopy(locale);
26 const home = getHome(locale);
27 const views: SessionFrame[] = terminal.views.map((view) => ({
28 key: view.id,
29 name: view.label,
30 wide: (
31 <TerminalCapture
32 data={RELEASED_CAPTURE_FRAMES[view.wide]}
33 label={view.description}
34 regionLabel={`${home.shotPreview} · ${view.label}`}
35 rows={"wideRows" in view ? view.wideRows : undefined}
36 />
37 ),
38 narrow: (
39 <TerminalCapture
40 data={RELEASED_CAPTURE_FRAMES[view.narrow]}
41 label={view.description}
42 regionLabel={`${home.shotPreview} · ${view.label}`}
43 rows={"narrowRows" in view ? view.narrowRows : undefined}
44 />
45 ),
46 note: false,
47 }));
48
49 return (
50 <section className="space-y-10">
51 <section id="overview" className="scroll-mt-32">
52 <h1 className="font-display text-3xl mb-1">{t.overviewTitle}</h1>
53 <p className={`${t.bodyClassName} mt-3`}>{t.overviewLead}</p>
54 </section>
55
56 <section id="path" className="scroll-mt-32">
57 <GettingStartedSteps locale={locale} headingLevel={2} />
58 </section>
59
60 <section id="terminal-views" className="scroll-mt-32">
61 <h2 className="font-display text-2xl mb-1">{terminal.title}</h2>
62 <p className={`${t.bodyClassName} mt-3 mb-4`}>{terminal.description}</p>
63 <SessionFrames frames={views} initial={views.length - 2} label={terminal.viewsLabel} caption={null} note="" />
64 </section>
65
66 <section id="next" className="scroll-mt-32">
67 <h2 className="font-display text-2xl mb-1">{t.nextTitle}</h2>
68 <div className="hairline-t mt-4">
69 {GUIDE_NEXT_LINKS.map((item) => (
70 <div key={item.href} className="py-4 hairline-b">
71 <h3 className="font-display text-xl">
72 <Link href={`/${locale}${item.href}`} className="hover:text-indigo transition-colors">
73 {pickText(item.label, locale)}
74 </Link>
75 </h3>
76 <p className={`${t.bodyClassName} mt-1 text-sm`}>{pickText(item.note, locale)}</p>
77 </div>
78 ))}
79 </div>
80 </section>
81
82 {/* Maintainer pointer: kept out of the rendered copy (experience mark 5). */}
83 <div hidden data-source-note={t.sourceNote} />
84 </section>
85 );
86 }
87
87 lines Plain Text