| 1 | import Link from "next/link"; |
| 2 | import { Icon } from "@/components/icon"; |
| 3 | import { PageHeader, Section } from "@/components/page-header"; |
| 4 | import { Status } from "@/components/status-badge"; |
| 5 | import { CONSTITUTION_LAYERS } from "@/lib/content/constitution"; |
| 6 | import { ThinkingTrace } from "@/components/thinking-trace"; |
| 7 | import { getConstitution, pickText } from "@/lib/i18n/dictionaries"; |
| 8 | import { buildPageMetadata } from "@/lib/page-meta"; |
| 9 | |
| 10 | export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) { |
| 11 | const { locale } = await params; |
| 12 | const t = getConstitution(locale); |
| 13 | return buildPageMetadata({ |
| 14 | path: "/docs/constitution", |
| 15 | locale, |
| 16 | title: t.metaTitle, |
| 17 | description: t.metaDescription, |
| 18 | }); |
| 19 | } |
| 20 | |
| 21 | export default async function ConstitutionPage({ params }: { params: Promise<{ locale: string }> }) { |
| 22 | const { locale } = await params; |
| 23 | const han = locale === "zh"; |
| 24 | const t = getConstitution(locale); |
| 25 | |
| 26 | return ( |
| 27 | <> |
| 28 | <PageHeader |
| 29 | titleId="constitution-overview" |
| 30 | seal={han ? "法" : undefined} |
| 31 | kicker={t.kicker} |
| 32 | title={t.title} |
| 33 | titleAside={han ? t.titleAside : undefined} |
| 34 | titleAsideLang={han ? t.titleAsideLang : undefined} |
| 35 | lede={t.lede} |
| 36 | pose="read" |
| 37 | > |
| 38 | <div className="callout"> |
| 39 | <p className="callout-title"> |
| 40 | <Status tone="accent">{t.since}</Status> |
| 41 | </p> |
| 42 | <p>{t.sinceBody}</p> |
| 43 | </div> |
| 44 | </PageHeader> |
| 45 | |
| 46 | <div className="page-body"> |
| 47 | <Section |
| 48 | id="constitution-rank" |
| 49 | seal={han ? "序" : undefined} |
| 50 | title={t.rankTitle} |
| 51 | scope={t.rankScope} |
| 52 | > |
| 53 | <ol className="steps"> |
| 54 | {CONSTITUTION_LAYERS.map((layer, index) => ( |
| 55 | <li key={layer.n}> |
| 56 | <span className="gs-step-index" aria-hidden="true">{index + 1}</span> |
| 57 | <h3>{pickText(layer.name, locale)}</h3> |
| 58 | <p className="dir-meta">{pickText(layer.path, locale)}</p> |
| 59 | <p>{pickText(layer.body, locale)}</p> |
| 60 | </li> |
| 61 | ))} |
| 62 | </ol> |
| 63 | <div className="callout mt-5"> |
| 64 | <p className="callout-title"> |
| 65 | <Icon name="shield" className="icon" /> |
| 66 | {t.boundaryTitle} |
| 67 | </p> |
| 68 | <p>{t.boundaryBody}</p> |
| 69 | </div> |
| 70 | </Section> |
| 71 | |
| 72 | <Section |
| 73 | id="constitution-trace" |
| 74 | seal={han ? "证" : undefined} |
| 75 | title={t.traceTitle} |
| 76 | scope={t.traceScope} |
| 77 | > |
| 78 | <ThinkingTrace locale={locale} /> |
| 79 | </Section> |
| 80 | |
| 81 | <section id="constitution-next" className="page-section"> |
| 82 | <div className="actions"> |
| 83 | <Link href={`/${locale}/install`} className="btn btn-primary btn-lg"> |
| 84 | {t.install} |
| 85 | </Link> |
| 86 | <Link |
| 87 | href="https://github.com/codewhale-hq/CodeWhale/blob/main/docs/CONFIGURATION.md#constitution-project-instructions-and-repo-authority" |
| 88 | className="btn btn-ghost btn-lg" |
| 89 | > |
| 90 | {t.configuration} |
| 91 | <Icon name="external" className="icon" /> |
| 92 | </Link> |
| 93 | </div> |
| 94 | </section> |
| 95 | </div> |
| 96 | </> |
| 97 | ); |
| 98 | } |
| 99 |