| 1 | import { RefRows, withCodeSpans } from "@/components/code-spans"; |
| 2 | import { getDocsComputers } from "@/lib/i18n/dictionaries"; |
| 3 | import { buildPageMetadata } from "@/lib/page-meta"; |
| 4 | |
| 5 | /** Code-owned literals from docs/DAYTONA_CLOUD_DISPATCH.md. Not copy. */ |
| 6 | const SPANS: Record<string, string> = { |
| 7 | cloudAgent: "codewhale cloud-agent", |
| 8 | dispatch: "codewhale dispatch", |
| 9 | kind: "kind=cloud", |
| 10 | remoteFlag: "--remote", |
| 11 | apiKey: "export DAYTONA_API_KEY=…", |
| 12 | apiUrl: "DAYTONA_API_URL", |
| 13 | slot: "daytona", |
| 14 | alias: "CWC_DAYTONA_TOKEN", |
| 15 | status: "codewhale dispatch --status", |
| 16 | bare: "/dispatch", |
| 17 | proposed: "proposed", |
| 18 | refused: "refused", |
| 19 | login: "codewhale login", |
| 20 | }; |
| 21 | |
| 22 | export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) { |
| 23 | const { locale } = await params; |
| 24 | const t = getDocsComputers(locale); |
| 25 | return buildPageMetadata({ |
| 26 | path: "/docs/computers", |
| 27 | locale, |
| 28 | title: t.metaTitle, |
| 29 | description: t.metaDescription, |
| 30 | }); |
| 31 | } |
| 32 | |
| 33 | export default async function ComputersPage({ params }: { params: Promise<{ locale: string }> }) { |
| 34 | const { locale } = await params; |
| 35 | const t = getDocsComputers(locale); |
| 36 | |
| 37 | return ( |
| 38 | <section className="space-y-10"> |
| 39 | <section id="overview" className="scroll-mt-32"> |
| 40 | <h1 className="font-display text-3xl mb-1">{t.overviewTitle}</h1> |
| 41 | <p className={`${t.bodyClassName} mt-3`}>{t.overviewLead}</p> |
| 42 | </section> |
| 43 | |
| 44 | <section id="propose" className="scroll-mt-32"> |
| 45 | <h2 className="font-display text-2xl mb-1">{t.proposeTitle}</h2> |
| 46 | <p className={`${t.bodyClassName} mt-3`}>{withCodeSpans(t.proposeLead, SPANS)}</p> |
| 47 | <pre className="code-block mt-4">{`codewhale dispatch "open a PR that fixes the flake" --remote github |
| 48 | codewhale dispatch --confirm cloud_<id> |
| 49 | |
| 50 | # the same two steps inside the TUI |
| 51 | /dispatch open a PR that fixes the flake --remote github |
| 52 | /dispatch confirm cloud_<id>`}</pre> |
| 53 | <p className={`${t.bodyClassName} mt-4`}>{withCodeSpans(t.jobsLead, SPANS)}</p> |
| 54 | <pre className="code-block mt-4">{`/jobs list |
| 55 | /dispatch list |
| 56 | /dispatch show <id> |
| 57 | /dispatch cancel <id> |
| 58 | codewhale dispatch --list`}</pre> |
| 59 | </section> |
| 60 | |
| 61 | <section id="remotes" className="scroll-mt-32"> |
| 62 | <h2 className="font-display text-2xl mb-1">{t.remotesTitle}</h2> |
| 63 | <p className={`${t.bodyClassName} mt-3 mb-4`}>{withCodeSpans(t.remotesLead, SPANS)}</p> |
| 64 | <RefRows rows={t.remotes} spans={SPANS} /> |
| 65 | </section> |
| 66 | |
| 67 | <section id="enable" className="scroll-mt-32"> |
| 68 | <h2 className="font-display text-2xl mb-1">{t.enableTitle}</h2> |
| 69 | <p className={`${t.bodyClassName} mt-3 mb-4`}>{t.enableLead}</p> |
| 70 | <RefRows rows={t.enableSteps} spans={SPANS} /> |
| 71 | <p className={`${t.bodyClassName} mt-4 text-sm`}>{withCodeSpans(t.cliNote, SPANS)}</p> |
| 72 | </section> |
| 73 | |
| 74 | <section id="rules" className="scroll-mt-32"> |
| 75 | <h2 className="font-display text-2xl mb-4">{t.rulesTitle}</h2> |
| 76 | <RefRows rows={t.rules} spans={SPANS} /> |
| 77 | </section> |
| 78 | |
| 79 | <section id="membership" className="scroll-mt-32"> |
| 80 | <h2 className="font-display text-2xl mb-1">{t.membershipTitle}</h2> |
| 81 | <p className={`${t.bodyClassName} mt-3`}>{withCodeSpans(t.membershipLead, SPANS)}</p> |
| 82 | </section> |
| 83 | |
| 84 | <section id="leftover" className="scroll-mt-32"> |
| 85 | <h2 className="font-display text-2xl mb-4">{t.leftoverTitle}</h2> |
| 86 | <RefRows rows={t.leftover} spans={SPANS} /> |
| 87 | </section> |
| 88 | |
| 89 | <section id="source" className="hairline-t pt-8"> |
| 90 | <p className="text-sm text-ink-mute">{t.sourceNote}</p> |
| 91 | </section> |
| 92 | </section> |
| 93 | ); |
| 94 | } |
| 95 |