From c96d06f93dc3bfacff4d9efcebfc0f9a46d530ed Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Mon, 30 Nov 2026 17:53:37 +0000 Subject: [PATCH 01/11] feat(docs): add two docs home page mockups Adds /mockups/home-in-docs, with the home page inside the docs shell, and /mockups/home-landing, a standalone landing page, so the two directions can be compared in a browser. They are a design prototype for review, not for merge. Assisted-by: AI --- apps/docs/app/mockups/home-in-docs/layout.tsx | 8 + apps/docs/app/mockups/home-in-docs/page.tsx | 47 ++ apps/docs/app/mockups/home-landing/layout.tsx | 31 + apps/docs/app/mockups/home-landing/page.tsx | 169 +++++ apps/docs/app/mockups/mockups.css | 662 ++++++++++++++++++ apps/docs/app/mockups/page.tsx | 63 ++ apps/docs/lib/mockups/home-blocks.tsx | 172 +++++ apps/docs/lib/mockups/home-data.ts | 345 +++++++++ .../mockup-assets/icons/ai_intelligence.svg | 1 + .../mockup-assets/icons/computer-code.svg | 20 + apps/docs/mockup-assets/icons/container.svg | 2 + apps/docs/mockup-assets/icons/docker.svg | 3 + apps/docs/mockup-assets/icons/download.svg | 4 + apps/docs/mockup-assets/icons/git.svg | 3 + apps/docs/mockup-assets/icons/home.svg | 3 + apps/docs/mockup-assets/icons/info.svg | 4 + apps/docs/mockup-assets/icons/key.svg | 4 + apps/docs/mockup-assets/icons/kubernetes.svg | 2 + apps/docs/mockup-assets/icons/link.svg | 3 + apps/docs/mockup-assets/icons/lock.svg | 3 + apps/docs/mockup-assets/icons/networking.svg | 4 + apps/docs/mockup-assets/icons/notes.svg | 1 + apps/docs/mockup-assets/icons/openshift.svg | 12 + apps/docs/mockup-assets/icons/picture.svg | 5 + apps/docs/mockup-assets/icons/plug.svg | 5 + apps/docs/mockup-assets/icons/rancher.svg | 5 + apps/docs/mockup-assets/icons/rocket.svg | 6 + apps/docs/mockup-assets/icons/security.svg | 3 + apps/docs/mockup-assets/icons/stairs.svg | 17 + apps/docs/mockup-assets/icons/terminal.svg | 3 + apps/docs/mockup-assets/icons/upgrade.svg | 4 + apps/docs/mockup-assets/icons/users.svg | 4 + apps/docs/mockup-assets/icons/wand.svg | 1 + apps/docs/mockup-assets/icons/wrench.svg | 3 + apps/docs/mockup-assets/logos/aws-dark.svg | 11 + apps/docs/mockup-assets/logos/aws-light.svg | 11 + apps/docs/mockup-assets/logos/aws.svg | 6 + apps/docs/mockup-assets/logos/azure.svg | 23 + apps/docs/mockup-assets/logos/claude.svg | 3 + apps/docs/mockup-assets/logos/code.svg | 46 ++ apps/docs/mockup-assets/logos/cursor.svg | 21 + apps/docs/mockup-assets/logos/docker.svg | 10 + apps/docs/mockup-assets/logos/gcp.svg | 6 + .../mockup-assets/logos/github-copilot.svg | 12 + apps/docs/mockup-assets/logos/github.svg | 15 + apps/docs/mockup-assets/logos/gitlab.svg | 6 + apps/docs/mockup-assets/logos/google.svg | 6 + apps/docs/mockup-assets/logos/jetbrains.svg | 17 + apps/docs/mockup-assets/logos/junie.svg | 5 + apps/docs/mockup-assets/logos/keycloak.svg | 23 + apps/docs/mockup-assets/logos/kilo-code.svg | 10 + apps/docs/mockup-assets/logos/microsoft.svg | 14 + apps/docs/mockup-assets/logos/okta.svg | 10 + .../docs/mockup-assets/logos/openai-codex.svg | 10 + apps/docs/mockup-assets/logos/opencode.svg | 14 + apps/docs/mockup-assets/logos/terminal.svg | 3 + apps/docs/mockup-assets/logos/zed.svg | 10 + 57 files changed, 1914 insertions(+) create mode 100644 apps/docs/app/mockups/home-in-docs/layout.tsx create mode 100644 apps/docs/app/mockups/home-in-docs/page.tsx create mode 100644 apps/docs/app/mockups/home-landing/layout.tsx create mode 100644 apps/docs/app/mockups/home-landing/page.tsx create mode 100644 apps/docs/app/mockups/mockups.css create mode 100644 apps/docs/app/mockups/page.tsx create mode 100644 apps/docs/lib/mockups/home-blocks.tsx create mode 100644 apps/docs/lib/mockups/home-data.ts create mode 100644 apps/docs/mockup-assets/icons/ai_intelligence.svg create mode 100644 apps/docs/mockup-assets/icons/computer-code.svg create mode 100644 apps/docs/mockup-assets/icons/container.svg create mode 100644 apps/docs/mockup-assets/icons/docker.svg create mode 100644 apps/docs/mockup-assets/icons/download.svg create mode 100644 apps/docs/mockup-assets/icons/git.svg create mode 100644 apps/docs/mockup-assets/icons/home.svg create mode 100644 apps/docs/mockup-assets/icons/info.svg create mode 100644 apps/docs/mockup-assets/icons/key.svg create mode 100644 apps/docs/mockup-assets/icons/kubernetes.svg create mode 100644 apps/docs/mockup-assets/icons/link.svg create mode 100644 apps/docs/mockup-assets/icons/lock.svg create mode 100644 apps/docs/mockup-assets/icons/networking.svg create mode 100644 apps/docs/mockup-assets/icons/notes.svg create mode 100644 apps/docs/mockup-assets/icons/openshift.svg create mode 100644 apps/docs/mockup-assets/icons/picture.svg create mode 100644 apps/docs/mockup-assets/icons/plug.svg create mode 100644 apps/docs/mockup-assets/icons/rancher.svg create mode 100644 apps/docs/mockup-assets/icons/rocket.svg create mode 100644 apps/docs/mockup-assets/icons/security.svg create mode 100644 apps/docs/mockup-assets/icons/stairs.svg create mode 100644 apps/docs/mockup-assets/icons/terminal.svg create mode 100644 apps/docs/mockup-assets/icons/upgrade.svg create mode 100644 apps/docs/mockup-assets/icons/users.svg create mode 100644 apps/docs/mockup-assets/icons/wand.svg create mode 100644 apps/docs/mockup-assets/icons/wrench.svg create mode 100644 apps/docs/mockup-assets/logos/aws-dark.svg create mode 100644 apps/docs/mockup-assets/logos/aws-light.svg create mode 100644 apps/docs/mockup-assets/logos/aws.svg create mode 100644 apps/docs/mockup-assets/logos/azure.svg create mode 100644 apps/docs/mockup-assets/logos/claude.svg create mode 100644 apps/docs/mockup-assets/logos/code.svg create mode 100644 apps/docs/mockup-assets/logos/cursor.svg create mode 100644 apps/docs/mockup-assets/logos/docker.svg create mode 100644 apps/docs/mockup-assets/logos/gcp.svg create mode 100644 apps/docs/mockup-assets/logos/github-copilot.svg create mode 100644 apps/docs/mockup-assets/logos/github.svg create mode 100644 apps/docs/mockup-assets/logos/gitlab.svg create mode 100644 apps/docs/mockup-assets/logos/google.svg create mode 100644 apps/docs/mockup-assets/logos/jetbrains.svg create mode 100644 apps/docs/mockup-assets/logos/junie.svg create mode 100644 apps/docs/mockup-assets/logos/keycloak.svg create mode 100644 apps/docs/mockup-assets/logos/kilo-code.svg create mode 100644 apps/docs/mockup-assets/logos/microsoft.svg create mode 100644 apps/docs/mockup-assets/logos/okta.svg create mode 100644 apps/docs/mockup-assets/logos/openai-codex.svg create mode 100644 apps/docs/mockup-assets/logos/opencode.svg create mode 100644 apps/docs/mockup-assets/logos/terminal.svg create mode 100644 apps/docs/mockup-assets/logos/zed.svg diff --git a/apps/docs/app/mockups/home-in-docs/layout.tsx b/apps/docs/app/mockups/home-in-docs/layout.tsx new file mode 100644 index 00000000..ad027ca0 --- /dev/null +++ b/apps/docs/app/mockups/home-in-docs/layout.tsx @@ -0,0 +1,8 @@ +import type { ReactNode } from "react"; +import { VersionedShell } from "@/lib/versioned-shell"; +import "../mockups.css"; + +// Mockup A keeps the real docs shell: sidebar, navbar search, version switcher. +export default function Layout({ children }: { children: ReactNode }) { + return {children}; +} diff --git a/apps/docs/app/mockups/home-in-docs/page.tsx b/apps/docs/app/mockups/home-in-docs/page.tsx new file mode 100644 index 00000000..8adc2180 --- /dev/null +++ b/apps/docs/app/mockups/home-in-docs/page.tsx @@ -0,0 +1,47 @@ +import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page"; +import type { Metadata } from "next"; +import { AudienceTabs, LogoCards, PopularCards, SectionCards } from "@/lib/mockups/home-blocks"; +import { hero } from "@/lib/mockups/home-data"; + +export const metadata: Metadata = { + title: "Home mockup A: inside the docs layout", + robots: { index: false, follow: false }, +}; + +// Every block here is one a Markdown page can produce: front matter for the +// title and description, headings, and Fumadocs Cards and Tabs from the +// `
` and `
` blocks. Card icons and the +// compact logo cards are the two proposed additions to the cards syntax. +export default function Page() { + return ( + + {hero.title} + {hero.description} + +

+ New to Coder? Start with the Quickstart, or pick the guides for + your role. +

+

Find your path

+ + + +

Works with

+ +

Browse the docs

+ +

+ Can't find what you need? Visit Support to ask the community on + Discord, open a GitHub issue, or contact support. +

+
+
+ ); +} diff --git a/apps/docs/app/mockups/home-landing/layout.tsx b/apps/docs/app/mockups/home-landing/layout.tsx new file mode 100644 index 00000000..18f05364 --- /dev/null +++ b/apps/docs/app/mockups/home-landing/layout.tsx @@ -0,0 +1,31 @@ +import { DocsProvider, createBaseOptions } from "@coder/docs-next"; +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import type { ReactNode } from "react"; +import "../mockups.css"; + +const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); + +// Mockup B: Fumadocs' HomeLayout (navbar, no sidebar) with the docs search +// and display settings the docs shell uses, so search works from the hero. +export default function Layout({ children }: { children: ReactNode }) { + const base = createBaseOptions(); + return ( + + + {children} + + + ); +} diff --git a/apps/docs/app/mockups/home-landing/page.tsx b/apps/docs/app/mockups/home-landing/page.tsx new file mode 100644 index 00000000..0da1fb82 --- /dev/null +++ b/apps/docs/app/mockups/home-landing/page.tsx @@ -0,0 +1,169 @@ +import { Copyright } from "@coder/docs-ui"; +import { FullSearchTrigger } from "fumadocs-ui/layouts/shared/slots/search-trigger"; +import type { Metadata } from "next"; +import Link from "next/link"; +import type { ReactNode } from "react"; +import { AudienceDoors, LogoWall, PopularPills, SectionCards } from "@/lib/mockups/home-blocks"; +import { hero } from "@/lib/mockups/home-data"; + +export const metadata: Metadata = { + title: "Home mockup B: standalone landing page", + robots: { index: false, follow: false }, +}; + +function SectionHead({ + id, + eyebrow, + title, + lead, +}: { + id: string; + eyebrow: string; + title: string; + lead: ReactNode; +}) { + return ( +
+
+

{eyebrow}

+

+ {title} +

+
+

{lead}

+
+ ); +} + +// The install commands and the Windows alternative are the Quickstart's +// (docs/get-started/index.md, Step 2). +function InstallWindow() { + return ( +
+
+ + + + + + Install Coder on Linux or macOS +
+
+ # Install the coder CLI +
+          curl -fsSL{" "}
+          https://coder.com/install.sh |{" "}
+          sh
+        
+ # Start Coder +
+          coder server
+        
+
+
+ + On Windows: winget install Coder.Coder + + Follow the Quickstart +
+
+ ); +} + +export default function Page() { + return ( + <> +
+
+
+ Coder docs +

{hero.title}

+

{hero.description}

+ + +
+ + {hero.primary.title} + + + {hero.secondary.title} + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+
+ +
+
+
+

+ Can't find what you need? +

+

+ Ask the community on Discord, open a GitHub issue, or contact support. +

+
+
+ + Get support + + + Join Discord + +
+
+
+ + + + ); +} diff --git a/apps/docs/app/mockups/mockups.css b/apps/docs/app/mockups/mockups.css new file mode 100644 index 00000000..d98539a3 --- /dev/null +++ b/apps/docs/app/mockups/mockups.css @@ -0,0 +1,662 @@ +/* Docs home page mockups. Values come from coder.com's design system + * (coder/coder.com-new packages/ui/styles/tokens.css and ramps.css); the + * fd colour tokens they sit on already match it (docs-theme brand.css). */ + +:root { + --mk-line-subtle: #e9e9eb; /* ink-4 */ + --mk-line: #d6d6da; /* ink-6 */ + --mk-line-strong: #b0b0b6; /* ink-8 */ + --mk-text-muted: #626269; /* ink-11 */ + --mk-text-faint: #717178; /* ink-10 */ + --mk-surface: #ffffff; + --mk-bg-subtle: #f9f9fa; /* ink-2 */ + --mk-fill-hover: #e9e9eb; /* ink-4 */ + --mk-solid: #090b0b; + --mk-on-solid: #ffffff; + --mk-grid-line: rgb(9 11 11 / 0.08); + --mk-glow-strength: 0.35; + --mk-coral: #ff8067; + --mk-pink: #f08dff; + --mk-violet: #bc7cff; + --mk-cyan: #a4e8f2; + --mk-screen-bg: #0b0b0c; + --mk-screen-raised: #18181a; + --mk-screen-text: #ededef; + --mk-screen-muted: #a1a1a8; + --mk-ease: cubic-bezier(0.2, 0, 0, 1); +} + +.dark { + --mk-line-subtle: #262629; + --mk-line: #3a3a3e; + --mk-line-strong: #65656c; + --mk-text-muted: #9f9fa6; + --mk-text-faint: #82828a; + --mk-surface: #131314; + --mk-bg-subtle: #131314; + --mk-fill-hover: #262629; + --mk-solid: #ffffff; + --mk-on-solid: #090b0b; + --mk-grid-line: rgb(255 255 255 / 0.08); + --mk-glow-strength: 0.55; +} + +/* ---------- Shared ---------- */ + +.mk-mask-icon { + display: inline-block; + width: 1.25rem; + height: 1.25rem; + flex: none; + background-color: currentColor; + mask-size: contain; + mask-repeat: no-repeat; + mask-position: center; +} + +.mk-logo { + width: 1.5rem; + height: 1.5rem; + object-fit: contain; + flex: none; +} +:root:not(.dark) .mk-logo[data-tone="light"], +.dark .mk-logo[data-tone="dark"] { + filter: invert(1) hue-rotate(180deg); +} + +.mk-row-label, +.mk-eyebrow { + font-family: var(--font-mono); + font-size: 0.75rem; + line-height: 1.2; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--mk-text-muted); +} + +/* ---------- Mockup A: inside the docs layout ---------- */ + +.mk-in-docs .mk-row-label { + margin: 0 0 0.5rem; +} +/* Compact logo cards: the proposed `cards logos` variant. */ +.mk-in-docs .mk-logo-cards { + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 0.5rem; +} +@media (max-width: 640px) { + .mk-in-docs .mk-logo-cards { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} +.mk-in-docs .mk-logo-cards > a { + flex-direction: row; + align-items: center; + gap: 0.75rem; + padding: 0.75rem; +} +.mk-in-docs .mk-logo-cards > a > * { + margin: 0; +} +/* Compact link tiles: the proposed `cards links` variant, a title and an arrow. */ +.mk-in-docs .mk-link-cards { + gap: 0.5rem; +} +.mk-in-docs .mk-link-cards > a { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.75rem 1rem; +} +.mk-in-docs .mk-link-cards > a > * { + margin: 0; +} +.mk-in-docs .mk-link-cards > a::after { + content: "\2197"; + color: var(--mk-text-faint); +} +.mk-in-docs-closing { + margin-top: 2.5rem; + padding-top: 1.5rem; + border-top: 1px solid var(--color-fd-border); + padding-bottom: 2rem; +} + +/* ---------- Mockup B: standalone landing page ---------- */ + +.mk-landing { + --mk-frame: 1280px; +} +.mk-container { + width: 100%; + max-width: var(--mk-frame); + margin-inline: auto; + padding-inline: clamp(1rem, 4vw, 2.5rem); +} + +/* Hero: display type over a soft spectrum glow, as on coder.com. */ +.mk-hero { + position: relative; + isolation: isolate; + overflow: hidden; + padding-block: clamp(3.5rem, 7vw, 7rem) clamp(3rem, 6vw, 5.5rem); + border-bottom: 1px solid var(--mk-grid-line); +} +.mk-hero::before { + content: ""; + position: absolute; + inset: -20% -10% auto 35%; + height: 140%; + z-index: -1; + opacity: var(--mk-glow-strength); + filter: blur(28px); + background: + radial-gradient(40% 45% at 70% 30%, var(--mk-violet), transparent 70%), + radial-gradient(35% 40% at 90% 55%, var(--mk-coral), transparent 70%), + radial-gradient(30% 35% at 55% 65%, var(--mk-cyan), transparent 70%), + radial-gradient(30% 30% at 85% 15%, var(--mk-pink), transparent 70%); + mask-image: linear-gradient(to bottom, #000 35%, transparent 80%); +} +.mk-hero-inner { + display: grid; + grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); + gap: clamp(2rem, 5vw, 4rem); + align-items: center; +} +.mk-hero-copy { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 1.25rem; +} +.mk-hero-pill { + display: inline-flex; + align-items: center; + gap: 0.5rem; + height: 2rem; + padding-inline: 0.75rem; + border: 1px solid var(--mk-line); + border-radius: 4px; + font-size: 0.75rem; + letter-spacing: 0.01em; + color: var(--color-fd-foreground); + backdrop-filter: blur(28px); +} +.mk-hero-pill::before { + content: ""; + width: 0.5rem; + height: 0.5rem; + border-radius: 2px; + background: linear-gradient( + 90deg, + var(--mk-coral), + var(--mk-pink), + var(--mk-violet), + var(--mk-cyan) + ); +} +.mk-hero-title { + margin: 0; + max-width: 13ch; + font-size: clamp(2.5rem, 1.6rem + 2.6vw, 3.75rem); + line-height: 0.96; + letter-spacing: -0.04em; + font-weight: 500; + font-feature-settings: "ss02" 1; +} +.mk-hero-description { + margin: 0; + max-width: 40ch; + font-size: 1.125rem; + line-height: 1.45; + color: var(--mk-text-muted); +} + +/* Fumadocs' FullSearchTrigger, sized up for the hero. */ +.mk-hero-search { + width: 100%; + max-width: 34rem; + height: 3.25rem; + padding-inline: 1rem; + border: 1px solid var(--mk-line); + border-radius: 4px; + background: var(--mk-surface); + font-size: 1rem; + box-shadow: + 0 2px 4px -2px rgb(0 0 0 / 0.08), + 0 8px 24px -6px rgb(0 0 0 / 0.12); +} +.mk-hero-search:hover { + border-color: var(--mk-line-strong); +} + +.mk-pills { + display: flex; + align-items: baseline; + gap: 0.75rem; + max-width: 40rem; +} +.mk-pills-label { + flex: none; + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--mk-text-muted); +} +.mk-pills-list { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + margin: 0; + padding: 0; + list-style: none; +} +.mk-pill { + font-family: var(--font-mono); + font-size: 0.75rem; + line-height: 1.55; + padding: 0.25rem 0.625rem; + border: 1px solid var(--mk-line-subtle); + border-radius: 6px; + color: var(--color-fd-foreground); + transition: + border-color 150ms var(--mk-ease), + background-color 150ms var(--mk-ease); +} +.mk-pill:hover { + border-color: var(--mk-line-strong); + background: var(--mk-fill-hover); +} + +.mk-hero-actions { + display: flex; + flex-wrap: wrap; + gap: 0.75rem; +} +.mk-button { + display: inline-flex; + align-items: center; + justify-content: center; + height: 3rem; + padding-inline: 1.5rem; + border-radius: 4px; + font-size: 1rem; + line-height: 1; + font-weight: 500; + letter-spacing: 0.01em; + transition: + background-color 150ms var(--mk-ease), + opacity 150ms var(--mk-ease), + transform 150ms var(--mk-ease); +} +.mk-button:active { + transform: scale(0.975); +} +.mk-button-primary { + background: var(--mk-solid); + color: var(--mk-on-solid); +} +.mk-button-primary:hover { + opacity: 0.88; +} +.mk-button-secondary { + border: 1px solid var(--mk-line); + color: var(--color-fd-foreground); +} +.mk-button-secondary:hover { + background: var(--mk-fill-hover); +} + +/* The product-screen window, always dark, as coder.com draws product UI. */ +.mk-window { + border: 1px solid #262629; + border-radius: 12px; + background: var(--mk-screen-bg); + color: var(--mk-screen-text); + box-shadow: + 0 4px 8px -4px rgb(0 0 0 / 0.3), + 0 24px 64px -12px rgb(0 0 0 / 0.45); + overflow: hidden; +} +.mk-window-bar { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.75rem 1rem; + border-bottom: 1px solid #262629; + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--mk-screen-muted); +} +.mk-window-dots { + display: inline-flex; + gap: 0.375rem; + margin-inline-end: 0.5rem; +} +.mk-window-dots span { + width: 0.625rem; + height: 0.625rem; + border-radius: 9999px; + background: #3a3a3e; +} +.mk-window-body { + display: flex; + flex-direction: column; + gap: 1rem; + padding: 1.25rem; + font-family: var(--font-mono); + font-size: 0.8125rem; + line-height: 1.65; +} +.mk-window-comment { + color: var(--mk-screen-muted); +} +.mk-window-command { + margin: 0; + padding: 0.75rem 1rem; + border-radius: 6px; + background: var(--mk-screen-raised); + white-space: pre-wrap; + word-break: break-all; +} +.mk-window-command .mk-cmd { + color: var(--mk-coral); +} +.mk-window-command .mk-flag { + color: var(--mk-pink); +} +.mk-window-command .mk-str { + color: var(--mk-cyan); +} +.mk-window-foot { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 0.5rem; + padding: 0.875rem 1.25rem; + border-top: 1px solid #262629; + font-size: 0.8125rem; + color: var(--mk-screen-muted); +} +.mk-window-foot a { + color: var(--mk-screen-text); + text-decoration: underline; + text-underline-offset: 3px; +} + +/* Sections */ +.mk-section { + padding-block: clamp(3.5rem, 7vw, 6.5rem); +} +.mk-section + .mk-section { + border-top: 1px solid var(--mk-grid-line); +} +.mk-section-alt { + background: var(--mk-bg-subtle); +} +.mk-section-head { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 28rem); + gap: 1.25rem 4rem; + align-items: end; + margin-bottom: clamp(2rem, 4vw, 3rem); +} +.mk-section-head .mk-eyebrow { + margin: 0 0 0.75rem; +} +.mk-section-title { + margin: 0; + font-size: clamp(2rem, 1.6rem + 1.4vw, 3rem); + line-height: 1.04; + letter-spacing: -0.025em; + font-weight: 500; + font-feature-settings: "ss02" 1; +} +.mk-section-lead { + margin: 0; + font-size: 1rem; + line-height: 1.55; + color: var(--mk-text-muted); +} + +/* Audience doors: grid cells separated by hairlines (card-grid--rows). */ +.mk-doors { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 1px; + background: var(--mk-line-subtle); + border: 1px solid var(--mk-line-subtle); + border-radius: 8px; + overflow: hidden; +} +.mk-door { + display: flex; + flex-direction: column; + gap: 0.75rem; + padding: 1.75rem 1.5rem; + background: var(--color-fd-background); +} +.mk-door-head { + display: flex; + align-items: center; + gap: 0.75rem; +} +.mk-door-icon { + width: 1.25rem; + height: 1.25rem; + color: var(--color-fd-foreground); +} +.mk-door-head .mk-eyebrow { + margin: 0; +} +.mk-door-title { + margin: 0.25rem 0 0; + font-size: clamp(1.375rem, 1.3rem + 0.35vw, 1.5rem); + line-height: 1.15; + letter-spacing: -0.005em; + font-weight: 500; +} +.mk-door-title a:hover { + text-decoration: underline; + text-underline-offset: 4px; +} +.mk-door-description { + margin: 0; + font-size: 0.9375rem; + line-height: 1.5; + color: var(--mk-text-muted); +} +.mk-door-links { + margin: auto 0 0; + padding: 0.5rem 0 0; + list-style: none; +} +.mk-door-links li { + border-top: 1px solid var(--mk-line-subtle); +} +.mk-door-links a { + display: flex; + justify-content: space-between; + gap: 0.75rem; + padding: 0.625rem 0; + font-size: 0.9375rem; + color: var(--color-fd-foreground); +} +.mk-door-links a::after { + content: "\2197"; + color: var(--mk-text-faint); + transition: transform 150ms var(--mk-ease); +} +.mk-door-links a:hover::after { + color: var(--color-fd-foreground); + transform: translate(2px, -2px); +} + +/* Logo wall: a label column and fixed cells, as coder.com's logo grid lays + * out, without its dissolve animation. Every logo is a link. */ +.mk-logo-wall { + border-bottom: 1px solid var(--mk-line-subtle); +} +.mk-logo-row { + display: grid; + grid-template-columns: 13.75rem minmax(0, 1fr); + border-top: 1px solid var(--mk-line-subtle); +} +.mk-logo-row .mk-row-label { + align-self: center; + margin: 0; + padding-block: 1.5rem; +} +.mk-logo-chips { + display: grid; + grid-template-columns: repeat(6, minmax(0, 1fr)); + margin: 0; + padding: 0; + list-style: none; +} +.mk-logo-chips li + li { + border-inline-start: 1px solid var(--mk-line-subtle); +} +.mk-logo-chip { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.625rem; + height: 6rem; + padding-inline: 0.5rem; + font-size: 0.875rem; + text-align: center; + color: var(--color-fd-foreground); + transition: background-color 150ms var(--mk-ease); +} +.mk-logo-chip:hover { + background: var(--mk-fill-hover); +} +.mk-logo-chip .mk-logo { + width: 1.75rem; + height: 1.75rem; +} +/* Monochrome by default, as coder.com's logo strip is; brand colour on hover + * or focus. Light- and dark-tone marks keep their theme inversion. */ +.mk-logo-chip .mk-logo:not([data-tone]) { + filter: grayscale(1) contrast(1.1); + transition: filter 150ms var(--mk-ease); +} +.dark .mk-logo-chip .mk-logo:not([data-tone]) { + filter: grayscale(1) brightness(1.7); +} +.mk-logo-chip:hover .mk-logo:not([data-tone]), +.mk-logo-chip:focus-visible .mk-logo:not([data-tone]) { + filter: none; +} + +/* Section cards: Fumadocs Cards, five across (ten sections, two full rows). + * Their 8px corners come from the docs theme (--radius-xl), matching + * coder.com's --radius-card; the icon takes the text colour so it reads. */ +.mk-landing .mk-section-cards > div { + grid-template-columns: repeat(5, minmax(0, 1fr)); +} +.mk-section-cards .mk-mask-icon, +.mk-in-docs .mk-mask-icon { + color: var(--color-fd-foreground); +} + +/* Closing band and footer. */ +.mk-help { + background: var(--mk-bg-subtle); + border-top: 1px solid var(--mk-line-subtle); +} +.mk-help-inner { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 1.5rem; +} +.mk-help-text { + margin: 0.75rem 0 0; + color: var(--mk-text-muted); +} +.mk-footer { + border-top: 1px solid var(--mk-line-subtle); + padding-block: 2rem; + font-size: 0.8125rem; + color: var(--mk-text-muted); +} +.mk-footer-inner { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 1rem; +} +.mk-footer-inner p { + margin: 0; +} +.mk-footer-links { + display: flex; + flex-wrap: wrap; + gap: 1.5rem; +} +.mk-footer-links a:hover { + color: var(--color-fd-foreground); +} + +/* Breakpoints from coder.com media.css: laptop 1100, tablet 900, phone 760. */ +@media (max-width: 1100px) { + .mk-doors { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + .mk-landing .mk-section-cards > div { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} +@media (max-width: 900px) { + .mk-hero-inner, + .mk-section-head { + grid-template-columns: minmax(0, 1fr); + } + .mk-logo-chips { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + .mk-logo-chips li:nth-child(3n + 1) { + border-inline-start: 0; + } + .mk-logo-chips li:nth-child(n + 4) { + border-top: 1px solid var(--mk-line-subtle); + } +} +@media (max-width: 760px) { + .mk-doors, + .mk-landing .mk-section-cards > div { + grid-template-columns: minmax(0, 1fr); + } + .mk-logo-row { + grid-template-columns: minmax(0, 1fr); + } + .mk-logo-row .mk-row-label { + padding-block: 1rem 0.5rem; + } + .mk-logo-chip { + height: 5rem; + } +} + +/* Motion: the system setting and the docs' own reduced-motion preference. */ +@media (prefers-reduced-motion: reduce) { + .mk-landing *, + .mk-in-docs * { + transition-duration: 0.01ms !important; + } + .mk-button:active { + transform: none; + } +} +[data-motion="reduced"] .mk-landing *, +[data-motion="reduced"] .mk-in-docs * { + transition-duration: 0.01ms !important; +} +[data-motion="reduced"] .mk-button:active { + transform: none; +} diff --git a/apps/docs/app/mockups/page.tsx b/apps/docs/app/mockups/page.tsx new file mode 100644 index 00000000..329917b4 --- /dev/null +++ b/apps/docs/app/mockups/page.tsx @@ -0,0 +1,63 @@ +import type { Metadata } from "next"; +import Link from "next/link"; +import "./mockups.css"; + +export const metadata: Metadata = { + title: "Docs home page mockups", + robots: { index: false, follow: false }, +}; + +const mockups = [ + { + href: "/mockups/home-in-docs/", + title: "A: inside the docs layout", + description: + "Keeps the sidebar. Built only from blocks a Markdown page can produce: Fumadocs Cards and Tabs, plus two proposed additions to the cards syntax (card icons and compact logo cards).", + }, + { + href: "/mockups/home-landing/", + title: "B: standalone landing page", + description: + "Fumadocs' HomeLayout with no sidebar: a hero with search, a door for each audience, a logo wall, and section cards, styled with coder.com's design system.", + }, +]; + +export default function Page() { + return ( +
+

DOCS-1904

+

+ Docs home page mockups +

+

+ Both mockups use the same content and the same links into the current docs. Compare them in + light and dark mode and on a phone. Neither is wired to a Markdown source yet. +

+
    + {mockups.map((mockup) => ( +
  • + + + {mockup.title} + + + {mockup.description} + + +
  • + ))} +
+
+ ); +} diff --git a/apps/docs/lib/mockups/home-blocks.tsx b/apps/docs/lib/mockups/home-blocks.tsx new file mode 100644 index 00000000..03c3f318 --- /dev/null +++ b/apps/docs/lib/mockups/home-blocks.tsx @@ -0,0 +1,172 @@ +import { Card, Cards } from "fumadocs-ui/components/card"; +import { Tab, Tabs } from "fumadocs-ui/components/tabs"; +import Link from "next/link"; +import { audiences, commonTasks, logoRows, popular, sections, type Logo } from "./home-data"; + +const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); +const asset = (path: string) => `${basePath}/mockups/${path}`; + +/** A stroke-only docs icon, drawn in the current text colour through a CSS mask. */ +export function MaskIcon({ name, className = "" }: { name: string; className?: string }) { + const url = `url(${asset(`icons/${name}.svg`)})`; + return ( + + ); +} + +function LogoImage({ logo }: { logo: Logo }) { + return ( + // oxlint-disable-next-line nextjs/no-img-element -- static SVG logos in a mockup. + + ); +} + +/** Section cards: Fumadocs' own Card, with the section's sidebar icon. */ +export function SectionCards() { + return ( + + {sections.map((section) => ( + } + /> + ))} + + ); +} + +/** Common tasks as Fumadocs cards, which the existing Markdown cards syntax produces. */ +export function PopularCards() { + return ( + + {commonTasks.map((item) => ( + + ))} + + ); +} + +/** Logo rows as compact Fumadocs cards: one proposed `cards` variant in Markdown. */ +export function LogoCards() { + return ( +
+ {logoRows.map((row) => ( +
+

{row.label}

+ + {row.logos.map((logo) => ( + } + /> + ))} + +
+ ))} +
+ ); +} + +/** Audiences in Fumadocs tabs, which the existing Markdown tabs syntax produces. */ +export function AudienceTabs() { + return ( + a.eyebrow)}> + {audiences.map((audience) => ( + +

{audience.description}

+ + {audience.links.map((link) => ( + + ))} + +
+ ))} +
+ ); +} + +/** Landing page: popular searches as pills under the hero search. */ +export function PopularPills() { + return ( +
+ + Popular: + +
    + {popular.map((item) => ( +
  • + + {item.title} + +
  • + ))} +
+
+ ); +} + +/** Landing page: one door per audience, every door visible at once. */ +export function AudienceDoors() { + return ( +
+ {audiences.map((audience) => ( +
+
+ +

{audience.eyebrow}

+
+

+ {audience.title} +

+

{audience.description}

+
    + {audience.links.map((link) => ( +
  • + {link.title} +
  • + ))} +
+
+ ))} +
+ ); +} + +/** Landing page: a static, wrapping logo wall, one labelled row per category. */ +export function LogoWall() { + return ( +
+ {logoRows.map((row) => ( +
+

{row.label}

+
    + {row.logos.map((logo) => ( +
  • + + + {logo.name} + +
  • + ))} +
+
+ ))} +
+ ); +} diff --git a/apps/docs/lib/mockups/home-data.ts b/apps/docs/lib/mockups/home-data.ts new file mode 100644 index 00000000..179907cd --- /dev/null +++ b/apps/docs/lib/mockups/home-data.ts @@ -0,0 +1,345 @@ +// Content for the two docs home page mockups. Every href is a page in the +// coder/coder docs corpus; descriptions come from the sidebar manifest or the +// target page, so the mockups compare layouts, not copy. + +export type Link = { title: string; href: string; description?: string; icon?: string }; +// tone: "light" marks are white (drawn for dark backgrounds), "dark" marks are black; +// each is inverted only in the theme where it would vanish. +export type Logo = { name: string; href: string; logo: string; tone?: "light" | "dark" }; + +export const hero = { + title: "Coder documentation", + // docs/manifest/home.yml description. + description: + "Coder is a self-hosted platform for running AI coding agents and cloud development environments on the infrastructure you control.", + primary: { title: "Start the Quickstart", href: "/get-started" }, + secondary: { title: "Install Coder", href: "/install" }, +}; + +// The most frequent docs searches in Algolia over 30 days to Nov 18. +export const popular: Link[] = [ + { title: "Connect over SSH", href: "/workspaces/workspace-access#ssh" }, + { title: "Docker in workspaces", href: "/templates/extending-templates/docker-in-workspaces" }, + { title: "Reset a password", href: "/admin/users/password-auth" }, + { title: "OIDC sign-in", href: "/admin/users/oidc-auth" }, + { title: "TLS and reverse proxies", href: "/admin/setup#tls--reverse-proxy" }, + { title: "Port forwarding", href: "/workspaces/workspace-access/port-forwarding" }, + { title: "MCP server", href: "/mcp-server" }, +]; + +// The "Common tasks" cards from coder/coder#32714 (docs/README.md). +export const commonTasks: Link[] = [ + { + title: "Connect to a workspace", + href: "/workspaces/workspace-access", + description: + "Connect over SSH, from VS Code or a JetBrains IDE, in code-server or a web terminal, or through forwarded ports.", + }, + { + title: "Docker in workspaces", + href: "/templates/extending-templates/docker-in-workspaces", + description: + "Run Docker or Podman inside container-based workspaces with Sysbox, Envbox, rootless Podman, or a privileged sidecar.", + }, + { + title: "Manage users and sign-in", + href: "/admin/users", + description: + "Set up single sign-on, reset passwords, and organize users into groups and roles.", + }, + { + title: "Configure the control plane", + href: "/admin/setup", + description: + "Set the access URL, the wildcard domain for workspace apps, TLS certificates, and a reverse proxy.", + }, + { + title: "Git authentication", + href: "/admin/external-auth", + description: + "Connect GitHub, GitLab, Bitbucket, and other OAuth providers so workspaces can clone and push.", + }, + { + title: "MCP server", + href: "/mcp-server", + description: + "Give AI assistants tools and context for your deployment through the built-in Model Context Protocol (MCP) server.", + }, +]; + +// One door per audience. All of them are visible at once on the landing page; +// the in-docs mockup puts them in tabs, which Markdown can already express. +export const audiences: { + id: string; + eyebrow: string; + title: string; + description: string; + icon: string; + href: string; + links: Link[]; +}[] = [ + { + id: "platform", + eyebrow: "Platform teams", + title: "Install and run Coder", + description: + "Deploy the control plane on your infrastructure, then secure, scale, and upgrade it.", + icon: "download", + href: "/install", + links: [ + { title: "Installation requirements", href: "/install/server/requirements" }, + { title: "Production deployment process", href: "/install/production-deployment" }, + { title: "Install on Kubernetes", href: "/install/server/kubernetes" }, + { title: "Air-gapped deployments", href: "/install/prepare/airgap" }, + { title: "Configure the control plane", href: "/admin/setup" }, + { title: "Upgrade Coder", href: "/install/operate/upgrade" }, + ], + }, + { + id: "templates", + eyebrow: "Template authors", + title: "Build templates", + description: "Define workspace infrastructure in Terraform, then publish and maintain it.", + icon: "picture", + href: "/templates", + links: [ + { title: "Create a template", href: "/templates/creating-templates" }, + { title: "Extend templates", href: "/templates/extending-templates" }, + { title: "Parameters", href: "/templates/extending-templates/parameters" }, + { title: "Prebuilt workspaces", href: "/templates/extending-templates/prebuilt-workspaces" }, + { title: "Dev containers", href: "/templates/extending-templates/devcontainers" }, + { title: "Manage templates", href: "/templates/managing-templates" }, + ], + }, + { + id: "developers", + eyebrow: "Developers", + title: "Work in a workspace", + description: "Open a workspace from your IDE, the terminal, or the browser.", + icon: "terminal", + href: "/workspaces", + links: [ + { title: "Connect to a workspace", href: "/workspaces/workspace-access" }, + { title: "VS Code", href: "/workspaces/workspace-access/vscode" }, + { title: "JetBrains IDEs", href: "/workspaces/workspace-access/jetbrains" }, + { title: "Port forwarding", href: "/workspaces/workspace-access/port-forwarding" }, + { title: "Web terminal", href: "/workspaces/workspace-access/web-terminal" }, + { title: "code-server", href: "/workspaces/workspace-access/code-server" }, + ], + }, + { + id: "ai", + eyebrow: "AI and agent teams", + title: "Run AI agents", + description: + "Delegate work to coding agents and control how AI is used across your deployment.", + icon: "wand", + href: "/coder-agents", + links: [ + { title: "Coder Agents", href: "/coder-agents" }, + { title: "AI Governance", href: "/ai-governance" }, + { title: "Agent Firewall", href: "/ai-governance/agent-firewall" }, + { title: "AI Gateway clients", href: "/ai-governance/ai-gateway/clients" }, + { title: "Agent Relay", href: "/agent-relay" }, + { title: "MCP server", href: "/mcp-server" }, + ], + }, +]; + +export const logoRows: { label: string; logos: Logo[] }[] = [ + { + label: "Connect from", + logos: [ + { name: "VS Code", href: "/workspaces/workspace-access/vscode", logo: "logos/code.svg" }, + { + name: "JetBrains", + href: "/workspaces/workspace-access/jetbrains", + logo: "logos/jetbrains.svg", + }, + { + name: "Cursor", + href: "/workspaces/workspace-access/cursor", + logo: "logos/cursor.svg", + tone: "light", + }, + { + name: "Zed", + href: "/workspaces/workspace-access/zed", + logo: "logos/zed.svg", + tone: "light", + }, + { + name: "Web terminal", + href: "/workspaces/workspace-access/web-terminal", + logo: "icons/computer-code.svg", + tone: "dark", + }, + { + name: "SSH", + href: "/workspaces/workspace-access#ssh", + logo: "logos/terminal.svg", + tone: "light", + }, + ], + }, + { + label: "Run on", + logos: [ + { + name: "Kubernetes", + href: "/install/server/kubernetes", + logo: "icons/kubernetes.svg", + tone: "dark", + }, + { name: "Docker", href: "/install/server/docker", logo: "logos/docker.svg" }, + { + name: "AWS", + href: "/install/server/cloud/aws-marketplace", + logo: "logos/aws.svg", + tone: "light", + }, + { name: "Azure", href: "/install/server/cloud/azure-vm", logo: "logos/azure.svg" }, + { name: "Google Cloud", href: "/install/server/cloud/compute-engine", logo: "logos/gcp.svg" }, + { + name: "OpenShift", + href: "/install/server/openshift", + logo: "icons/openshift.svg", + tone: "dark", + }, + ], + }, + { + label: "Sign in with", + logos: [ + { name: "GitHub", href: "/admin/users/github-auth", logo: "logos/github.svg", tone: "light" }, + { + name: "Okta", + href: "/admin/users/oidc-auth/configuring-okta", + logo: "logos/okta.svg", + tone: "light", + }, + { name: "Microsoft", href: "/admin/users/oidc-auth/microsoft", logo: "logos/microsoft.svg" }, + { name: "Google", href: "/admin/users/oidc-auth/google", logo: "logos/google.svg" }, + { + name: "Any OIDC provider", + href: "/admin/users/oidc-auth", + logo: "icons/key.svg", + tone: "dark", + }, + { + name: "Passwords", + href: "/admin/users/password-auth", + logo: "icons/lock.svg", + tone: "dark", + }, + ], + }, + { + label: "Bring your agent", + logos: [ + { + name: "Claude Code", + href: "/ai-governance/ai-gateway/clients/claude-code", + logo: "logos/claude.svg", + }, + { + name: "Codex", + href: "/ai-governance/ai-gateway/clients/codex", + logo: "logos/openai-codex.svg", + tone: "light", + }, + { + name: "GitHub Copilot", + href: "/ai-governance/ai-gateway/clients/copilot", + logo: "logos/github-copilot.svg", + tone: "light", + }, + { name: "Junie", href: "/ai-governance/ai-gateway/clients/junie", logo: "logos/junie.svg" }, + { + name: "OpenCode", + href: "/ai-governance/ai-gateway/clients/opencode", + logo: "logos/opencode.svg", + }, + { + name: "Cursor agents", + href: "/agent-relay/cursor", + logo: "logos/cursor.svg", + tone: "light", + }, + ], + }, +]; + +// Top-level sections, with the icon and description from docs/manifest/*.yml. +export const sections: Link[] = [ + { + title: "Get started", + href: "/get-started", + icon: "rocket", + description: + "Install Coder, build your first template, and launch your first workspace in this quickstart guide.", + }, + { + title: "Install", + href: "/install", + icon: "download", + description: + "Plan, prepare, install, validate, and operate a Coder deployment in your own infrastructure.", + }, + { + title: "Templates", + href: "/templates", + icon: "picture", + description: + "Learn how to author, publish, and maintain the Coder templates that define your workspaces.", + }, + { + title: "Workspaces", + href: "/workspaces", + icon: "users", + description: + "Guides for Coder end users on accessing, managing, and personalizing their workspaces.", + }, + { + title: "Coder Agents", + href: "/coder-agents", + icon: "wand", + description: + "Delegate development work to coding agents in your deployment with Coder Agents, a chat interface and API.", + }, + { + title: "AI Governance", + href: "/ai-governance", + icon: "ai_intelligence", + description: + "Govern AI usage at scale with AI Governance: Agent Firewall, AI Gateway, and reporting.", + }, + { + title: "Agent Relay", + href: "/agent-relay", + icon: "link", + description: + "Connect supported cloud-hosted AI agents to self-hosted Coder workspaces with Agent Relay.", + }, + { + title: "MCP server", + href: "/mcp-server", + icon: "plug", + description: + "Connect external AI coding agents to Coder using its built-in Model Context Protocol server.", + }, + { + title: "Administration", + href: "/admin", + icon: "wrench", + description: + "Guides for the template and deployment administrators who configure, secure, and operate Coder.", + }, + { + title: "Reference", + href: "/reference", + icon: "notes", + description: + "Reference for automating Coder through the REST API, command-line interface, and Agent API.", + }, +]; diff --git a/apps/docs/mockup-assets/icons/ai_intelligence.svg b/apps/docs/mockup-assets/icons/ai_intelligence.svg new file mode 100644 index 00000000..bcef647b --- /dev/null +++ b/apps/docs/mockup-assets/icons/ai_intelligence.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/computer-code.svg b/apps/docs/mockup-assets/icons/computer-code.svg new file mode 100644 index 00000000..58cf2afb --- /dev/null +++ b/apps/docs/mockup-assets/icons/computer-code.svg @@ -0,0 +1,20 @@ + + + + computer-code + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/container.svg b/apps/docs/mockup-assets/icons/container.svg new file mode 100644 index 00000000..0739fdc8 --- /dev/null +++ b/apps/docs/mockup-assets/icons/container.svg @@ -0,0 +1,2 @@ + + diff --git a/apps/docs/mockup-assets/icons/docker.svg b/apps/docs/mockup-assets/icons/docker.svg new file mode 100644 index 00000000..f5b39410 --- /dev/null +++ b/apps/docs/mockup-assets/icons/docker.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/download.svg b/apps/docs/mockup-assets/icons/download.svg new file mode 100644 index 00000000..8e7cdcb8 --- /dev/null +++ b/apps/docs/mockup-assets/icons/download.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/git.svg b/apps/docs/mockup-assets/icons/git.svg new file mode 100644 index 00000000..a1d6213e --- /dev/null +++ b/apps/docs/mockup-assets/icons/git.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/home.svg b/apps/docs/mockup-assets/icons/home.svg new file mode 100644 index 00000000..6fac64f2 --- /dev/null +++ b/apps/docs/mockup-assets/icons/home.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/info.svg b/apps/docs/mockup-assets/icons/info.svg new file mode 100644 index 00000000..a89dac5e --- /dev/null +++ b/apps/docs/mockup-assets/icons/info.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/key.svg b/apps/docs/mockup-assets/icons/key.svg new file mode 100644 index 00000000..7c38e7c2 --- /dev/null +++ b/apps/docs/mockup-assets/icons/key.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/kubernetes.svg b/apps/docs/mockup-assets/icons/kubernetes.svg new file mode 100644 index 00000000..2662ad49 --- /dev/null +++ b/apps/docs/mockup-assets/icons/kubernetes.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/link.svg b/apps/docs/mockup-assets/icons/link.svg new file mode 100644 index 00000000..5ab3edf1 --- /dev/null +++ b/apps/docs/mockup-assets/icons/link.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/lock.svg b/apps/docs/mockup-assets/icons/lock.svg new file mode 100644 index 00000000..620af515 --- /dev/null +++ b/apps/docs/mockup-assets/icons/lock.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/networking.svg b/apps/docs/mockup-assets/icons/networking.svg new file mode 100644 index 00000000..29fb50ab --- /dev/null +++ b/apps/docs/mockup-assets/icons/networking.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/notes.svg b/apps/docs/mockup-assets/icons/notes.svg new file mode 100644 index 00000000..b21b109d --- /dev/null +++ b/apps/docs/mockup-assets/icons/notes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/openshift.svg b/apps/docs/mockup-assets/icons/openshift.svg new file mode 100644 index 00000000..f2d0a8bf --- /dev/null +++ b/apps/docs/mockup-assets/icons/openshift.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/picture.svg b/apps/docs/mockup-assets/icons/picture.svg new file mode 100644 index 00000000..79daa4bb --- /dev/null +++ b/apps/docs/mockup-assets/icons/picture.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/docs/mockup-assets/icons/plug.svg b/apps/docs/mockup-assets/icons/plug.svg new file mode 100644 index 00000000..ca1874fe --- /dev/null +++ b/apps/docs/mockup-assets/icons/plug.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/docs/mockup-assets/icons/rancher.svg b/apps/docs/mockup-assets/icons/rancher.svg new file mode 100644 index 00000000..c737e6b1 --- /dev/null +++ b/apps/docs/mockup-assets/icons/rancher.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/docs/mockup-assets/icons/rocket.svg b/apps/docs/mockup-assets/icons/rocket.svg new file mode 100644 index 00000000..571aa0f6 --- /dev/null +++ b/apps/docs/mockup-assets/icons/rocket.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/docs/mockup-assets/icons/security.svg b/apps/docs/mockup-assets/icons/security.svg new file mode 100644 index 00000000..740b522b --- /dev/null +++ b/apps/docs/mockup-assets/icons/security.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/stairs.svg b/apps/docs/mockup-assets/icons/stairs.svg new file mode 100644 index 00000000..08a44445 --- /dev/null +++ b/apps/docs/mockup-assets/icons/stairs.svg @@ -0,0 +1,17 @@ + + + + + + + + + + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/terminal.svg b/apps/docs/mockup-assets/icons/terminal.svg new file mode 100644 index 00000000..8c14606a --- /dev/null +++ b/apps/docs/mockup-assets/icons/terminal.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/icons/upgrade.svg b/apps/docs/mockup-assets/icons/upgrade.svg new file mode 100644 index 00000000..dad8e9a2 --- /dev/null +++ b/apps/docs/mockup-assets/icons/upgrade.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/users.svg b/apps/docs/mockup-assets/icons/users.svg new file mode 100644 index 00000000..c5c334bb --- /dev/null +++ b/apps/docs/mockup-assets/icons/users.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/docs/mockup-assets/icons/wand.svg b/apps/docs/mockup-assets/icons/wand.svg new file mode 100644 index 00000000..342b6c55 --- /dev/null +++ b/apps/docs/mockup-assets/icons/wand.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/wrench.svg b/apps/docs/mockup-assets/icons/wrench.svg new file mode 100644 index 00000000..e77146d9 --- /dev/null +++ b/apps/docs/mockup-assets/icons/wrench.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/logos/aws-dark.svg b/apps/docs/mockup-assets/logos/aws-dark.svg new file mode 100644 index 00000000..c5ce2d70 --- /dev/null +++ b/apps/docs/mockup-assets/logos/aws-dark.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/aws-light.svg b/apps/docs/mockup-assets/logos/aws-light.svg new file mode 100644 index 00000000..de18401c --- /dev/null +++ b/apps/docs/mockup-assets/logos/aws-light.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/aws.svg b/apps/docs/mockup-assets/logos/aws.svg new file mode 100644 index 00000000..d17b5fa3 --- /dev/null +++ b/apps/docs/mockup-assets/logos/aws.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/docs/mockup-assets/logos/azure.svg b/apps/docs/mockup-assets/logos/azure.svg new file mode 100644 index 00000000..18864b1e --- /dev/null +++ b/apps/docs/mockup-assets/logos/azure.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/claude.svg b/apps/docs/mockup-assets/logos/claude.svg new file mode 100644 index 00000000..82d4fd36 --- /dev/null +++ b/apps/docs/mockup-assets/logos/claude.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/logos/code.svg b/apps/docs/mockup-assets/logos/code.svg new file mode 100644 index 00000000..24dd6504 --- /dev/null +++ b/apps/docs/mockup-assets/logos/code.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/cursor.svg b/apps/docs/mockup-assets/logos/cursor.svg new file mode 100644 index 00000000..8a32761c --- /dev/null +++ b/apps/docs/mockup-assets/logos/cursor.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/docker.svg b/apps/docs/mockup-assets/logos/docker.svg new file mode 100644 index 00000000..e5c87433 --- /dev/null +++ b/apps/docs/mockup-assets/logos/docker.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/gcp.svg b/apps/docs/mockup-assets/logos/gcp.svg new file mode 100644 index 00000000..c77820b0 --- /dev/null +++ b/apps/docs/mockup-assets/logos/gcp.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/docs/mockup-assets/logos/github-copilot.svg b/apps/docs/mockup-assets/logos/github-copilot.svg new file mode 100644 index 00000000..c1406382 --- /dev/null +++ b/apps/docs/mockup-assets/logos/github-copilot.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/github.svg b/apps/docs/mockup-assets/logos/github.svg new file mode 100644 index 00000000..48ebde25 --- /dev/null +++ b/apps/docs/mockup-assets/logos/github.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/gitlab.svg b/apps/docs/mockup-assets/logos/gitlab.svg new file mode 100644 index 00000000..f5b31ff0 --- /dev/null +++ b/apps/docs/mockup-assets/logos/gitlab.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/docs/mockup-assets/logos/google.svg b/apps/docs/mockup-assets/logos/google.svg new file mode 100644 index 00000000..95881852 --- /dev/null +++ b/apps/docs/mockup-assets/logos/google.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/docs/mockup-assets/logos/jetbrains.svg b/apps/docs/mockup-assets/logos/jetbrains.svg new file mode 100644 index 00000000..872441b4 --- /dev/null +++ b/apps/docs/mockup-assets/logos/jetbrains.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/junie.svg b/apps/docs/mockup-assets/logos/junie.svg new file mode 100644 index 00000000..537d1cd6 --- /dev/null +++ b/apps/docs/mockup-assets/logos/junie.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/docs/mockup-assets/logos/keycloak.svg b/apps/docs/mockup-assets/logos/keycloak.svg new file mode 100644 index 00000000..40646cb3 --- /dev/null +++ b/apps/docs/mockup-assets/logos/keycloak.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/kilo-code.svg b/apps/docs/mockup-assets/logos/kilo-code.svg new file mode 100644 index 00000000..7f0eecbd --- /dev/null +++ b/apps/docs/mockup-assets/logos/kilo-code.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/microsoft.svg b/apps/docs/mockup-assets/logos/microsoft.svg new file mode 100644 index 00000000..31b39803 --- /dev/null +++ b/apps/docs/mockup-assets/logos/microsoft.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/okta.svg b/apps/docs/mockup-assets/logos/okta.svg new file mode 100644 index 00000000..1789c063 --- /dev/null +++ b/apps/docs/mockup-assets/logos/okta.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/openai-codex.svg b/apps/docs/mockup-assets/logos/openai-codex.svg new file mode 100644 index 00000000..edbd9ba9 --- /dev/null +++ b/apps/docs/mockup-assets/logos/openai-codex.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/opencode.svg b/apps/docs/mockup-assets/logos/opencode.svg new file mode 100644 index 00000000..caec9b50 --- /dev/null +++ b/apps/docs/mockup-assets/logos/opencode.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/terminal.svg b/apps/docs/mockup-assets/logos/terminal.svg new file mode 100644 index 00000000..6cb6efec --- /dev/null +++ b/apps/docs/mockup-assets/logos/terminal.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/docs/mockup-assets/logos/zed.svg b/apps/docs/mockup-assets/logos/zed.svg new file mode 100644 index 00000000..0e939cea --- /dev/null +++ b/apps/docs/mockup-assets/logos/zed.svg @@ -0,0 +1,10 @@ + + + + + + + + + + From fed1aeb8c34473cf9acc382c3cb78a6537dfe931 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Mon, 30 Nov 2026 18:04:16 +0000 Subject: [PATCH 02/11] fix(docs): address visual review of the home page mockups Logos are monochrome at rest in both mockups, with filters tuned so every mark measures at least 3:1 against its background in light and dark mode. The in-docs logo cards stay compact on phones, the in-docs tabs use short labels that fit a phone-width tab bar, and the landing page's install command wraps only at spaces. Assisted-by: AI --- apps/docs/app/mockups/mockups.css | 57 +++++++++++++++------ apps/docs/lib/mockups/home-blocks.tsx | 4 +- apps/docs/lib/mockups/home-data.ts | 7 +++ apps/docs/mockup-assets/logos/microsoft.svg | 1 - 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/apps/docs/app/mockups/mockups.css b/apps/docs/app/mockups/mockups.css index d98539a3..e0f8655a 100644 --- a/apps/docs/app/mockups/mockups.css +++ b/apps/docs/app/mockups/mockups.css @@ -60,9 +60,14 @@ object-fit: contain; flex: none; } +/* Toned marks are single-colour by design, so they stay grayscale (the AWS + * smile is their only colour); each is inverted where it would vanish. */ +.mk-logo[data-tone] { + filter: grayscale(1); +} :root:not(.dark) .mk-logo[data-tone="light"], .dark .mk-logo[data-tone="dark"] { - filter: invert(1) hue-rotate(180deg); + filter: invert(1) grayscale(1); } .mk-row-label, @@ -91,6 +96,10 @@ } } .mk-in-docs .mk-logo-cards > a { + /* Fumadocs' Card is display: block and spans the full row in narrow + * containers (@max-lg:col-span-full); the compact variant keeps the grid. */ + display: flex; + grid-column: auto; flex-direction: row; align-items: center; gap: 0.75rem; @@ -152,10 +161,10 @@ opacity: var(--mk-glow-strength); filter: blur(28px); background: - radial-gradient(40% 45% at 70% 30%, var(--mk-violet), transparent 70%), - radial-gradient(35% 40% at 90% 55%, var(--mk-coral), transparent 70%), - radial-gradient(30% 35% at 55% 65%, var(--mk-cyan), transparent 70%), - radial-gradient(30% 30% at 85% 15%, var(--mk-pink), transparent 70%); + radial-gradient(38% 42% at 70% 28%, var(--mk-violet), transparent 70%), + radial-gradient(40% 45% at 92% 52%, var(--mk-coral), transparent 70%), + radial-gradient(36% 40% at 56% 68%, var(--mk-cyan), transparent 70%), + radial-gradient(30% 32% at 86% 12%, var(--mk-pink), transparent 70%); mask-image: linear-gradient(to bottom, #000 35%, transparent 80%); } .mk-hero-inner { @@ -204,6 +213,7 @@ letter-spacing: -0.04em; font-weight: 500; font-feature-settings: "ss02" 1; + text-wrap: balance; } .mk-hero-description { margin: 0; @@ -235,7 +245,7 @@ display: flex; align-items: baseline; gap: 0.75rem; - max-width: 40rem; + max-width: 34rem; } .mk-pills-label { flex: none; @@ -356,8 +366,10 @@ padding: 0.75rem 1rem; border-radius: 6px; background: var(--mk-screen-raised); + /* Wrap only at spaces so a copied command never splits inside a URL. */ white-space: pre-wrap; - word-break: break-all; + overflow-wrap: normal; + overflow-x: auto; } .mk-window-command .mk-cmd { color: var(--mk-coral); @@ -411,6 +423,7 @@ letter-spacing: -0.025em; font-weight: 500; font-feature-settings: "ss02" 1; + text-wrap: balance; } .mk-section-lead { margin: 0; @@ -513,18 +526,21 @@ margin: 0; padding: 0; list-style: none; + border-inline-start: 1px solid var(--mk-line-subtle); } .mk-logo-chips li + li { border-inline-start: 1px solid var(--mk-line-subtle); } +/* Top-aligned, so a label that wraps to two lines keeps its logo level with + * its neighbours'. */ .mk-logo-chip { display: flex; flex-direction: column; align-items: center; - justify-content: center; + justify-content: flex-start; gap: 0.625rem; height: 6rem; - padding-inline: 0.5rem; + padding: 1.25rem 0.5rem 0; font-size: 0.875rem; text-align: center; color: var(--color-fd-foreground); @@ -538,16 +554,23 @@ height: 1.75rem; } /* Monochrome by default, as coder.com's logo strip is; brand colour on hover - * or focus. Light- and dark-tone marks keep their theme inversion. */ -.mk-logo-chip .mk-logo:not([data-tone]) { - filter: grayscale(1) contrast(1.1); + * or focus. The filters push each mark's luminance towards the text colour + * (dark in light mode, near white in dark mode) without flattening the white + * details some marks carry. Light- and dark-tone marks keep their theme + * inversion instead. */ +.mk-logo-chip .mk-logo:not([data-tone]), +.mk-logo-cards .mk-logo:not([data-tone]) { + filter: grayscale(1) brightness(0.5) contrast(1.4); transition: filter 150ms var(--mk-ease); } -.dark .mk-logo-chip .mk-logo:not([data-tone]) { - filter: grayscale(1) brightness(1.7); +.dark .mk-logo-chip .mk-logo:not([data-tone]), +.dark .mk-logo-cards .mk-logo:not([data-tone]) { + filter: grayscale(1) brightness(2.2); } .mk-logo-chip:hover .mk-logo:not([data-tone]), -.mk-logo-chip:focus-visible .mk-logo:not([data-tone]) { +.mk-logo-chip:focus-visible .mk-logo:not([data-tone]), +.mk-logo-cards > a:hover .mk-logo:not([data-tone]), +.mk-logo-cards > a:focus-visible .mk-logo:not([data-tone]) { filter: none; } @@ -635,11 +658,15 @@ .mk-logo-row { grid-template-columns: minmax(0, 1fr); } + .mk-logo-chips { + border-inline-start: 0; + } .mk-logo-row .mk-row-label { padding-block: 1rem 0.5rem; } .mk-logo-chip { height: 5rem; + padding-top: 0.875rem; } } diff --git a/apps/docs/lib/mockups/home-blocks.tsx b/apps/docs/lib/mockups/home-blocks.tsx index 03c3f318..156983ee 100644 --- a/apps/docs/lib/mockups/home-blocks.tsx +++ b/apps/docs/lib/mockups/home-blocks.tsx @@ -86,9 +86,9 @@ export function LogoCards() { /** Audiences in Fumadocs tabs, which the existing Markdown tabs syntax produces. */ export function AudienceTabs() { return ( - a.eyebrow)}> + a.tab)}> {audiences.map((audience) => ( - +

{audience.description}

{audience.links.map((link) => ( diff --git a/apps/docs/lib/mockups/home-data.ts b/apps/docs/lib/mockups/home-data.ts index 179907cd..af030c25 100644 --- a/apps/docs/lib/mockups/home-data.ts +++ b/apps/docs/lib/mockups/home-data.ts @@ -72,6 +72,8 @@ export const commonTasks: Link[] = [ export const audiences: { id: string; eyebrow: string; + // Short label for the in-docs tabs, so all four fit a phone-width tab bar. + tab: string; title: string; description: string; icon: string; @@ -81,6 +83,7 @@ export const audiences: { { id: "platform", eyebrow: "Platform teams", + tab: "Platform", title: "Install and run Coder", description: "Deploy the control plane on your infrastructure, then secure, scale, and upgrade it.", @@ -98,6 +101,7 @@ export const audiences: { { id: "templates", eyebrow: "Template authors", + tab: "Templates", title: "Build templates", description: "Define workspace infrastructure in Terraform, then publish and maintain it.", icon: "picture", @@ -114,6 +118,7 @@ export const audiences: { { id: "developers", eyebrow: "Developers", + tab: "Developers", title: "Work in a workspace", description: "Open a workspace from your IDE, the terminal, or the browser.", icon: "terminal", @@ -130,6 +135,7 @@ export const audiences: { { id: "ai", eyebrow: "AI and agent teams", + tab: "AI agents", title: "Run AI agents", description: "Delegate work to coding agents and control how AI is used across your deployment.", @@ -259,6 +265,7 @@ export const logoRows: { label: string; logos: Logo[] }[] = [ name: "OpenCode", href: "/ai-governance/ai-gateway/clients/opencode", logo: "logos/opencode.svg", + tone: "light", }, { name: "Cursor agents", diff --git a/apps/docs/mockup-assets/logos/microsoft.svg b/apps/docs/mockup-assets/logos/microsoft.svg index 31b39803..3ce5446e 100644 --- a/apps/docs/mockup-assets/logos/microsoft.svg +++ b/apps/docs/mockup-assets/logos/microsoft.svg @@ -1,6 +1,5 @@ - From b6ee5377db5959bcda1a90266b588bc7c169f1d0 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Mon, 30 Nov 2026 18:59:43 +0000 Subject: [PATCH 03/11] feat(docs): build the landing page option as a full prototype The landing page option is the one to take forward, so this replaces both mockups with a single prototype at /home-prototype/ that renders from content instead of hard-coded data, and drops the in-docs option, which stays in this branch's history. The content lives in a home.json file at the docs root, owned by the docs repo. Its schema is in docs-config so the docs repo's tooling can validate it too: a strict zod schema with length caps, routes limited to internal paths, external links limited to a short host list, and a size cap. The site resolves every link against the page tree, takes titles from the pages unless the file overrides them, builds the section cards from the sidebar's own top-level sections, and drops anything it can't resolve instead of rendering a dead link. Without a home.json it falls back to a fixture with the same content. The page uses coder.com's marketing tokens and type, follows the reader's light or dark theme, and uses Phosphor icons for anything without a mark in the docs repo. A bar at the bottom switches heading tracking between coder.com's values and the docs pages' values, so both can be compared. The route is reserved, marked noindex, and left out of the sitemap and the search index. Assisted-by: AI --- .../home-prototype.css} | 236 +++++++----- apps/docs/app/home-prototype/layout.tsx | 81 ++++ apps/docs/app/home-prototype/page.tsx | 129 +++++++ .../docs/app/home-prototype/prototype-bar.tsx | 68 ++++ apps/docs/app/mockups/home-in-docs/layout.tsx | 8 - apps/docs/app/mockups/home-in-docs/page.tsx | 47 --- apps/docs/app/mockups/home-landing/layout.tsx | 31 -- apps/docs/app/mockups/home-landing/page.tsx | 169 --------- apps/docs/app/mockups/page.tsx | 63 ---- apps/docs/lib/home-prototype/home-blocks.tsx | 243 ++++++++++++ apps/docs/lib/home-prototype/home-content.ts | 95 +++++ apps/docs/lib/home-prototype/home-icons.tsx | 51 +++ apps/docs/lib/home-prototype/home-resolve.ts | 160 ++++++++ .../docs/lib/home-prototype/home.fixture.json | 320 ++++++++++++++++ .../home-prototype}/logos/aws.svg | 0 .../home-prototype}/logos/azure.svg | 0 .../home-prototype}/logos/claude.svg | 0 .../home-prototype}/logos/code.svg | 0 .../home-prototype}/logos/cursor.svg | 0 .../home-prototype}/logos/docker.svg | 0 .../home-prototype}/logos/gcp.svg | 0 .../home-prototype}/logos/github-copilot.svg | 0 .../home-prototype}/logos/github.svg | 0 .../home-prototype}/logos/google.svg | 0 .../home-prototype}/logos/jetbrains.svg | 0 .../home-prototype}/logos/junie.svg | 0 apps/docs/lib/home-prototype/logos/k8s.svg | 11 + .../home-prototype}/logos/microsoft.svg | 0 .../home-prototype}/logos/okta.svg | 0 .../home-prototype}/logos/openai-codex.svg | 0 .../home-prototype}/logos/opencode.svg | 0 .../home-prototype}/logos/zed.svg | 0 apps/docs/lib/mockups/home-blocks.tsx | 172 --------- apps/docs/lib/mockups/home-data.ts | 352 ------------------ .../mockup-assets/icons/ai_intelligence.svg | 1 - .../mockup-assets/icons/computer-code.svg | 20 - apps/docs/mockup-assets/icons/container.svg | 2 - apps/docs/mockup-assets/icons/docker.svg | 3 - apps/docs/mockup-assets/icons/download.svg | 4 - apps/docs/mockup-assets/icons/git.svg | 3 - apps/docs/mockup-assets/icons/home.svg | 3 - apps/docs/mockup-assets/icons/info.svg | 4 - apps/docs/mockup-assets/icons/key.svg | 4 - apps/docs/mockup-assets/icons/kubernetes.svg | 2 - apps/docs/mockup-assets/icons/link.svg | 3 - apps/docs/mockup-assets/icons/lock.svg | 3 - apps/docs/mockup-assets/icons/networking.svg | 4 - apps/docs/mockup-assets/icons/notes.svg | 1 - apps/docs/mockup-assets/icons/openshift.svg | 12 - apps/docs/mockup-assets/icons/picture.svg | 5 - apps/docs/mockup-assets/icons/plug.svg | 5 - apps/docs/mockup-assets/icons/rancher.svg | 5 - apps/docs/mockup-assets/icons/rocket.svg | 6 - apps/docs/mockup-assets/icons/security.svg | 3 - apps/docs/mockup-assets/icons/stairs.svg | 17 - apps/docs/mockup-assets/icons/terminal.svg | 3 - apps/docs/mockup-assets/icons/upgrade.svg | 4 - apps/docs/mockup-assets/icons/users.svg | 4 - apps/docs/mockup-assets/icons/wand.svg | 1 - apps/docs/mockup-assets/icons/wrench.svg | 3 - apps/docs/mockup-assets/logos/aws-dark.svg | 11 - apps/docs/mockup-assets/logos/aws-light.svg | 11 - apps/docs/mockup-assets/logos/gitlab.svg | 6 - apps/docs/mockup-assets/logos/keycloak.svg | 23 -- apps/docs/mockup-assets/logos/kilo-code.svg | 10 - apps/docs/mockup-assets/logos/terminal.svg | 3 - apps/docs/package.json | 1 + apps/docs/scripts/home-resolve.test.mjs | 67 ++++ packages/docs-build/src/reserved-routes.ts | 8 +- packages/docs-config/src/home.test.ts | 104 ++++++ packages/docs-config/src/home.ts | 221 +++++++++++ packages/docs-config/src/index.ts | 10 + pnpm-lock.yaml | 3 + 73 files changed, 1721 insertions(+), 1118 deletions(-) rename apps/docs/app/{mockups/mockups.css => home-prototype/home-prototype.css} (78%) create mode 100644 apps/docs/app/home-prototype/layout.tsx create mode 100644 apps/docs/app/home-prototype/page.tsx create mode 100644 apps/docs/app/home-prototype/prototype-bar.tsx delete mode 100644 apps/docs/app/mockups/home-in-docs/layout.tsx delete mode 100644 apps/docs/app/mockups/home-in-docs/page.tsx delete mode 100644 apps/docs/app/mockups/home-landing/layout.tsx delete mode 100644 apps/docs/app/mockups/home-landing/page.tsx delete mode 100644 apps/docs/app/mockups/page.tsx create mode 100644 apps/docs/lib/home-prototype/home-blocks.tsx create mode 100644 apps/docs/lib/home-prototype/home-content.ts create mode 100644 apps/docs/lib/home-prototype/home-icons.tsx create mode 100644 apps/docs/lib/home-prototype/home-resolve.ts create mode 100644 apps/docs/lib/home-prototype/home.fixture.json rename apps/docs/{mockup-assets => lib/home-prototype}/logos/aws.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/azure.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/claude.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/code.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/cursor.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/docker.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/gcp.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/github-copilot.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/github.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/google.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/jetbrains.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/junie.svg (100%) create mode 100644 apps/docs/lib/home-prototype/logos/k8s.svg rename apps/docs/{mockup-assets => lib/home-prototype}/logos/microsoft.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/okta.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/openai-codex.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/opencode.svg (100%) rename apps/docs/{mockup-assets => lib/home-prototype}/logos/zed.svg (100%) delete mode 100644 apps/docs/lib/mockups/home-blocks.tsx delete mode 100644 apps/docs/lib/mockups/home-data.ts delete mode 100644 apps/docs/mockup-assets/icons/ai_intelligence.svg delete mode 100644 apps/docs/mockup-assets/icons/computer-code.svg delete mode 100644 apps/docs/mockup-assets/icons/container.svg delete mode 100644 apps/docs/mockup-assets/icons/docker.svg delete mode 100644 apps/docs/mockup-assets/icons/download.svg delete mode 100644 apps/docs/mockup-assets/icons/git.svg delete mode 100644 apps/docs/mockup-assets/icons/home.svg delete mode 100644 apps/docs/mockup-assets/icons/info.svg delete mode 100644 apps/docs/mockup-assets/icons/key.svg delete mode 100644 apps/docs/mockup-assets/icons/kubernetes.svg delete mode 100644 apps/docs/mockup-assets/icons/link.svg delete mode 100644 apps/docs/mockup-assets/icons/lock.svg delete mode 100644 apps/docs/mockup-assets/icons/networking.svg delete mode 100644 apps/docs/mockup-assets/icons/notes.svg delete mode 100644 apps/docs/mockup-assets/icons/openshift.svg delete mode 100644 apps/docs/mockup-assets/icons/picture.svg delete mode 100644 apps/docs/mockup-assets/icons/plug.svg delete mode 100644 apps/docs/mockup-assets/icons/rancher.svg delete mode 100644 apps/docs/mockup-assets/icons/rocket.svg delete mode 100644 apps/docs/mockup-assets/icons/security.svg delete mode 100644 apps/docs/mockup-assets/icons/stairs.svg delete mode 100644 apps/docs/mockup-assets/icons/terminal.svg delete mode 100644 apps/docs/mockup-assets/icons/upgrade.svg delete mode 100644 apps/docs/mockup-assets/icons/users.svg delete mode 100644 apps/docs/mockup-assets/icons/wand.svg delete mode 100644 apps/docs/mockup-assets/icons/wrench.svg delete mode 100644 apps/docs/mockup-assets/logos/aws-dark.svg delete mode 100644 apps/docs/mockup-assets/logos/aws-light.svg delete mode 100644 apps/docs/mockup-assets/logos/gitlab.svg delete mode 100644 apps/docs/mockup-assets/logos/keycloak.svg delete mode 100644 apps/docs/mockup-assets/logos/kilo-code.svg delete mode 100644 apps/docs/mockup-assets/logos/terminal.svg create mode 100644 apps/docs/scripts/home-resolve.test.mjs create mode 100644 packages/docs-config/src/home.test.ts create mode 100644 packages/docs-config/src/home.ts diff --git a/apps/docs/app/mockups/mockups.css b/apps/docs/app/home-prototype/home-prototype.css similarity index 78% rename from apps/docs/app/mockups/mockups.css rename to apps/docs/app/home-prototype/home-prototype.css index e0f8655a..ec7a2df8 100644 --- a/apps/docs/app/mockups/mockups.css +++ b/apps/docs/app/home-prototype/home-prototype.css @@ -1,4 +1,4 @@ -/* Docs home page mockups. Values come from coder.com's design system +/* The docs home page prototype. Values come from coder.com's design system * (coder/coder.com-new packages/ui/styles/tokens.css and ramps.css); the * fd colour tokens they sit on already match it (docs-theme brand.css). */ @@ -33,7 +33,7 @@ --mk-text-muted: #9f9fa6; --mk-text-faint: #82828a; --mk-surface: #131314; - --mk-bg-subtle: #131314; + --mk-bg-subtle: #17171a; --mk-fill-hover: #262629; --mk-solid: #ffffff; --mk-on-solid: #090b0b; @@ -43,17 +43,6 @@ /* ---------- Shared ---------- */ -.mk-mask-icon { - display: inline-block; - width: 1.25rem; - height: 1.25rem; - flex: none; - background-color: currentColor; - mask-size: contain; - mask-repeat: no-repeat; - mask-position: center; -} - .mk-logo { width: 1.5rem; height: 1.5rem; @@ -74,65 +63,14 @@ .mk-eyebrow { font-family: var(--font-mono); font-size: 0.75rem; + font-weight: 500; line-height: 1.2; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mk-text-muted); } -/* ---------- Mockup A: inside the docs layout ---------- */ - -.mk-in-docs .mk-row-label { - margin: 0 0 0.5rem; -} -/* Compact logo cards: the proposed `cards logos` variant. */ -.mk-in-docs .mk-logo-cards { - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: 0.5rem; -} -@media (max-width: 640px) { - .mk-in-docs .mk-logo-cards { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} -.mk-in-docs .mk-logo-cards > a { - /* Fumadocs' Card is display: block and spans the full row in narrow - * containers (@max-lg:col-span-full); the compact variant keeps the grid. */ - display: flex; - grid-column: auto; - flex-direction: row; - align-items: center; - gap: 0.75rem; - padding: 0.75rem; -} -.mk-in-docs .mk-logo-cards > a > * { - margin: 0; -} -/* Compact link tiles: the proposed `cards links` variant, a title and an arrow. */ -.mk-in-docs .mk-link-cards { - gap: 0.5rem; -} -.mk-in-docs .mk-link-cards > a { - display: flex; - align-items: center; - justify-content: space-between; - padding: 0.75rem 1rem; -} -.mk-in-docs .mk-link-cards > a > * { - margin: 0; -} -.mk-in-docs .mk-link-cards > a::after { - content: "\2197"; - color: var(--mk-text-faint); -} -.mk-in-docs-closing { - margin-top: 2.5rem; - padding-top: 1.5rem; - border-top: 1px solid var(--color-fd-border); - padding-bottom: 2rem; -} - -/* ---------- Mockup B: standalone landing page ---------- */ +/* ---------- Standalone landing page ---------- */ .mk-landing { --mk-frame: 1280px; @@ -149,7 +87,7 @@ position: relative; isolation: isolate; overflow: hidden; - padding-block: clamp(3.5rem, 7vw, 7rem) clamp(3rem, 6vw, 5.5rem); + padding-block: clamp(3.5rem, 7vw, 7rem) clamp(2.5rem, 4vw, 3.5rem); border-bottom: 1px solid var(--mk-grid-line); } .mk-hero::before { @@ -338,6 +276,12 @@ font-size: 0.75rem; color: var(--mk-screen-muted); } +.mk-window-title { + margin: 0; + font: inherit; + letter-spacing: inherit; + color: inherit; +} .mk-window-dots { display: inline-flex; gap: 0.375rem; @@ -361,6 +305,11 @@ .mk-window-comment { color: var(--mk-screen-muted); } +.mk-window-step { + display: flex; + flex-direction: column; + gap: 0.375rem; +} .mk-window-command { margin: 0; padding: 0.75rem 1rem; @@ -466,7 +415,7 @@ margin: 0.25rem 0 0; font-size: clamp(1.375rem, 1.3rem + 0.35vw, 1.5rem); line-height: 1.15; - letter-spacing: -0.005em; + letter-spacing: -0.02em; font-weight: 500; } .mk-door-title a:hover { @@ -532,15 +481,16 @@ border-inline-start: 1px solid var(--mk-line-subtle); } /* Top-aligned, so a label that wraps to two lines keeps its logo level with - * its neighbours'. */ + * its neighbours'; the cell grows rather than letting the label cross its + * border. */ .mk-logo-chip { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.625rem; - height: 6rem; - padding: 1.25rem 0.5rem 0; + min-height: 6rem; + padding: 1.25rem 0.5rem 1rem; font-size: 0.875rem; text-align: center; color: var(--color-fd-foreground); @@ -553,24 +503,28 @@ width: 1.75rem; height: 1.75rem; } +/* Phosphor glyphs stand in for marks the repo has no file for; they take the + * text colour, so they need no filter. */ +.mk-logo-chip .mk-logo-glyph { + color: var(--color-fd-foreground); +} /* Monochrome by default, as coder.com's logo strip is; brand colour on hover * or focus. The filters push each mark's luminance towards the text colour * (dark in light mode, near white in dark mode) without flattening the white * details some marks carry. Light- and dark-tone marks keep their theme * inversion instead. */ -.mk-logo-chip .mk-logo:not([data-tone]), -.mk-logo-cards .mk-logo:not([data-tone]) { +.mk-logo-chip .mk-logo:not([data-tone], .mk-logo-glyph) { filter: grayscale(1) brightness(0.5) contrast(1.4); transition: filter 150ms var(--mk-ease); } -.dark .mk-logo-chip .mk-logo:not([data-tone]), -.dark .mk-logo-cards .mk-logo:not([data-tone]) { +.dark .mk-logo-chip .mk-logo:not([data-tone], .mk-logo-glyph) { filter: grayscale(1) brightness(2.2); } -.mk-logo-chip:hover .mk-logo:not([data-tone]), -.mk-logo-chip:focus-visible .mk-logo:not([data-tone]), -.mk-logo-cards > a:hover .mk-logo:not([data-tone]), -.mk-logo-cards > a:focus-visible .mk-logo:not([data-tone]) { +.dark .mk-logo-chip .mk-logo[data-invert-dark] { + filter: grayscale(1) invert(1) brightness(1.15); +} +.mk-logo-chip:hover .mk-logo:not([data-tone], .mk-logo-glyph), +.mk-logo-chip:focus-visible .mk-logo:not([data-tone], .mk-logo-glyph) { filter: none; } @@ -580,10 +534,14 @@ .mk-landing .mk-section-cards > div { grid-template-columns: repeat(5, minmax(0, 1fr)); } -.mk-section-cards .mk-mask-icon, -.mk-in-docs .mk-mask-icon { +.mk-section-cards svg { color: var(--color-fd-foreground); } +/* Fumadocs sizes a card icon to 16px; 20px matches the audience icons. */ +.mk-landing .mk-section-cards [data-card] svg { + width: 1.25rem; + height: 1.25rem; +} /* Closing band and footer. */ .mk-help { @@ -665,25 +623,131 @@ padding-block: 1rem 0.5rem; } .mk-logo-chip { - height: 5rem; + min-height: 5rem; padding-top: 0.875rem; + padding-bottom: 0.75rem; + } + /* A phone shows the four most searched topics, so the buttons stay near + * the first screen, and drops the keyboard shortcut hint. */ + .mk-pills-list li:nth-child(n + 5) { + display: none; + } + .mk-hero-search kbd { + display: none; } } /* Motion: the system setting and the docs' own reduced-motion preference. */ @media (prefers-reduced-motion: reduce) { - .mk-landing *, - .mk-in-docs * { + .mk-landing * { transition-duration: 0.01ms !important; } .mk-button:active { transform: none; } } -[data-motion="reduced"] .mk-landing *, -[data-motion="reduced"] .mk-in-docs * { +[data-motion="reduced"] .mk-landing * { transition-duration: 0.01ms !important; } [data-motion="reduced"] .mk-button:active { transform: none; } + +/* Heading tracking. coder.com's values are the default above (h1 -0.04em, + * h2 -0.025em, h3 -0.02em); the prototype bar switches to the docs theme's + * current values (h1 -0.02em, h2 -0.005em, h3 normal) for comparison. */ +[data-mk-tracking="docs"] .mk-hero-title { + letter-spacing: -0.02em; +} +[data-mk-tracking="docs"] .mk-section-title { + letter-spacing: -0.005em; +} +[data-mk-tracking="docs"] .mk-door-title { + letter-spacing: normal; +} + +/* Visible keyboard focus on every control the page adds. */ +.mk-landing + :is( + .mk-pill, + .mk-button, + .mk-logo-chip, + .mk-door-links a, + .mk-door-title a, + .mk-window-foot a, + .mk-footer-links a + ):focus-visible { + outline: 2px solid var(--color-fd-ring, var(--mk-violet)); + outline-offset: 2px; + border-radius: 4px; +} + +/* Prototype bar: review controls, not part of the design. */ +.mk-proto-bar { + position: fixed; + inset-inline: 0; + bottom: 0.75rem; + z-index: 40; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem 1rem; + width: fit-content; + max-width: calc(100vw - 1.5rem); + margin-inline: auto; + padding: 0.5rem 0.875rem; + border: 1px solid var(--mk-line); + border-radius: 8px; + background: var(--color-fd-popover, var(--mk-surface)); + box-shadow: 0 8px 24px -6px rgb(0 0 0 / 0.25); + font-size: 0.8125rem; + color: var(--color-fd-foreground); +} +.mk-proto-badge { + font-family: var(--font-mono); + font-size: 0.6875rem; + font-weight: 500; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--mk-text-muted); +} +.mk-proto-group { + display: flex; + align-items: center; + gap: 0.75rem; + margin: 0; + padding: 0; + border: 0; +} +.mk-proto-group legend { + float: left; + margin-inline-end: 0.25rem; + padding: 0; + color: var(--mk-text-muted); +} +.mk-proto-option { + display: inline-flex; + align-items: center; + gap: 0.375rem; + cursor: pointer; +} +.mk-proto-option input { + accent-color: var(--color-fd-foreground); +} +.mk-proto-source { + color: var(--mk-text-muted); +} +.mk-proto-issues summary { + cursor: pointer; + color: var(--color-fd-error, #e5484d); +} +.mk-proto-issues ul { + max-height: 12rem; + overflow: auto; + margin: 0.5rem 0 0; + padding-inline-start: 1rem; +} +/* Room for the bar under the footer, so it never covers the last line. */ +.mk-footer { + padding-bottom: 5rem; +} diff --git a/apps/docs/app/home-prototype/layout.tsx b/apps/docs/app/home-prototype/layout.tsx new file mode 100644 index 00000000..418d9446 --- /dev/null +++ b/apps/docs/app/home-prototype/layout.tsx @@ -0,0 +1,81 @@ +import { DocsProvider, createBaseOptions, versionSwitcherOptions } from "@coder/docs-next"; +import { RuntimeVersionSwitcher } from "@coder/docs-ui"; +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import { notFound } from "next/navigation"; +import type { ReactNode } from "react"; +import { versionHasSlug } from "@/lib/sources"; +import { versions } from "@/lib/versions"; +import "./home-prototype.css"; + +const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); + +// The docs home page prototype: Fumadocs' HomeLayout (navbar, no sidebar). +// With no sidebar to hold them, the navbar carries what the docs shell's +// sidebar does: the version switcher, the docs search, and display settings. +// The social links move into the phone menu, so the navbar fits from 1024px, +// where HomeLayout starts showing its links; the footer still links GitHub. +// +// For review only: a publish (DOCS_PUBLISH=1) renders a 404 here, so the +// prototype cannot ship on the public site. It is also absent from the +// sitemap and the search index, which are built from the docs sources. +export default function Layout({ children }: { children: ReactNode }) { + if (process.env.DOCS_PUBLISH === "1") notFound(); + const base = createBaseOptions(); + const current = versions.find((version) => version.latest) ?? versions[0]; + const options = current + ? versionSwitcherOptions( + versions, + current.id, + [], + (version, slug) => versionHasSlug(version.id, slug), + basePath, + ) + : []; + const switcher = current ? ( + + ) : null; + return ( + + ; the phone + // menu is not a list, so its copy has none. + { + type: "custom" as const, + on: "nav" as const, + secondary: true, + children:
  • {switcher}
  • , + }, + { + type: "custom" as const, + on: "menu" as const, + secondary: true, + children:
    {switcher}
    , + }, + ] + : []), + ...(base.links ?? []).map((link) => ({ ...link, on: "menu" as const })), + ]} + > + {children} + + + ); +} diff --git a/apps/docs/app/home-prototype/page.tsx b/apps/docs/app/home-prototype/page.tsx new file mode 100644 index 00000000..02c3c060 --- /dev/null +++ b/apps/docs/app/home-prototype/page.tsx @@ -0,0 +1,129 @@ +import { Copyright } from "@coder/docs-ui"; +import { FullSearchTrigger } from "fumadocs-ui/layouts/shared/slots/search-trigger"; +import type { Metadata } from "next"; +import Link from "next/link"; +import { + AudienceDoors, + InstallWindow, + LogoWall, + PopularPills, + SectionCards, + SectionHead, +} from "@/lib/home-prototype/home-blocks"; +import { loadHome } from "@/lib/home-prototype/home-content"; +import { PrototypeBar } from "./prototype-bar"; + +export const metadata: Metadata = { + title: "Docs home page prototype", + robots: { index: false, follow: false }, +}; + +export default function Page() { + const { props, from, issues } = loadHome(); + const { hero, help } = props; + return ( + <> +
    +
    +
    + Coder docs +

    + {hero.title} +

    + {hero.description ?

    {hero.description}

    : null} + + +
    + + {hero.primary.title} + + + {hero.secondary.title} + +
    +
    + +
    +
    + +
    +
    + + +
    +
    + + {props.integrations.length > 0 ? ( +
    +
    + + +
    +
    + ) : null} + +
    +
    + +
    + +
    +
    +
    + +
    +
    +
    +

    + {help.title} +

    +

    {help.text}

    +
    +
    + {help.links.map((link, index) => { + const className = `mk-button ${index === 0 ? "mk-button-primary" : "mk-button-secondary"}`; + return link.external ? ( + + {link.title} + + ) : ( + + {link.title} + + ); + })} +
    +
    +
    + + + + + + ); +} diff --git a/apps/docs/app/home-prototype/prototype-bar.tsx b/apps/docs/app/home-prototype/prototype-bar.tsx new file mode 100644 index 00000000..1238cfe3 --- /dev/null +++ b/apps/docs/app/home-prototype/prototype-bar.tsx @@ -0,0 +1,68 @@ +"use client"; + +import { useEffect, useState } from "react"; + +type Tracking = "site" | "docs"; + +const OPTIONS: { value: Tracking; label: string }[] = [ + { value: "site", label: "coder.com" }, + { value: "docs", label: "Docs today" }, +]; + +/** + * The prototype's toolbar: which heading tracking to show, where the content + * came from, and any problems the home file has. The tracking choice is a data + * attribute on , so it works in a static export; `?tracking=docs` opens + * the page with it set, for screenshots and links. + */ +export function PrototypeBar({ from, issues }: { from: "corpus" | "fixture"; issues: string[] }) { + const [tracking, setTracking] = useState("site"); + + useEffect(() => { + const requested = new URLSearchParams(window.location.search).get("tracking"); + if (requested === "docs" || requested === "site") setTracking(requested); + }, []); + + useEffect(() => { + document.documentElement.dataset.mkTracking = tracking; + return () => { + delete document.documentElement.dataset.mkTracking; + }; + }, [tracking]); + + return ( + + ); +} diff --git a/apps/docs/app/mockups/home-in-docs/layout.tsx b/apps/docs/app/mockups/home-in-docs/layout.tsx deleted file mode 100644 index ad027ca0..00000000 --- a/apps/docs/app/mockups/home-in-docs/layout.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import type { ReactNode } from "react"; -import { VersionedShell } from "@/lib/versioned-shell"; -import "../mockups.css"; - -// Mockup A keeps the real docs shell: sidebar, navbar search, version switcher. -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} diff --git a/apps/docs/app/mockups/home-in-docs/page.tsx b/apps/docs/app/mockups/home-in-docs/page.tsx deleted file mode 100644 index 8adc2180..00000000 --- a/apps/docs/app/mockups/home-in-docs/page.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page"; -import type { Metadata } from "next"; -import { AudienceTabs, LogoCards, PopularCards, SectionCards } from "@/lib/mockups/home-blocks"; -import { hero } from "@/lib/mockups/home-data"; - -export const metadata: Metadata = { - title: "Home mockup A: inside the docs layout", - robots: { index: false, follow: false }, -}; - -// Every block here is one a Markdown page can produce: front matter for the -// title and description, headings, and Fumadocs Cards and Tabs from the -// `
    ` and `
    ` blocks. Card icons and the -// compact logo cards are the two proposed additions to the cards syntax. -export default function Page() { - return ( - - {hero.title} - {hero.description} - -

    - New to Coder? Start with the Quickstart, or pick the guides for - your role. -

    -

    Find your path

    - - - -

    Works with

    - -

    Browse the docs

    - -

    - Can't find what you need? Visit Support to ask the community on - Discord, open a GitHub issue, or contact support. -

    -
    -
    - ); -} diff --git a/apps/docs/app/mockups/home-landing/layout.tsx b/apps/docs/app/mockups/home-landing/layout.tsx deleted file mode 100644 index 18f05364..00000000 --- a/apps/docs/app/mockups/home-landing/layout.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { DocsProvider, createBaseOptions } from "@coder/docs-next"; -import { HomeLayout } from "fumadocs-ui/layouts/home"; -import type { ReactNode } from "react"; -import "../mockups.css"; - -const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); - -// Mockup B: Fumadocs' HomeLayout (navbar, no sidebar) with the docs search -// and display settings the docs shell uses, so search works from the hero. -export default function Layout({ children }: { children: ReactNode }) { - const base = createBaseOptions(); - return ( - - - {children} - - - ); -} diff --git a/apps/docs/app/mockups/home-landing/page.tsx b/apps/docs/app/mockups/home-landing/page.tsx deleted file mode 100644 index 0da1fb82..00000000 --- a/apps/docs/app/mockups/home-landing/page.tsx +++ /dev/null @@ -1,169 +0,0 @@ -import { Copyright } from "@coder/docs-ui"; -import { FullSearchTrigger } from "fumadocs-ui/layouts/shared/slots/search-trigger"; -import type { Metadata } from "next"; -import Link from "next/link"; -import type { ReactNode } from "react"; -import { AudienceDoors, LogoWall, PopularPills, SectionCards } from "@/lib/mockups/home-blocks"; -import { hero } from "@/lib/mockups/home-data"; - -export const metadata: Metadata = { - title: "Home mockup B: standalone landing page", - robots: { index: false, follow: false }, -}; - -function SectionHead({ - id, - eyebrow, - title, - lead, -}: { - id: string; - eyebrow: string; - title: string; - lead: ReactNode; -}) { - return ( -
    -
    -

    {eyebrow}

    -

    - {title} -

    -
    -

    {lead}

    -
    - ); -} - -// The install commands and the Windows alternative are the Quickstart's -// (docs/get-started/index.md, Step 2). -function InstallWindow() { - return ( -
    -
    - - - - - - Install Coder on Linux or macOS -
    -
    - # Install the coder CLI -
    -          curl -fsSL{" "}
    -          https://coder.com/install.sh |{" "}
    -          sh
    -        
    - # Start Coder -
    -          coder server
    -        
    -
    -
    - - On Windows: winget install Coder.Coder - - Follow the Quickstart -
    -
    - ); -} - -export default function Page() { - return ( - <> -
    -
    -
    - Coder docs -

    {hero.title}

    -

    {hero.description}

    - - -
    - - {hero.primary.title} - - - {hero.secondary.title} - -
    -
    - -
    -
    - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    -

    - Can't find what you need? -

    -

    - Ask the community on Discord, open a GitHub issue, or contact support. -

    -
    -
    - - Get support - - - Join Discord - -
    -
    -
    - - - - ); -} diff --git a/apps/docs/app/mockups/page.tsx b/apps/docs/app/mockups/page.tsx deleted file mode 100644 index 329917b4..00000000 --- a/apps/docs/app/mockups/page.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import type { Metadata } from "next"; -import Link from "next/link"; -import "./mockups.css"; - -export const metadata: Metadata = { - title: "Docs home page mockups", - robots: { index: false, follow: false }, -}; - -const mockups = [ - { - href: "/mockups/home-in-docs/", - title: "A: inside the docs layout", - description: - "Keeps the sidebar. Built only from blocks a Markdown page can produce: Fumadocs Cards and Tabs, plus two proposed additions to the cards syntax (card icons and compact logo cards).", - }, - { - href: "/mockups/home-landing/", - title: "B: standalone landing page", - description: - "Fumadocs' HomeLayout with no sidebar: a hero with search, a door for each audience, a logo wall, and section cards, styled with coder.com's design system.", - }, -]; - -export default function Page() { - return ( -
    -

    DOCS-1904

    -

    - Docs home page mockups -

    -

    - Both mockups use the same content and the same links into the current docs. Compare them in - light and dark mode and on a phone. Neither is wired to a Markdown source yet. -

    -
      - {mockups.map((mockup) => ( -
    • - - - {mockup.title} - - - {mockup.description} - - -
    • - ))} -
    -
    - ); -} diff --git a/apps/docs/lib/home-prototype/home-blocks.tsx b/apps/docs/lib/home-prototype/home-blocks.tsx new file mode 100644 index 00000000..172ee43d --- /dev/null +++ b/apps/docs/lib/home-prototype/home-blocks.tsx @@ -0,0 +1,243 @@ +import { Card, Cards } from "fumadocs-ui/components/card"; +import Link from "next/link"; +import type { ReactNode } from "react"; +import { HomeIcon } from "./home-icons"; +import type { HomeProps, ResolvedLogo } from "./home-resolve"; +import aws from "./logos/aws.svg"; +import azure from "./logos/azure.svg"; +import claude from "./logos/claude.svg"; +import vscode from "./logos/code.svg"; +import cursor from "./logos/cursor.svg"; +import docker from "./logos/docker.svg"; +import gcp from "./logos/gcp.svg"; +import copilot from "./logos/github-copilot.svg"; +import github from "./logos/github.svg"; +import google from "./logos/google.svg"; +import jetbrains from "./logos/jetbrains.svg"; +import junie from "./logos/junie.svg"; +import kubernetes from "./logos/k8s.svg"; +import microsoft from "./logos/microsoft.svg"; +import okta from "./logos/okta.svg"; +import codex from "./logos/openai-codex.svg"; +import opencode from "./logos/opencode.svg"; +import zed from "./logos/zed.svg"; + +// The marks are bundled as static assets, so every build, including a +// preview, ships them without a copy step. Keyed by the file name the +// resolver gives each mark. +const LOGO_SRC: Record = { + "aws.svg": aws, + "azure.svg": azure, + "claude.svg": claude, + "code.svg": vscode, + "cursor.svg": cursor, + "docker.svg": docker, + "gcp.svg": gcp, + "github-copilot.svg": copilot, + "github.svg": github, + "google.svg": google, + "jetbrains.svg": jetbrains, + "junie.svg": junie, + "k8s.svg": kubernetes, + "microsoft.svg": microsoft, + "okta.svg": okta, + "openai-codex.svg": codex, + "opencode.svg": opencode, + "zed.svg": zed, +}; + +function LogoImage({ logo }: { logo: ResolvedLogo }) { + const src = LOGO_SRC[logo.file]?.src; + if (!src) return null; + return ( + // oxlint-disable-next-line nextjs/no-img-element -- static SVG marks; next/image adds nothing for SVG. + + ); +} + +/** Section heading row: eyebrow and title on the left, lead on the right. */ +export function SectionHead({ + id, + eyebrow, + title, + lead, +}: { + id: string; + eyebrow: string; + title: string; + lead: ReactNode; +}) { + return ( +
    +
    +

    {eyebrow}

    +

    + {title} +

    +
    +

    {lead}

    +
    + ); +} + +// Colours a shell command the way coder.com's product screens do: the program +// after the start or a pipe, flags, and URLs. Text only, never markup from the +// file. +function Command({ command }: { command: string }) { + const tokens = command.split(" "); + let program = true; + return ( +
    +      {tokens.map((token, index) => {
    +        const kind = program
    +          ? "mk-cmd"
    +          : token.startsWith("-")
    +            ? "mk-flag"
    +            : token.includes("://")
    +              ? "mk-str"
    +              : undefined;
    +        program = token === "|";
    +        return (
    +          // oxlint-disable-next-line react/no-array-index-key -- tokens repeat and never reorder.
    +          
    +            {index > 0 ? " " : null}
    +            {token}
    +          
    +        );
    +      })}
    +    
    + ); +} + +/** The Quickstart's install commands in an always-dark product window. */ +export function InstallWindow({ install }: { install: HomeProps["install"] }) { + return ( +
    +
    + + + + + +

    + {install.title} +

    +
    +
    + {install.steps.map((step) => ( +
    + # {step.comment} + +
    + ))} +
    +
    + {install.windows ? ( + + On Windows: {install.windows} + + ) : null} + {install.link.title} +
    +
    + ); +} + +/** Popular searches as pills under the hero search. */ +export function PopularPills({ links }: { links: HomeProps["popular"] }) { + return ( +
    + + Popular: + +
      + {links.map((item) => ( +
    • + + {item.title} + +
    • + ))} +
    +
    + ); +} + +/** One door per audience, every door visible at once. */ +export function AudienceDoors({ audiences }: { audiences: HomeProps["audiences"] }) { + return ( +
    + {audiences.map((audience) => ( +
    +
    + +

    {audience.label}

    +
    +

    + {audience.title} +

    +

    {audience.description}

    +
      + {audience.links.map((link) => ( +
    • + {link.title} +
    • + ))} +
    +
    + ))} +
    + ); +} + +/** A static, labelled logo wall: one row per category, every mark a link. */ +export function LogoWall({ rows }: { rows: HomeProps["integrations"] }) { + return ( +
    + {rows.map((row) => ( +
    +

    {row.label}

    +
      + {row.items.map((item) => ( +
    • + + {item.logo ? ( + + ) : item.icon ? ( + + ) : null} + {item.name} + +
    • + ))} +
    +
    + ))} +
    + ); +} + +/** Every top-level section as a Fumadocs card, in sidebar order. */ +export function SectionCards({ sections }: { sections: HomeProps["sections"] }) { + return ( + + {sections.map((section) => ( + } + /> + ))} + + ); +} diff --git a/apps/docs/lib/home-prototype/home-content.ts b/apps/docs/lib/home-prototype/home-content.ts new file mode 100644 index 00000000..781653a6 --- /dev/null +++ b/apps/docs/lib/home-prototype/home-content.ts @@ -0,0 +1,95 @@ +// Loads the landing page's content. A single-version build (the publisher's +// mode, and the local preview with DOCS_ROOT) reads the corpus's own +// `home.json` beside README.md when it has one; every other build, and a +// corpus file that fails validation, uses the committed fixture, which is in +// the same format. Syncing the file for multi-version builds is left for the +// engine decision this prototype is for. +import { readFileSync, statSync } from "node:fs"; +import path from "node:path"; +import { + MAX_HOME_FILE_BYTES, + homeFileSchema, + parseHomeFile, + stripCodeTitle, +} from "@coder/docs-config"; +import { latestSource } from "@/lib/sources"; +import { singleVersionFromEnv } from "../../scripts/single-version.mjs"; +import fixture from "./home.fixture.json"; +import { type HomeProps, type PageLookup, resolveHome } from "./home-resolve"; + +export const HOME_FILE = "home.json"; + +export type LoadedHome = { + props: HomeProps; + /** Where the content came from, for the prototype's toolbar. */ + from: "corpus" | "fixture"; + issues: string[]; +}; + +function readCorpusFile(): { raw: string } | { issues: string[] } | undefined { + const docsRoot = process.env.DOCS_ROOT; + if (!singleVersionFromEnv(process.env) || !docsRoot) return undefined; + const file = path.join(docsRoot, HOME_FILE); + let size: number; + try { + size = statSync(file).size; + } catch { + return undefined; + } + if (size > MAX_HOME_FILE_BYTES) { + return { issues: [`${HOME_FILE} is ${size} bytes; the limit is ${MAX_HOME_FILE_BYTES}`] }; + } + return { raw: readFileSync(file, "utf8") }; +} + +const lookup: PageLookup = { + page(route) { + const page = latestSource.getPage(route.split("/").filter(Boolean)); + if (!page) return undefined; + const title = page.data.nav_title ?? page.data.title ?? route; + return { + title: stripCodeTitle(title), + description: page.data.description, + headings: new Set(page.data.toc.map((entry) => entry.url.replace(/^#/, ""))), + }; + }, + sections() { + // Each top-level section's card takes its sidebar label (the tree node's + // name, when it is plain text) and its index page's description. + return latestSource.pageTree.children.flatMap((node) => { + const url = + node.type === "page" + ? node.url + : node.type === "folder" && !node.root + ? node.index?.url + : undefined; + const page = url ? latestSource.getPage(url.split("/").filter(Boolean)) : undefined; + if (!url || !page) return []; + const label = "name" in node && typeof node.name === "string" ? node.name : undefined; + return [ + { + href: url, + title: stripCodeTitle(label ?? page.data.nav_title ?? page.data.title ?? url), + description: page.data.description, + }, + ]; + }); + }, +}; + +export function loadHome(): LoadedHome { + const issues: string[] = []; + const corpus = readCorpusFile(); + if (corpus && "raw" in corpus) { + const parsed = parseHomeFile(corpus.raw); + if (parsed.ok) { + const resolved = resolveHome(parsed.data, lookup); + return { props: resolved.props, from: "corpus", issues: resolved.issues }; + } + issues.push(...parsed.issues.map((issue) => `${HOME_FILE} ${issue}`)); + } else if (corpus) { + issues.push(...corpus.issues); + } + const resolved = resolveHome(homeFileSchema.parse(fixture), lookup); + return { props: resolved.props, from: "fixture", issues: [...issues, ...resolved.issues] }; +} diff --git a/apps/docs/lib/home-prototype/home-icons.tsx b/apps/docs/lib/home-prototype/home-icons.tsx new file mode 100644 index 00000000..77ef9415 --- /dev/null +++ b/apps/docs/lib/home-prototype/home-icons.tsx @@ -0,0 +1,51 @@ +import type { HomeIconName as IconName } from "@coder/docs-config"; +import type { Icon } from "@phosphor-icons/react"; +import { + ArrowsLeftRight, + BookOpenText, + ChatsCircle, + DownloadSimple, + GearSix, + HardDrives, + IdentificationBadge, + Key, + Laptop, + Password, + Plugs, + Robot, + RocketLaunch, + ShieldCheck, + Stack, + Terminal, + TerminalWindow, + WifiSlash, +} from "@phosphor-icons/react/ssr"; + +// Every name the home file may use, and nothing else: a name is looked up +// here, never imported dynamically, so the corpus cannot reach other modules. +const ICONS: Record = { + ArrowsLeftRight, + BookOpenText, + ChatsCircle, + DownloadSimple, + GearSix, + HardDrives, + IdentificationBadge, + Key, + Laptop, + Password, + Plugs, + Robot, + RocketLaunch, + ShieldCheck, + Stack, + Terminal, + TerminalWindow, + WifiSlash, +}; + +/** A decorative Phosphor glyph; the text beside it carries the meaning. */ +export function HomeIcon({ name, className }: { name: IconName; className?: string }) { + const Glyph = ICONS[name]; + return ; +} diff --git a/apps/docs/lib/home-prototype/home-resolve.ts b/apps/docs/lib/home-prototype/home-resolve.ts new file mode 100644 index 00000000..a9d3b1b7 --- /dev/null +++ b/apps/docs/lib/home-prototype/home-resolve.ts @@ -0,0 +1,160 @@ +// Turns a validated home file into the props the landing page renders, by +// looking every route up in the version's pages: a link without a title takes +// the page's own, a fragment must name a heading on its page, and the section +// cards are the sidebar's top-level sections. A route that resolves to no page +// is left out and reported rather than rendered as a dead link. +import type { HomeFile, HomeIconName as IconName, HomeLogoName } from "@coder/docs-config"; + +/** + * The file each brand mark name maps to, in lib/home-prototype/logos. `tone` + * marks a single-colour mark: "light" is drawn white for dark backgrounds, + * "dark" is drawn black, and the page inverts it in the theme where it would + * vanish. Marks without a tone are full colour. `invertInDark` is for full + * colour marks with white or black detail inside them (the Kubernetes wheel, + * the JetBrains square), which the dark theme's brightening would flatten. + */ +const LOGOS: Record = { + aws: { file: "aws.svg", tone: "light" }, + azure: { file: "azure.svg" }, + claude: { file: "claude.svg" }, + codex: { file: "openai-codex.svg", tone: "light" }, + copilot: { file: "github-copilot.svg", tone: "light" }, + cursor: { file: "cursor.svg", tone: "light" }, + docker: { file: "docker.svg" }, + gcp: { file: "gcp.svg" }, + github: { file: "github.svg", tone: "light" }, + google: { file: "google.svg" }, + jetbrains: { file: "jetbrains.svg", invertInDark: true }, + junie: { file: "junie.svg" }, + kubernetes: { file: "k8s.svg", invertInDark: true }, + microsoft: { file: "microsoft.svg" }, + okta: { file: "okta.svg", tone: "light" }, + opencode: { file: "opencode.svg", tone: "light" }, + vscode: { file: "code.svg" }, + zed: { file: "zed.svg", tone: "light" }, +}; + +/** What the resolver needs to know about one page. */ +export type PageFacts = { title: string; description?: string; headings: ReadonlySet }; + +/** The version's pages, as the resolver sees them. */ +export interface PageLookup { + page(path: string): PageFacts | undefined; + /** Top-level sidebar sections in sidebar order, each with its index page's route. */ + sections(): { href: string; title: string; description?: string }[]; +} + +export type ResolvedLink = { title: string; href: string; external?: boolean }; +export type ResolvedLogo = { file: string; tone?: "light" | "dark"; invertInDark?: boolean }; + +export type HomeProps = { + hero: { title: string; description?: string; primary: ResolvedLink; secondary: ResolvedLink }; + install: HomeFile["install"]; + popular: ResolvedLink[]; + audiences: { + id: string; + label: string; + title: string; + description: string; + icon: IconName; + href: string; + links: ResolvedLink[]; + }[]; + integrations: { + label: string; + items: { name: string; href: string; logo?: ResolvedLogo; icon?: IconName }[]; + }[]; + sections: { href: string; title: string; description?: string; icon: IconName }[]; + help: { title: string; text: string; links: ResolvedLink[] }; +}; + +const DEFAULT_SECTION_ICON: IconName = "BookOpenText"; + +// `/install/` and `/install` are the same page; the lookup is keyed without +// the trailing slash, and `/` stays `/`. +function normalize(path: string): string { + return path.length > 1 ? path.replace(/\/+$/, "") : path; +} + +export function resolveHome( + file: HomeFile, + lookup: PageLookup, + homeRoute = "/", +): { props: HomeProps; issues: string[] } { + const issues: string[] = []; + + function check(href: string, where: string): PageFacts | undefined { + const [path = "", fragment] = href.split("#"); + const page = lookup.page(normalize(path)); + if (!page) { + issues.push(`${where}: ${href} is not a page in this version`); + return undefined; + } + if (fragment !== undefined && !page.headings.has(fragment)) { + issues.push(`${where}: ${href} names no heading on ${path}`); + return undefined; + } + return page; + } + + function link( + entry: string | { href: string; title?: string }, + where: string, + ): ResolvedLink | undefined { + const { href, title } = typeof entry === "string" ? { href: entry, title: undefined } : entry; + const page = check(href, where); + return page ? { href, title: title ?? page.title } : undefined; + } + + const links = (entries: (string | { href: string; title?: string })[], where: string) => + entries.flatMap((entry, index) => link(entry, `${where}[${index}]`) ?? []); + + const home = lookup.page(normalize(homeRoute)); + const hero = { + title: file.hero.title, + description: file.hero.description ?? home?.description, + primary: link(file.hero.primary, "hero.primary") ?? { ...file.hero.primary }, + secondary: link(file.hero.secondary, "hero.secondary") ?? { ...file.hero.secondary }, + }; + check(file.install.link.href, "install.link"); + + const excluded = new Set(file.sections.exclude.map(normalize)); + const icons = new Map( + Object.entries(file.sections.icons).map(([route, icon]) => [normalize(route), icon]), + ); + + const props: HomeProps = { + hero, + install: file.install, + popular: links(file.popular, "popular"), + audiences: file.audiences.map((audience, index) => { + check(audience.href, `audiences[${index}].href`); + return { ...audience, links: links(audience.links, `audiences[${index}].links`) }; + }), + integrations: file.integrations.map((row, rowIndex) => ({ + label: row.label, + items: row.items.flatMap((item, index) => { + if (!check(item.href, `integrations[${rowIndex}].items[${index}]`)) return []; + const logo = item.logo ? LOGOS[item.logo] : undefined; + return [{ name: item.name, href: item.href, logo, icon: item.icon }]; + }), + })), + sections: lookup + .sections() + .filter((section) => normalize(section.href) !== normalize(homeRoute)) + .filter((section) => !excluded.has(normalize(section.href))) + .map((section) => ({ + ...section, + icon: icons.get(normalize(section.href)) ?? DEFAULT_SECTION_ICON, + })), + help: { + title: file.help.title, + text: file.help.text, + links: file.help.links.flatMap((entry, index) => { + if (entry.href.startsWith("https:")) return [{ ...entry, external: true }]; + return check(entry.href, `help.links[${index}]`) ? [entry] : []; + }), + }, + }; + return { props, issues }; +} diff --git a/apps/docs/lib/home-prototype/home.fixture.json b/apps/docs/lib/home-prototype/home.fixture.json new file mode 100644 index 00000000..20c21614 --- /dev/null +++ b/apps/docs/lib/home-prototype/home.fixture.json @@ -0,0 +1,320 @@ +{ + "hero": { + "title": "Coder documentation", + "primary": { + "title": "Start the Quickstart", + "href": "/get-started" + }, + "secondary": { + "title": "Install Coder", + "href": "/install" + } + }, + "install": { + "title": "Install Coder on Linux or macOS", + "steps": [ + { + "comment": "Install the coder CLI", + "command": "curl -fsSL https://coder.com/install.sh | sh" + }, + { + "comment": "Start Coder", + "command": "coder server" + } + ], + "windows": "winget install Coder.Coder", + "link": { + "title": "Follow the Quickstart", + "href": "/get-started" + } + }, + "popular": [ + { + "title": "Connect over SSH", + "href": "/workspaces/workspace-access#ssh" + }, + { + "title": "Docker in workspaces", + "href": "/templates/extending-templates/docker-in-workspaces" + }, + { + "title": "Reset a password", + "href": "/admin/users/password-auth" + }, + { + "title": "OIDC sign-in", + "href": "/admin/users/oidc-auth" + }, + { + "title": "TLS and reverse proxies", + "href": "/admin/setup#tls--reverse-proxy" + } + ], + "audiences": [ + { + "id": "platform", + "label": "Platform teams", + "title": "Install and run Coder", + "description": "Deploy the control plane on your infrastructure, then secure, scale, and upgrade it.", + "icon": "HardDrives", + "href": "/install", + "links": [ + "/install/server/requirements", + "/install/production-deployment", + { + "title": "Install on Kubernetes", + "href": "/install/server/kubernetes" + }, + "/install/prepare/airgap", + { + "title": "Configure the control plane", + "href": "/admin/setup" + }, + { + "title": "Upgrade Coder", + "href": "/install/operate/upgrade" + } + ] + }, + { + "id": "templates", + "label": "Template authors", + "title": "Build templates", + "description": "Define workspace infrastructure in Terraform, then publish and maintain it.", + "icon": "Stack", + "href": "/templates", + "links": [ + { + "title": "Create a template", + "href": "/templates/creating-templates" + }, + { + "title": "Extend templates", + "href": "/templates/extending-templates" + }, + "/templates/extending-templates/parameters", + "/templates/extending-templates/prebuilt-workspaces", + "/templates/extending-templates/devcontainers", + { + "title": "Manage templates", + "href": "/templates/managing-templates" + } + ] + }, + { + "id": "developers", + "label": "Developers", + "title": "Work in a workspace", + "description": "Open a workspace from your IDE, the terminal, or the browser.", + "icon": "TerminalWindow", + "href": "/workspaces", + "links": [ + { + "title": "Connect to a workspace", + "href": "/workspaces/workspace-access" + }, + { + "title": "VS Code", + "href": "/workspaces/workspace-access/vscode" + }, + { + "title": "JetBrains IDEs", + "href": "/workspaces/workspace-access/jetbrains" + }, + "/workspaces/workspace-access/port-forwarding", + "/workspaces/workspace-access/web-terminal", + "/workspaces/workspace-access/code-server" + ] + }, + { + "id": "ai", + "label": "AI and agent teams", + "title": "Run AI agents", + "description": "Delegate work to coding agents and control how AI is used across your deployment.", + "icon": "Robot", + "href": "/coder-agents", + "links": [ + "/coder-agents", + "/ai-governance", + "/ai-governance/agent-firewall", + { + "title": "AI Gateway clients", + "href": "/ai-governance/ai-gateway/clients" + }, + "/agent-relay", + "/mcp-server" + ] + } + ], + "integrations": [ + { + "label": "Connect from", + "items": [ + { + "name": "VS Code", + "href": "/workspaces/workspace-access/vscode", + "logo": "vscode" + }, + { + "name": "JetBrains", + "href": "/workspaces/workspace-access/jetbrains", + "logo": "jetbrains" + }, + { + "name": "Cursor", + "href": "/workspaces/workspace-access/cursor", + "logo": "cursor" + }, + { + "name": "Zed", + "href": "/workspaces/workspace-access/zed", + "logo": "zed" + }, + { + "name": "Web terminal", + "href": "/workspaces/workspace-access/web-terminal", + "icon": "TerminalWindow" + }, + { + "name": "SSH", + "href": "/workspaces/workspace-access#ssh", + "icon": "Key" + } + ] + }, + { + "label": "Run on", + "items": [ + { + "name": "Kubernetes", + "href": "/install/server/kubernetes", + "logo": "kubernetes" + }, + { + "name": "Docker", + "href": "/install/server/docker", + "logo": "docker" + }, + { + "name": "AWS", + "href": "/install/server/cloud/aws-marketplace", + "logo": "aws" + }, + { + "name": "Azure", + "href": "/install/server/cloud/azure-vm", + "logo": "azure" + }, + { + "name": "Google Cloud", + "href": "/install/server/cloud/compute-engine", + "logo": "gcp" + }, + { + "name": "Air-gapped networks", + "href": "/install/prepare/airgap", + "icon": "WifiSlash" + } + ] + }, + { + "label": "Sign in with", + "items": [ + { + "name": "GitHub", + "href": "/admin/users/github-auth", + "logo": "github" + }, + { + "name": "Okta", + "href": "/admin/users/oidc-auth/configuring-okta", + "logo": "okta" + }, + { + "name": "Microsoft", + "href": "/admin/users/oidc-auth/microsoft", + "logo": "microsoft" + }, + { + "name": "Google", + "href": "/admin/users/oidc-auth/google", + "logo": "google" + }, + { + "name": "Any OIDC provider", + "href": "/admin/users/oidc-auth", + "icon": "IdentificationBadge" + }, + { + "name": "Passwords", + "href": "/admin/users/password-auth", + "icon": "Password" + } + ] + }, + { + "label": "Bring your agent", + "items": [ + { + "name": "Claude Code", + "href": "/ai-governance/ai-gateway/clients/claude-code", + "logo": "claude" + }, + { + "name": "Codex", + "href": "/ai-governance/ai-gateway/clients/codex", + "logo": "codex" + }, + { + "name": "GitHub Copilot", + "href": "/ai-governance/ai-gateway/clients/copilot", + "logo": "copilot" + }, + { + "name": "Junie", + "href": "/ai-governance/ai-gateway/clients/junie", + "logo": "junie" + }, + { + "name": "OpenCode", + "href": "/ai-governance/ai-gateway/clients/opencode", + "logo": "opencode" + }, + { + "name": "Cursor agents", + "href": "/agent-relay/cursor", + "logo": "cursor" + } + ] + } + ], + "sections": { + "exclude": ["/support"], + "icons": { + "/get-started": "RocketLaunch", + "/install": "DownloadSimple", + "/templates": "Stack", + "/workspaces": "Laptop", + "/coder-agents": "ChatsCircle", + "/ai-governance": "ShieldCheck", + "/agent-relay": "ArrowsLeftRight", + "/mcp-server": "Plugs", + "/admin": "GearSix", + "/reference": "BookOpenText" + } + }, + "help": { + "title": "Can't find what you need?", + "text": "Ask the community on Discord, open a GitHub issue, or contact support.", + "links": [ + { + "title": "Get support", + "href": "/support" + }, + { + "title": "Join Discord", + "href": "https://discord.gg/coder" + } + ] + } +} diff --git a/apps/docs/mockup-assets/logos/aws.svg b/apps/docs/lib/home-prototype/logos/aws.svg similarity index 100% rename from apps/docs/mockup-assets/logos/aws.svg rename to apps/docs/lib/home-prototype/logos/aws.svg diff --git a/apps/docs/mockup-assets/logos/azure.svg b/apps/docs/lib/home-prototype/logos/azure.svg similarity index 100% rename from apps/docs/mockup-assets/logos/azure.svg rename to apps/docs/lib/home-prototype/logos/azure.svg diff --git a/apps/docs/mockup-assets/logos/claude.svg b/apps/docs/lib/home-prototype/logos/claude.svg similarity index 100% rename from apps/docs/mockup-assets/logos/claude.svg rename to apps/docs/lib/home-prototype/logos/claude.svg diff --git a/apps/docs/mockup-assets/logos/code.svg b/apps/docs/lib/home-prototype/logos/code.svg similarity index 100% rename from apps/docs/mockup-assets/logos/code.svg rename to apps/docs/lib/home-prototype/logos/code.svg diff --git a/apps/docs/mockup-assets/logos/cursor.svg b/apps/docs/lib/home-prototype/logos/cursor.svg similarity index 100% rename from apps/docs/mockup-assets/logos/cursor.svg rename to apps/docs/lib/home-prototype/logos/cursor.svg diff --git a/apps/docs/mockup-assets/logos/docker.svg b/apps/docs/lib/home-prototype/logos/docker.svg similarity index 100% rename from apps/docs/mockup-assets/logos/docker.svg rename to apps/docs/lib/home-prototype/logos/docker.svg diff --git a/apps/docs/mockup-assets/logos/gcp.svg b/apps/docs/lib/home-prototype/logos/gcp.svg similarity index 100% rename from apps/docs/mockup-assets/logos/gcp.svg rename to apps/docs/lib/home-prototype/logos/gcp.svg diff --git a/apps/docs/mockup-assets/logos/github-copilot.svg b/apps/docs/lib/home-prototype/logos/github-copilot.svg similarity index 100% rename from apps/docs/mockup-assets/logos/github-copilot.svg rename to apps/docs/lib/home-prototype/logos/github-copilot.svg diff --git a/apps/docs/mockup-assets/logos/github.svg b/apps/docs/lib/home-prototype/logos/github.svg similarity index 100% rename from apps/docs/mockup-assets/logos/github.svg rename to apps/docs/lib/home-prototype/logos/github.svg diff --git a/apps/docs/mockup-assets/logos/google.svg b/apps/docs/lib/home-prototype/logos/google.svg similarity index 100% rename from apps/docs/mockup-assets/logos/google.svg rename to apps/docs/lib/home-prototype/logos/google.svg diff --git a/apps/docs/mockup-assets/logos/jetbrains.svg b/apps/docs/lib/home-prototype/logos/jetbrains.svg similarity index 100% rename from apps/docs/mockup-assets/logos/jetbrains.svg rename to apps/docs/lib/home-prototype/logos/jetbrains.svg diff --git a/apps/docs/mockup-assets/logos/junie.svg b/apps/docs/lib/home-prototype/logos/junie.svg similarity index 100% rename from apps/docs/mockup-assets/logos/junie.svg rename to apps/docs/lib/home-prototype/logos/junie.svg diff --git a/apps/docs/lib/home-prototype/logos/k8s.svg b/apps/docs/lib/home-prototype/logos/k8s.svg new file mode 100644 index 00000000..5ef695d1 --- /dev/null +++ b/apps/docs/lib/home-prototype/logos/k8s.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/docs/mockup-assets/logos/microsoft.svg b/apps/docs/lib/home-prototype/logos/microsoft.svg similarity index 100% rename from apps/docs/mockup-assets/logos/microsoft.svg rename to apps/docs/lib/home-prototype/logos/microsoft.svg diff --git a/apps/docs/mockup-assets/logos/okta.svg b/apps/docs/lib/home-prototype/logos/okta.svg similarity index 100% rename from apps/docs/mockup-assets/logos/okta.svg rename to apps/docs/lib/home-prototype/logos/okta.svg diff --git a/apps/docs/mockup-assets/logos/openai-codex.svg b/apps/docs/lib/home-prototype/logos/openai-codex.svg similarity index 100% rename from apps/docs/mockup-assets/logos/openai-codex.svg rename to apps/docs/lib/home-prototype/logos/openai-codex.svg diff --git a/apps/docs/mockup-assets/logos/opencode.svg b/apps/docs/lib/home-prototype/logos/opencode.svg similarity index 100% rename from apps/docs/mockup-assets/logos/opencode.svg rename to apps/docs/lib/home-prototype/logos/opencode.svg diff --git a/apps/docs/mockup-assets/logos/zed.svg b/apps/docs/lib/home-prototype/logos/zed.svg similarity index 100% rename from apps/docs/mockup-assets/logos/zed.svg rename to apps/docs/lib/home-prototype/logos/zed.svg diff --git a/apps/docs/lib/mockups/home-blocks.tsx b/apps/docs/lib/mockups/home-blocks.tsx deleted file mode 100644 index 156983ee..00000000 --- a/apps/docs/lib/mockups/home-blocks.tsx +++ /dev/null @@ -1,172 +0,0 @@ -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; -import Link from "next/link"; -import { audiences, commonTasks, logoRows, popular, sections, type Logo } from "./home-data"; - -const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); -const asset = (path: string) => `${basePath}/mockups/${path}`; - -/** A stroke-only docs icon, drawn in the current text colour through a CSS mask. */ -export function MaskIcon({ name, className = "" }: { name: string; className?: string }) { - const url = `url(${asset(`icons/${name}.svg`)})`; - return ( - - ); -} - -function LogoImage({ logo }: { logo: Logo }) { - return ( - // oxlint-disable-next-line nextjs/no-img-element -- static SVG logos in a mockup. - - ); -} - -/** Section cards: Fumadocs' own Card, with the section's sidebar icon. */ -export function SectionCards() { - return ( - - {sections.map((section) => ( - } - /> - ))} - - ); -} - -/** Common tasks as Fumadocs cards, which the existing Markdown cards syntax produces. */ -export function PopularCards() { - return ( - - {commonTasks.map((item) => ( - - ))} - - ); -} - -/** Logo rows as compact Fumadocs cards: one proposed `cards` variant in Markdown. */ -export function LogoCards() { - return ( -
    - {logoRows.map((row) => ( -
    -

    {row.label}

    - - {row.logos.map((logo) => ( - } - /> - ))} - -
    - ))} -
    - ); -} - -/** Audiences in Fumadocs tabs, which the existing Markdown tabs syntax produces. */ -export function AudienceTabs() { - return ( - a.tab)}> - {audiences.map((audience) => ( - -

    {audience.description}

    - - {audience.links.map((link) => ( - - ))} - -
    - ))} -
    - ); -} - -/** Landing page: popular searches as pills under the hero search. */ -export function PopularPills() { - return ( -
    - - Popular: - -
      - {popular.map((item) => ( -
    • - - {item.title} - -
    • - ))} -
    -
    - ); -} - -/** Landing page: one door per audience, every door visible at once. */ -export function AudienceDoors() { - return ( -
    - {audiences.map((audience) => ( -
    -
    - -

    {audience.eyebrow}

    -
    -

    - {audience.title} -

    -

    {audience.description}

    -
      - {audience.links.map((link) => ( -
    • - {link.title} -
    • - ))} -
    -
    - ))} -
    - ); -} - -/** Landing page: a static, wrapping logo wall, one labelled row per category. */ -export function LogoWall() { - return ( -
    - {logoRows.map((row) => ( -
    -

    {row.label}

    -
      - {row.logos.map((logo) => ( -
    • - - - {logo.name} - -
    • - ))} -
    -
    - ))} -
    - ); -} diff --git a/apps/docs/lib/mockups/home-data.ts b/apps/docs/lib/mockups/home-data.ts deleted file mode 100644 index af030c25..00000000 --- a/apps/docs/lib/mockups/home-data.ts +++ /dev/null @@ -1,352 +0,0 @@ -// Content for the two docs home page mockups. Every href is a page in the -// coder/coder docs corpus; descriptions come from the sidebar manifest or the -// target page, so the mockups compare layouts, not copy. - -export type Link = { title: string; href: string; description?: string; icon?: string }; -// tone: "light" marks are white (drawn for dark backgrounds), "dark" marks are black; -// each is inverted only in the theme where it would vanish. -export type Logo = { name: string; href: string; logo: string; tone?: "light" | "dark" }; - -export const hero = { - title: "Coder documentation", - // docs/manifest/home.yml description. - description: - "Coder is a self-hosted platform for running AI coding agents and cloud development environments on the infrastructure you control.", - primary: { title: "Start the Quickstart", href: "/get-started" }, - secondary: { title: "Install Coder", href: "/install" }, -}; - -// The most frequent docs searches in Algolia over 30 days to Nov 18. -export const popular: Link[] = [ - { title: "Connect over SSH", href: "/workspaces/workspace-access#ssh" }, - { title: "Docker in workspaces", href: "/templates/extending-templates/docker-in-workspaces" }, - { title: "Reset a password", href: "/admin/users/password-auth" }, - { title: "OIDC sign-in", href: "/admin/users/oidc-auth" }, - { title: "TLS and reverse proxies", href: "/admin/setup#tls--reverse-proxy" }, - { title: "Port forwarding", href: "/workspaces/workspace-access/port-forwarding" }, - { title: "MCP server", href: "/mcp-server" }, -]; - -// The "Common tasks" cards from coder/coder#32714 (docs/README.md). -export const commonTasks: Link[] = [ - { - title: "Connect to a workspace", - href: "/workspaces/workspace-access", - description: - "Connect over SSH, from VS Code or a JetBrains IDE, in code-server or a web terminal, or through forwarded ports.", - }, - { - title: "Docker in workspaces", - href: "/templates/extending-templates/docker-in-workspaces", - description: - "Run Docker or Podman inside container-based workspaces with Sysbox, Envbox, rootless Podman, or a privileged sidecar.", - }, - { - title: "Manage users and sign-in", - href: "/admin/users", - description: - "Set up single sign-on, reset passwords, and organize users into groups and roles.", - }, - { - title: "Configure the control plane", - href: "/admin/setup", - description: - "Set the access URL, the wildcard domain for workspace apps, TLS certificates, and a reverse proxy.", - }, - { - title: "Git authentication", - href: "/admin/external-auth", - description: - "Connect GitHub, GitLab, Bitbucket, and other OAuth providers so workspaces can clone and push.", - }, - { - title: "MCP server", - href: "/mcp-server", - description: - "Give AI assistants tools and context for your deployment through the built-in Model Context Protocol (MCP) server.", - }, -]; - -// One door per audience. All of them are visible at once on the landing page; -// the in-docs mockup puts them in tabs, which Markdown can already express. -export const audiences: { - id: string; - eyebrow: string; - // Short label for the in-docs tabs, so all four fit a phone-width tab bar. - tab: string; - title: string; - description: string; - icon: string; - href: string; - links: Link[]; -}[] = [ - { - id: "platform", - eyebrow: "Platform teams", - tab: "Platform", - title: "Install and run Coder", - description: - "Deploy the control plane on your infrastructure, then secure, scale, and upgrade it.", - icon: "download", - href: "/install", - links: [ - { title: "Installation requirements", href: "/install/server/requirements" }, - { title: "Production deployment process", href: "/install/production-deployment" }, - { title: "Install on Kubernetes", href: "/install/server/kubernetes" }, - { title: "Air-gapped deployments", href: "/install/prepare/airgap" }, - { title: "Configure the control plane", href: "/admin/setup" }, - { title: "Upgrade Coder", href: "/install/operate/upgrade" }, - ], - }, - { - id: "templates", - eyebrow: "Template authors", - tab: "Templates", - title: "Build templates", - description: "Define workspace infrastructure in Terraform, then publish and maintain it.", - icon: "picture", - href: "/templates", - links: [ - { title: "Create a template", href: "/templates/creating-templates" }, - { title: "Extend templates", href: "/templates/extending-templates" }, - { title: "Parameters", href: "/templates/extending-templates/parameters" }, - { title: "Prebuilt workspaces", href: "/templates/extending-templates/prebuilt-workspaces" }, - { title: "Dev containers", href: "/templates/extending-templates/devcontainers" }, - { title: "Manage templates", href: "/templates/managing-templates" }, - ], - }, - { - id: "developers", - eyebrow: "Developers", - tab: "Developers", - title: "Work in a workspace", - description: "Open a workspace from your IDE, the terminal, or the browser.", - icon: "terminal", - href: "/workspaces", - links: [ - { title: "Connect to a workspace", href: "/workspaces/workspace-access" }, - { title: "VS Code", href: "/workspaces/workspace-access/vscode" }, - { title: "JetBrains IDEs", href: "/workspaces/workspace-access/jetbrains" }, - { title: "Port forwarding", href: "/workspaces/workspace-access/port-forwarding" }, - { title: "Web terminal", href: "/workspaces/workspace-access/web-terminal" }, - { title: "code-server", href: "/workspaces/workspace-access/code-server" }, - ], - }, - { - id: "ai", - eyebrow: "AI and agent teams", - tab: "AI agents", - title: "Run AI agents", - description: - "Delegate work to coding agents and control how AI is used across your deployment.", - icon: "wand", - href: "/coder-agents", - links: [ - { title: "Coder Agents", href: "/coder-agents" }, - { title: "AI Governance", href: "/ai-governance" }, - { title: "Agent Firewall", href: "/ai-governance/agent-firewall" }, - { title: "AI Gateway clients", href: "/ai-governance/ai-gateway/clients" }, - { title: "Agent Relay", href: "/agent-relay" }, - { title: "MCP server", href: "/mcp-server" }, - ], - }, -]; - -export const logoRows: { label: string; logos: Logo[] }[] = [ - { - label: "Connect from", - logos: [ - { name: "VS Code", href: "/workspaces/workspace-access/vscode", logo: "logos/code.svg" }, - { - name: "JetBrains", - href: "/workspaces/workspace-access/jetbrains", - logo: "logos/jetbrains.svg", - }, - { - name: "Cursor", - href: "/workspaces/workspace-access/cursor", - logo: "logos/cursor.svg", - tone: "light", - }, - { - name: "Zed", - href: "/workspaces/workspace-access/zed", - logo: "logos/zed.svg", - tone: "light", - }, - { - name: "Web terminal", - href: "/workspaces/workspace-access/web-terminal", - logo: "icons/computer-code.svg", - tone: "dark", - }, - { - name: "SSH", - href: "/workspaces/workspace-access#ssh", - logo: "logos/terminal.svg", - tone: "light", - }, - ], - }, - { - label: "Run on", - logos: [ - { - name: "Kubernetes", - href: "/install/server/kubernetes", - logo: "icons/kubernetes.svg", - tone: "dark", - }, - { name: "Docker", href: "/install/server/docker", logo: "logos/docker.svg" }, - { - name: "AWS", - href: "/install/server/cloud/aws-marketplace", - logo: "logos/aws.svg", - tone: "light", - }, - { name: "Azure", href: "/install/server/cloud/azure-vm", logo: "logos/azure.svg" }, - { name: "Google Cloud", href: "/install/server/cloud/compute-engine", logo: "logos/gcp.svg" }, - { - name: "OpenShift", - href: "/install/server/openshift", - logo: "icons/openshift.svg", - tone: "dark", - }, - ], - }, - { - label: "Sign in with", - logos: [ - { name: "GitHub", href: "/admin/users/github-auth", logo: "logos/github.svg", tone: "light" }, - { - name: "Okta", - href: "/admin/users/oidc-auth/configuring-okta", - logo: "logos/okta.svg", - tone: "light", - }, - { name: "Microsoft", href: "/admin/users/oidc-auth/microsoft", logo: "logos/microsoft.svg" }, - { name: "Google", href: "/admin/users/oidc-auth/google", logo: "logos/google.svg" }, - { - name: "Any OIDC provider", - href: "/admin/users/oidc-auth", - logo: "icons/key.svg", - tone: "dark", - }, - { - name: "Passwords", - href: "/admin/users/password-auth", - logo: "icons/lock.svg", - tone: "dark", - }, - ], - }, - { - label: "Bring your agent", - logos: [ - { - name: "Claude Code", - href: "/ai-governance/ai-gateway/clients/claude-code", - logo: "logos/claude.svg", - }, - { - name: "Codex", - href: "/ai-governance/ai-gateway/clients/codex", - logo: "logos/openai-codex.svg", - tone: "light", - }, - { - name: "GitHub Copilot", - href: "/ai-governance/ai-gateway/clients/copilot", - logo: "logos/github-copilot.svg", - tone: "light", - }, - { name: "Junie", href: "/ai-governance/ai-gateway/clients/junie", logo: "logos/junie.svg" }, - { - name: "OpenCode", - href: "/ai-governance/ai-gateway/clients/opencode", - logo: "logos/opencode.svg", - tone: "light", - }, - { - name: "Cursor agents", - href: "/agent-relay/cursor", - logo: "logos/cursor.svg", - tone: "light", - }, - ], - }, -]; - -// Top-level sections, with the icon and description from docs/manifest/*.yml. -export const sections: Link[] = [ - { - title: "Get started", - href: "/get-started", - icon: "rocket", - description: - "Install Coder, build your first template, and launch your first workspace in this quickstart guide.", - }, - { - title: "Install", - href: "/install", - icon: "download", - description: - "Plan, prepare, install, validate, and operate a Coder deployment in your own infrastructure.", - }, - { - title: "Templates", - href: "/templates", - icon: "picture", - description: - "Learn how to author, publish, and maintain the Coder templates that define your workspaces.", - }, - { - title: "Workspaces", - href: "/workspaces", - icon: "users", - description: - "Guides for Coder end users on accessing, managing, and personalizing their workspaces.", - }, - { - title: "Coder Agents", - href: "/coder-agents", - icon: "wand", - description: - "Delegate development work to coding agents in your deployment with Coder Agents, a chat interface and API.", - }, - { - title: "AI Governance", - href: "/ai-governance", - icon: "ai_intelligence", - description: - "Govern AI usage at scale with AI Governance: Agent Firewall, AI Gateway, and reporting.", - }, - { - title: "Agent Relay", - href: "/agent-relay", - icon: "link", - description: - "Connect supported cloud-hosted AI agents to self-hosted Coder workspaces with Agent Relay.", - }, - { - title: "MCP server", - href: "/mcp-server", - icon: "plug", - description: - "Connect external AI coding agents to Coder using its built-in Model Context Protocol server.", - }, - { - title: "Administration", - href: "/admin", - icon: "wrench", - description: - "Guides for the template and deployment administrators who configure, secure, and operate Coder.", - }, - { - title: "Reference", - href: "/reference", - icon: "notes", - description: - "Reference for automating Coder through the REST API, command-line interface, and Agent API.", - }, -]; diff --git a/apps/docs/mockup-assets/icons/ai_intelligence.svg b/apps/docs/mockup-assets/icons/ai_intelligence.svg deleted file mode 100644 index bcef647b..00000000 --- a/apps/docs/mockup-assets/icons/ai_intelligence.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/computer-code.svg b/apps/docs/mockup-assets/icons/computer-code.svg deleted file mode 100644 index 58cf2afb..00000000 --- a/apps/docs/mockup-assets/icons/computer-code.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - computer-code - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/container.svg b/apps/docs/mockup-assets/icons/container.svg deleted file mode 100644 index 0739fdc8..00000000 --- a/apps/docs/mockup-assets/icons/container.svg +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/apps/docs/mockup-assets/icons/docker.svg b/apps/docs/mockup-assets/icons/docker.svg deleted file mode 100644 index f5b39410..00000000 --- a/apps/docs/mockup-assets/icons/docker.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/download.svg b/apps/docs/mockup-assets/icons/download.svg deleted file mode 100644 index 8e7cdcb8..00000000 --- a/apps/docs/mockup-assets/icons/download.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/git.svg b/apps/docs/mockup-assets/icons/git.svg deleted file mode 100644 index a1d6213e..00000000 --- a/apps/docs/mockup-assets/icons/git.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/home.svg b/apps/docs/mockup-assets/icons/home.svg deleted file mode 100644 index 6fac64f2..00000000 --- a/apps/docs/mockup-assets/icons/home.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/info.svg b/apps/docs/mockup-assets/icons/info.svg deleted file mode 100644 index a89dac5e..00000000 --- a/apps/docs/mockup-assets/icons/info.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/key.svg b/apps/docs/mockup-assets/icons/key.svg deleted file mode 100644 index 7c38e7c2..00000000 --- a/apps/docs/mockup-assets/icons/key.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/kubernetes.svg b/apps/docs/mockup-assets/icons/kubernetes.svg deleted file mode 100644 index 2662ad49..00000000 --- a/apps/docs/mockup-assets/icons/kubernetes.svg +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/link.svg b/apps/docs/mockup-assets/icons/link.svg deleted file mode 100644 index 5ab3edf1..00000000 --- a/apps/docs/mockup-assets/icons/link.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/lock.svg b/apps/docs/mockup-assets/icons/lock.svg deleted file mode 100644 index 620af515..00000000 --- a/apps/docs/mockup-assets/icons/lock.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/networking.svg b/apps/docs/mockup-assets/icons/networking.svg deleted file mode 100644 index 29fb50ab..00000000 --- a/apps/docs/mockup-assets/icons/networking.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/notes.svg b/apps/docs/mockup-assets/icons/notes.svg deleted file mode 100644 index b21b109d..00000000 --- a/apps/docs/mockup-assets/icons/notes.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/openshift.svg b/apps/docs/mockup-assets/icons/openshift.svg deleted file mode 100644 index f2d0a8bf..00000000 --- a/apps/docs/mockup-assets/icons/openshift.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/picture.svg b/apps/docs/mockup-assets/icons/picture.svg deleted file mode 100644 index 79daa4bb..00000000 --- a/apps/docs/mockup-assets/icons/picture.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/apps/docs/mockup-assets/icons/plug.svg b/apps/docs/mockup-assets/icons/plug.svg deleted file mode 100644 index ca1874fe..00000000 --- a/apps/docs/mockup-assets/icons/plug.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/apps/docs/mockup-assets/icons/rancher.svg b/apps/docs/mockup-assets/icons/rancher.svg deleted file mode 100644 index c737e6b1..00000000 --- a/apps/docs/mockup-assets/icons/rancher.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/apps/docs/mockup-assets/icons/rocket.svg b/apps/docs/mockup-assets/icons/rocket.svg deleted file mode 100644 index 571aa0f6..00000000 --- a/apps/docs/mockup-assets/icons/rocket.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/apps/docs/mockup-assets/icons/security.svg b/apps/docs/mockup-assets/icons/security.svg deleted file mode 100644 index 740b522b..00000000 --- a/apps/docs/mockup-assets/icons/security.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/stairs.svg b/apps/docs/mockup-assets/icons/stairs.svg deleted file mode 100644 index 08a44445..00000000 --- a/apps/docs/mockup-assets/icons/stairs.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/terminal.svg b/apps/docs/mockup-assets/icons/terminal.svg deleted file mode 100644 index 8c14606a..00000000 --- a/apps/docs/mockup-assets/icons/terminal.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/icons/upgrade.svg b/apps/docs/mockup-assets/icons/upgrade.svg deleted file mode 100644 index dad8e9a2..00000000 --- a/apps/docs/mockup-assets/icons/upgrade.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/users.svg b/apps/docs/mockup-assets/icons/users.svg deleted file mode 100644 index c5c334bb..00000000 --- a/apps/docs/mockup-assets/icons/users.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/apps/docs/mockup-assets/icons/wand.svg b/apps/docs/mockup-assets/icons/wand.svg deleted file mode 100644 index 342b6c55..00000000 --- a/apps/docs/mockup-assets/icons/wand.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/docs/mockup-assets/icons/wrench.svg b/apps/docs/mockup-assets/icons/wrench.svg deleted file mode 100644 index e77146d9..00000000 --- a/apps/docs/mockup-assets/icons/wrench.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/mockup-assets/logos/aws-dark.svg b/apps/docs/mockup-assets/logos/aws-dark.svg deleted file mode 100644 index c5ce2d70..00000000 --- a/apps/docs/mockup-assets/logos/aws-dark.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/apps/docs/mockup-assets/logos/aws-light.svg b/apps/docs/mockup-assets/logos/aws-light.svg deleted file mode 100644 index de18401c..00000000 --- a/apps/docs/mockup-assets/logos/aws-light.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/apps/docs/mockup-assets/logos/gitlab.svg b/apps/docs/mockup-assets/logos/gitlab.svg deleted file mode 100644 index f5b31ff0..00000000 --- a/apps/docs/mockup-assets/logos/gitlab.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/apps/docs/mockup-assets/logos/keycloak.svg b/apps/docs/mockup-assets/logos/keycloak.svg deleted file mode 100644 index 40646cb3..00000000 --- a/apps/docs/mockup-assets/logos/keycloak.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/docs/mockup-assets/logos/kilo-code.svg b/apps/docs/mockup-assets/logos/kilo-code.svg deleted file mode 100644 index 7f0eecbd..00000000 --- a/apps/docs/mockup-assets/logos/kilo-code.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/apps/docs/mockup-assets/logos/terminal.svg b/apps/docs/mockup-assets/logos/terminal.svg deleted file mode 100644 index 6cb6efec..00000000 --- a/apps/docs/mockup-assets/logos/terminal.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/apps/docs/package.json b/apps/docs/package.json index bcf44d83..53d0b4c5 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -55,6 +55,7 @@ "@coder/docs-ui": "workspace:*", "@fontsource-variable/geist": "5.3.0", "@fontsource-variable/geist-mono": "5.3.0", + "@phosphor-icons/react": "2.1.10", "@sentry/nextjs": "11.9.0", "@vercel/blob": "catalog:", "fumadocs-core": "catalog:", diff --git a/apps/docs/scripts/home-resolve.test.mjs b/apps/docs/scripts/home-resolve.test.mjs new file mode 100644 index 00000000..a1fc2338 --- /dev/null +++ b/apps/docs/scripts/home-resolve.test.mjs @@ -0,0 +1,67 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { resolveHome } from "../lib/home-prototype/home-resolve.ts"; + +const pages = new Map([ + ["/", { title: "Home", description: "Coder runs on your infrastructure.", headings: new Set() }], + ["/install", { title: "Install Coder", headings: new Set() }], + ["/get-started", { title: "Quickstart", headings: new Set() }], + ["/support", { title: "Support", headings: new Set() }], + ["/workspaces/workspace-access", { title: "Access workspaces", headings: new Set(["ssh"]) }], +]); +const lookup = { + page: (path) => pages.get(path), + sections: () => [ + { href: "/get-started", title: "Get started" }, + { href: "/install", title: "Install" }, + { href: "/support", title: "Support" }, + ], +}; + +const file = { + hero: { + title: "Coder documentation", + primary: { title: "Start", href: "/get-started" }, + secondary: { title: "Install", href: "/install" }, + }, + install: { title: "Install", steps: [], link: { title: "Quickstart", href: "/get-started" } }, + popular: [ + "/install/", + { title: "SSH", href: "/workspaces/workspace-access#ssh" }, + "/no-such-page", + "/workspaces/workspace-access#no-such-heading", + ], + audiences: [], + integrations: [], + sections: { exclude: ["/support"], icons: { "/install": "DownloadSimple" } }, + help: { title: "Help", text: "Ask.", links: [{ title: "Support", href: "/support" }] }, +}; + +test("links take the page's own title unless the file overrides it", () => { + const { props } = resolveHome(file, lookup); + assert.deepEqual( + props.popular.map((link) => link.title), + ["Install Coder", "SSH"], + ); + assert.equal(props.hero.description, "Coder runs on your infrastructure."); +}); + +test("a route or heading the version lacks is left out and reported, not rendered", () => { + const { props, issues } = resolveHome(file, lookup); + assert.ok(!props.popular.some((link) => link.href.startsWith("/no-such-page"))); + assert.deepEqual(issues, [ + "popular[2]: /no-such-page is not a page in this version", + "popular[3]: /workspaces/workspace-access#no-such-heading names no heading on /workspaces/workspace-access", + ]); +}); + +test("section cards follow the sidebar, minus exclusions, with the file's icons", () => { + const { props } = resolveHome(file, lookup); + assert.deepEqual( + props.sections.map((section) => [section.href, section.icon]), + [ + ["/get-started", "BookOpenText"], + ["/install", "DownloadSimple"], + ], + ); +}); diff --git a/packages/docs-build/src/reserved-routes.ts b/packages/docs-build/src/reserved-routes.ts index 077d0d21..93e8d9d8 100644 --- a/packages/docs-build/src/reserved-routes.ts +++ b/packages/docs-build/src/reserved-routes.ts @@ -4,7 +4,13 @@ // app's route directories and the theme's favicon files. /** Page routes (and everything under them) that the export writes as files or asset directories. */ -export const RESERVED_ROUTES: readonly string[] = ["api/search", "api/search-semantic", "_next"]; +export const RESERVED_ROUTES: readonly string[] = [ + "api/search", + "api/search-semantic", + "_next", + // The docs home page prototype (apps/docs/app/home-prototype), while it exists. + "home-prototype", +]; /** Export-root files the app, the router, or the publisher own. Compared case-insensitively. */ export const RESERVED_ROOT_FILES: readonly string[] = [ diff --git a/packages/docs-config/src/home.test.ts b/packages/docs-config/src/home.test.ts new file mode 100644 index 00000000..c590927c --- /dev/null +++ b/packages/docs-config/src/home.test.ts @@ -0,0 +1,104 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { parseHomeFile } from "./home.js"; + +const valid = { + hero: { + title: "Coder documentation", + primary: { title: "Start the Quickstart", href: "/get-started" }, + secondary: { title: "Install Coder", href: "/install" }, + }, + install: { + title: "Install Coder", + steps: [ + { comment: "Install the CLI", command: "curl -fsSL https://coder.com/install.sh | sh" }, + ], + link: { title: "Follow the Quickstart", href: "/get-started" }, + }, + popular: ["/mcp-server", { title: "Connect over SSH", href: "/workspaces/workspace-access#ssh" }], + audiences: [ + { + id: "platform", + label: "Platform teams", + title: "Install and run Coder", + description: "Deploy the control plane.", + icon: "HardDrives", + href: "/install", + links: ["/install/server/requirements"], + }, + ], + integrations: [ + { + label: "Run on", + items: [ + { name: "Kubernetes", href: "/install/server/kubernetes", logo: "kubernetes" }, + { name: "Air-gapped networks", href: "/install/prepare/airgap", icon: "WifiSlash" }, + ], + }, + ], + sections: { exclude: ["/support"], icons: { "/install": "DownloadSimple" } }, + help: { + title: "Can't find what you need?", + text: "Ask the community.", + links: [ + { title: "Get support", href: "/support" }, + { title: "Join Discord", href: "https://discord.gg/coder" }, + ], + }, +}; + +const withChange = (change: (file: typeof valid) => void) => { + const file = structuredClone(valid); + change(file); + return JSON.stringify(file); +}; + +// The item at `index`, failing the test rather than asserting it exists. +function at(items: T[], index = 0): T { + const item = items[index]; + assert.ok(item, `fixture has no item ${index}`); + return item; +} + +test("a file saved on Windows, with a byte order mark and CRLF line endings, parses", () => { + const windows = `\uFEFF${JSON.stringify(valid, null, 2).replaceAll("\n", "\r\n")}`; + const result = parseHomeFile(windows); + assert.equal(result.ok, true, result.ok ? "" : result.issues.join("\n")); +}); + +test("a link that leaves the docs is rejected, wherever it appears", () => { + for (const href of [ + "https://evil.example/install", + "//evil.example/install", + "javascript:alert(1)", + "/install/../../etc", + "/install?next=https://evil.example", + ]) { + const result = parseHomeFile(withChange((file) => (at(file.audiences).links = [href]))); + assert.equal(result.ok, false, href); + } + const external = parseHomeFile( + withChange((file) => (at(file.help.links, 1).href = "https://evil.example/support")), + ); + assert.equal(external.ok, false); + assert.match(external.ok ? "" : external.issues.join("\n"), /^help\.links\.1\.href/m); +}); + +test("an integration names exactly one of a logo or an icon", () => { + const both = parseHomeFile( + withChange((file) => Object.assign(at(at(file.integrations).items), { icon: "Stack" })), + ); + assert.equal(both.ok, false); + const neither = parseHomeFile( + withChange((file) => delete (at(at(file.integrations).items) as { logo?: string }).logo), + ); + assert.equal(neither.ok, false); +}); + +test("a long hostile route is rejected without backtracking", () => { + const started = performance.now(); + const result = parseHomeFile(withChange((file) => (file.popular = [`/${"a".repeat(190)}!`]))); + assert.equal(result.ok, false); + // A backtracking pattern takes minutes on this input; a linear one, well under a millisecond. + assert.ok(performance.now() - started < 1000, "route validation took over a second"); +}); diff --git a/packages/docs-config/src/home.ts b/packages/docs-config/src/home.ts new file mode 100644 index 00000000..6d605ed3 --- /dev/null +++ b/packages/docs-config/src/home.ts @@ -0,0 +1,221 @@ +// The docs home page's content file, `docs/home.json` in the corpus, and the +// rules it is held to. Provisional: the file's location, format, and owner are +// open questions for the engine, and only the home page prototype reads it. +// +// The corpus is untrusted (refer to the "Security: the corpus is untrusted" +// section of packages/docs-transforms/README.md), so the file is data only: +// links are docs routes or a short allowlist of external hosts, icons and +// logos are names the engine looks up in its own static maps, and every string +// has a length cap. Titles default to the linked page's own, so the file names +// pages rather than copying them. +import { z } from "zod"; + +/** Phosphor icon names the file may use; the engine maps each to its component. */ +export const HOME_ICON_NAMES = [ + "ArrowsLeftRight", + "BookOpenText", + "ChatsCircle", + "DownloadSimple", + "GearSix", + "HardDrives", + "IdentificationBadge", + "Key", + "Laptop", + "Password", + "Plugs", + "Robot", + "RocketLaunch", + "ShieldCheck", + "Stack", + "Terminal", + "TerminalWindow", + "WifiSlash", +] as const; +export type HomeIconName = (typeof HOME_ICON_NAMES)[number]; + +/** Brand marks the file may use; the engine maps each to a file it ships. */ +export const HOME_LOGO_NAMES = [ + "aws", + "azure", + "claude", + "codex", + "copilot", + "cursor", + "docker", + "gcp", + "github", + "google", + "jetbrains", + "junie", + "kubernetes", + "microsoft", + "okta", + "opencode", + "vscode", + "zed", +] as const; +export type HomeLogoName = (typeof HOME_LOGO_NAMES)[number]; + +/** External hosts a help link may point at. Everything else must be a docs route. */ +export const HOME_EXTERNAL_HOSTS: ReadonlySet = new Set([ + "coder.com", + "github.com", + "discord.gg", + "discord.com", +]); + +/** Largest file the engine reads. The real file is about 6 KB. */ +export const MAX_HOME_FILE_BYTES = 64 * 1024; + +const text = (max: number) => z.string().trim().min(1).max(max); + +// A docs route with an optional heading fragment: `/install`, +// `/admin/setup#tls--reverse-proxy`. No scheme, no `//` host, no query, no +// `..` segment. Segments are separated by exactly one slash and dots only sit +// between characters, so no input can make the pattern backtrack. +const SEGMENT = "[A-Za-z0-9_~-]+(?:\\.[A-Za-z0-9_~-]+)*"; +export const HOME_ROUTE_PATTERN = new RegExp( + `^/(?:${SEGMENT}(?:/${SEGMENT})*/?)?(?:#[A-Za-z0-9_-]+)?$`, +); +const route = z + .string() + .max(200) + .regex(HOME_ROUTE_PATTERN, "must be a docs route such as /install or /admin/setup#tls"); + +const externalUrl = z + .string() + .max(200) + .refine( + (value) => { + try { + const url = new URL(value); + return url.protocol === "https:" && HOME_EXTERNAL_HOSTS.has(url.hostname); + } catch { + return false; + } + }, + `must be an https URL on ${[...HOME_EXTERNAL_HOSTS].join(", ")}`, + ); + +// A link to a docs page: the route alone takes the page's own title, or an +// object overrides the title. +const pageLink = z.union([route, z.object({ href: route, title: text(60).optional() }).strict()]); + +const button = z.object({ href: route, title: text(40) }).strict(); + +const iconName = z.enum(HOME_ICON_NAMES); +const logoName = z.enum(HOME_LOGO_NAMES); + +export const homeFileSchema = z + .object({ + hero: z + .object({ + title: text(60), + // Defaults to the home page's own description (README.md front matter). + description: text(240).optional(), + primary: button, + secondary: button, + }) + .strict(), + install: z + .object({ + title: text(60), + steps: z + .array(z.object({ comment: text(60), command: text(120) }).strict()) + .min(1) + .max(3), + windows: text(120).optional(), + link: button, + }) + .strict(), + popular: z.array(pageLink).min(1).max(10), + audiences: z + .array( + z + .object({ + id: z.string().regex(/^[a-z0-9-]{1,40}$/), + label: text(40), + title: text(60), + description: text(200), + icon: iconName, + href: route, + links: z.array(pageLink).min(1).max(8), + }) + .strict(), + ) + .min(1) + .max(6), + integrations: z + .array( + z + .object({ + label: text(40), + items: z + .array( + z + .object({ + name: text(40), + href: route, + logo: logoName.optional(), + icon: iconName.optional(), + }) + .strict() + .refine((item) => (item.logo === undefined) !== (item.icon === undefined), { + message: "set exactly one of logo or icon", + }), + ) + .min(1) + .max(6), + }) + .strict(), + ) + .max(6), + // The section cards are the sidebar's top-level sections, in sidebar + // order; the file only leaves some out and picks their icons. + sections: z + .object({ + exclude: z.array(route).max(20).default([]), + icons: z.record(route, iconName).default({}), + }) + .strict(), + help: z + .object({ + title: text(60), + text: text(200), + links: z + .array(z.object({ title: text(40), href: z.union([route, externalUrl]) }).strict()) + .min(1) + .max(3), + }) + .strict(), + }) + .strict(); + +export type HomeFile = z.infer; + +export type HomeFileParseResult = { ok: true; data: HomeFile } | { ok: false; issues: string[] }; + +/** + * Parse and validate the file's text. Strips a UTF-8 byte order mark, which + * Windows editors add and JSON.parse rejects; CRLF line endings are JSON + * whitespace and need no handling. + */ +export function parseHomeFile(raw: string): HomeFileParseResult { + const textValue = raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw; + let json: unknown; + try { + json = JSON.parse(textValue); + } catch (error) { + return { ok: false, issues: [`not valid JSON: ${(error as Error).message}`] }; + } + const result = homeFileSchema.safeParse(json); + if (!result.success) { + return { + ok: false, + issues: result.error.issues.map( + (issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`, + ), + }; + } + return { ok: true, data: result.data }; +} diff --git a/packages/docs-config/src/index.ts b/packages/docs-config/src/index.ts index e2bcb454..6afa3d53 100644 --- a/packages/docs-config/src/index.ts +++ b/packages/docs-config/src/index.ts @@ -106,6 +106,16 @@ export { } from "./analytics.js"; export { USER_CONTENT_PREFIX } from "./user-content.js"; +export { + HOME_EXTERNAL_HOSTS, + HOME_ICON_NAMES, + HOME_LOGO_NAMES, + HOME_ROUTE_PATTERN, + MAX_HOME_FILE_BYTES, + homeFileSchema, + parseHomeFile, +} from "./home.js"; +export type { HomeFile, HomeFileParseResult, HomeIconName, HomeLogoName } from "./home.js"; export * from "./openapi.js"; export { openApiDataDir, openApiDataFile } from "./openapi-data.js"; export { isObject, type JsonObject } from "./json.js"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14278985..dc4458ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,9 @@ importers: '@fontsource-variable/geist-mono': specifier: 5.3.0 version: 5.3.0 + '@phosphor-icons/react': + specifier: 2.1.10 + version: 2.1.10(react-dom@19.2.7(react@19.2.7))(react@19.2.7) '@sentry/nextjs': specifier: 11.9.0 version: 11.9.0(next@16.4.5(@opentelemetry/api@1.10.0)(@types/node@24.19.2)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(react@19.2.7) From 33e8494d9a9db8cb4e14eedcf819b9bd99093b1f Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Mon, 30 Nov 2026 19:33:13 +0000 Subject: [PATCH 04/11] fix(docs): keep the home prototype out of publish builds The layout's DOCS_PUBLISH check rendered a 404, but the export still wrote home-prototype/index.html as a "Page not found" page, and the page's flight data still carried the whole prototype, so a publish would have shipped both. The route files now end in .prototype.tsx and next.config only adds that extension outside a publish, so a publish compiles no route there at all. The single-version e2e asserts that the archive has nothing under it. Outside a publish the page is emitted, and the per-pass page count failed on it because it isn't in the slug manifest. The count now leaves out pages under any route in RESERVED_ROUTES, which the app owns. The page is added to the axe pass. In More contrast its secondary text kept coder.com's AA values and failed the 7:1 rule, so it now takes the theme's More contrast muted and faint tokens. Comment blocks in the prototype files are cut to one line each. Assisted-by: AI --- .../app/home-prototype/home-prototype.css | 54 +++++++++---------- .../{layout.tsx => layout.prototype.tsx} | 16 +----- .../{page.tsx => page.prototype.tsx} | 0 .../docs/app/home-prototype/prototype-bar.tsx | 7 +-- apps/docs/lib/home-prototype/home-blocks.tsx | 8 +-- apps/docs/lib/home-prototype/home-content.ts | 10 +--- apps/docs/lib/home-prototype/home-icons.tsx | 3 +- apps/docs/lib/home-prototype/home-resolve.ts | 18 ++----- apps/docs/next.config.mjs | 10 ++++ apps/docs/scripts/a11y-axe-helpers.mjs | 2 + apps/docs/scripts/build-helpers.mjs | 22 +++++--- apps/docs/scripts/build-helpers.test.mjs | 8 +++ apps/docs/scripts/single-version.e2e.mjs | 5 ++ packages/docs-config/src/home.ts | 28 ++-------- 14 files changed, 81 insertions(+), 110 deletions(-) rename apps/docs/app/home-prototype/{layout.tsx => layout.prototype.tsx} (71%) rename apps/docs/app/home-prototype/{page.tsx => page.prototype.tsx} (100%) diff --git a/apps/docs/app/home-prototype/home-prototype.css b/apps/docs/app/home-prototype/home-prototype.css index ec7a2df8..c28a504e 100644 --- a/apps/docs/app/home-prototype/home-prototype.css +++ b/apps/docs/app/home-prototype/home-prototype.css @@ -1,6 +1,4 @@ -/* The docs home page prototype. Values come from coder.com's design system - * (coder/coder.com-new packages/ui/styles/tokens.css and ramps.css); the - * fd colour tokens they sit on already match it (docs-theme brand.css). */ +/* Docs home prototype; token values mirror coder.com's design system. */ :root { --mk-line-subtle: #e9e9eb; /* ink-4 */ @@ -41,6 +39,20 @@ --mk-glow-strength: 0.55; } +/* More contrast: secondary text takes the theme's 7:1 values. */ +@media (prefers-contrast: more) { + :root:not([data-contrast="standard"]) { + --mk-text-muted: var(--color-fd-muted-foreground); + --mk-text-faint: var(--docs-text-faint); + } +} + +/* Same declarations as the prefers-contrast rule above; change both. */ +:root[data-contrast="more"] { + --mk-text-muted: var(--color-fd-muted-foreground); + --mk-text-faint: var(--docs-text-faint); +} + /* ---------- Shared ---------- */ .mk-logo { @@ -49,8 +61,7 @@ object-fit: contain; flex: none; } -/* Toned marks are single-colour by design, so they stay grayscale (the AWS - * smile is their only colour); each is inverted where it would vanish. */ +/* Toned marks stay grayscale and are inverted where they would vanish. */ .mk-logo[data-tone] { filter: grayscale(1); } @@ -454,8 +465,7 @@ transform: translate(2px, -2px); } -/* Logo wall: a label column and fixed cells, as coder.com's logo grid lays - * out, without its dissolve animation. Every logo is a link. */ +/* Logo wall: label column and fixed cells; every logo is a link. */ .mk-logo-wall { border-bottom: 1px solid var(--mk-line-subtle); } @@ -480,9 +490,7 @@ .mk-logo-chips li + li { border-inline-start: 1px solid var(--mk-line-subtle); } -/* Top-aligned, so a label that wraps to two lines keeps its logo level with - * its neighbours'; the cell grows rather than letting the label cross its - * border. */ +/* Top-aligned, so a two-line label keeps its logo level with its neighbours. */ .mk-logo-chip { display: flex; flex-direction: column; @@ -503,16 +511,11 @@ width: 1.75rem; height: 1.75rem; } -/* Phosphor glyphs stand in for marks the repo has no file for; they take the - * text colour, so they need no filter. */ +/* Phosphor glyphs take the text colour, so they need no filter. */ .mk-logo-chip .mk-logo-glyph { color: var(--color-fd-foreground); } -/* Monochrome by default, as coder.com's logo strip is; brand colour on hover - * or focus. The filters push each mark's luminance towards the text colour - * (dark in light mode, near white in dark mode) without flattening the white - * details some marks carry. Light- and dark-tone marks keep their theme - * inversion instead. */ +/* Monochrome by default, in colour on hover or focus; tone marks keep their inversion. */ .mk-logo-chip .mk-logo:not([data-tone], .mk-logo-glyph) { filter: grayscale(1) brightness(0.5) contrast(1.4); transition: filter 150ms var(--mk-ease); @@ -528,9 +531,7 @@ filter: none; } -/* Section cards: Fumadocs Cards, five across (ten sections, two full rows). - * Their 8px corners come from the docs theme (--radius-xl), matching - * coder.com's --radius-card; the icon takes the text colour so it reads. */ +/* Section cards: Fumadocs Cards, five across; corners come from --radius-xl. */ .mk-landing .mk-section-cards > div { grid-template-columns: repeat(5, minmax(0, 1fr)); } @@ -562,6 +563,8 @@ .mk-footer { border-top: 1px solid var(--mk-line-subtle); padding-block: 2rem; + /* Room for the prototype bar, so it never covers the last line. */ + padding-bottom: 5rem; font-size: 0.8125rem; color: var(--mk-text-muted); } @@ -627,8 +630,7 @@ padding-top: 0.875rem; padding-bottom: 0.75rem; } - /* A phone shows the four most searched topics, so the buttons stay near - * the first screen, and drops the keyboard shortcut hint. */ + /* Phones show four topics and no shortcut hint, keeping buttons near the first screen. */ .mk-pills-list li:nth-child(n + 5) { display: none; } @@ -653,9 +655,7 @@ transform: none; } -/* Heading tracking. coder.com's values are the default above (h1 -0.04em, - * h2 -0.025em, h3 -0.02em); the prototype bar switches to the docs theme's - * current values (h1 -0.02em, h2 -0.005em, h3 normal) for comparison. */ +/* Heading tracking: coder.com's values are the defaults; the prototype bar switches these. */ [data-mk-tracking="docs"] .mk-hero-title { letter-spacing: -0.02em; } @@ -747,7 +747,3 @@ margin: 0.5rem 0 0; padding-inline-start: 1rem; } -/* Room for the bar under the footer, so it never covers the last line. */ -.mk-footer { - padding-bottom: 5rem; -} diff --git a/apps/docs/app/home-prototype/layout.tsx b/apps/docs/app/home-prototype/layout.prototype.tsx similarity index 71% rename from apps/docs/app/home-prototype/layout.tsx rename to apps/docs/app/home-prototype/layout.prototype.tsx index 418d9446..fdcc3f6b 100644 --- a/apps/docs/app/home-prototype/layout.tsx +++ b/apps/docs/app/home-prototype/layout.prototype.tsx @@ -1,7 +1,6 @@ import { DocsProvider, createBaseOptions, versionSwitcherOptions } from "@coder/docs-next"; import { RuntimeVersionSwitcher } from "@coder/docs-ui"; import { HomeLayout } from "fumadocs-ui/layouts/home"; -import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { versionHasSlug } from "@/lib/sources"; import { versions } from "@/lib/versions"; @@ -9,17 +8,8 @@ import "./home-prototype.css"; const basePath = (process.env.DOCS_BASE_PATH ?? "").replace(/\/+$/, ""); -// The docs home page prototype: Fumadocs' HomeLayout (navbar, no sidebar). -// With no sidebar to hold them, the navbar carries what the docs shell's -// sidebar does: the version switcher, the docs search, and display settings. -// The social links move into the phone menu, so the navbar fits from 1024px, -// where HomeLayout starts showing its links; the footer still links GitHub. -// -// For review only: a publish (DOCS_PUBLISH=1) renders a 404 here, so the -// prototype cannot ship on the public site. It is also absent from the -// sitemap and the search index, which are built from the docs sources. +// Social links sit in the phone menu so the navbar fits from 1024px, where HomeLayout shows its links. export default function Layout({ children }: { children: ReactNode }) { - if (process.env.DOCS_PUBLISH === "1") notFound(); const base = createBaseOptions(); const current = versions.find((version) => version.latest) ?? versions[0]; const options = current @@ -54,9 +44,7 @@ export default function Layout({ children }: { children: ReactNode }) { { text: "Reference", url: "/reference" }, ...(switcher ? [ - // Fumadocs puts a custom item's children straight into the - // navbar's list, so that copy brings its own
  • ; the phone - // menu is not a list, so its copy has none. + // The navbar puts a custom item's children straight into its list; the phone menu is no list. { type: "custom" as const, on: "nav" as const, diff --git a/apps/docs/app/home-prototype/page.tsx b/apps/docs/app/home-prototype/page.prototype.tsx similarity index 100% rename from apps/docs/app/home-prototype/page.tsx rename to apps/docs/app/home-prototype/page.prototype.tsx diff --git a/apps/docs/app/home-prototype/prototype-bar.tsx b/apps/docs/app/home-prototype/prototype-bar.tsx index 1238cfe3..f16be135 100644 --- a/apps/docs/app/home-prototype/prototype-bar.tsx +++ b/apps/docs/app/home-prototype/prototype-bar.tsx @@ -9,12 +9,7 @@ const OPTIONS: { value: Tracking; label: string }[] = [ { value: "docs", label: "Docs today" }, ]; -/** - * The prototype's toolbar: which heading tracking to show, where the content - * came from, and any problems the home file has. The tracking choice is a data - * attribute on , so it works in a static export; `?tracking=docs` opens - * the page with it set, for screenshots and links. - */ +/** Review toolbar. Tracking is an data attribute, so it works in a static export. */ export function PrototypeBar({ from, issues }: { from: "corpus" | "fixture"; issues: string[] }) { const [tracking, setTracking] = useState("site"); diff --git a/apps/docs/lib/home-prototype/home-blocks.tsx b/apps/docs/lib/home-prototype/home-blocks.tsx index 172ee43d..ed509a1a 100644 --- a/apps/docs/lib/home-prototype/home-blocks.tsx +++ b/apps/docs/lib/home-prototype/home-blocks.tsx @@ -22,9 +22,7 @@ import codex from "./logos/openai-codex.svg"; import opencode from "./logos/opencode.svg"; import zed from "./logos/zed.svg"; -// The marks are bundled as static assets, so every build, including a -// preview, ships them without a copy step. Keyed by the file name the -// resolver gives each mark. +// Marks are bundled statically, so previews need no copy step. const LOGO_SRC: Record = { "aws.svg": aws, "azure.svg": azure, @@ -88,9 +86,7 @@ export function SectionHead({ ); } -// Colours a shell command the way coder.com's product screens do: the program -// after the start or a pipe, flags, and URLs. Text only, never markup from the -// file. +// Colours shell commands with text nodes only, never markup from the file. function Command({ command }: { command: string }) { const tokens = command.split(" "); let program = true; diff --git a/apps/docs/lib/home-prototype/home-content.ts b/apps/docs/lib/home-prototype/home-content.ts index 781653a6..057e25b2 100644 --- a/apps/docs/lib/home-prototype/home-content.ts +++ b/apps/docs/lib/home-prototype/home-content.ts @@ -1,9 +1,4 @@ -// Loads the landing page's content. A single-version build (the publisher's -// mode, and the local preview with DOCS_ROOT) reads the corpus's own -// `home.json` beside README.md when it has one; every other build, and a -// corpus file that fails validation, uses the committed fixture, which is in -// the same format. Syncing the file for multi-version builds is left for the -// engine decision this prototype is for. +// Single-version builds read home.json; others use the fixture until syncing is decided. import { readFileSync, statSync } from "node:fs"; import path from "node:path"; import { @@ -54,8 +49,7 @@ const lookup: PageLookup = { }; }, sections() { - // Each top-level section's card takes its sidebar label (the tree node's - // name, when it is plain text) and its index page's description. + // Cards take the sidebar label and the index page's description. return latestSource.pageTree.children.flatMap((node) => { const url = node.type === "page" diff --git a/apps/docs/lib/home-prototype/home-icons.tsx b/apps/docs/lib/home-prototype/home-icons.tsx index 77ef9415..54305dc3 100644 --- a/apps/docs/lib/home-prototype/home-icons.tsx +++ b/apps/docs/lib/home-prototype/home-icons.tsx @@ -21,8 +21,7 @@ import { WifiSlash, } from "@phosphor-icons/react/ssr"; -// Every name the home file may use, and nothing else: a name is looked up -// here, never imported dynamically, so the corpus cannot reach other modules. +// Fixed lookup: the corpus can never import arbitrary modules. const ICONS: Record = { ArrowsLeftRight, BookOpenText, diff --git a/apps/docs/lib/home-prototype/home-resolve.ts b/apps/docs/lib/home-prototype/home-resolve.ts index a9d3b1b7..32a6532e 100644 --- a/apps/docs/lib/home-prototype/home-resolve.ts +++ b/apps/docs/lib/home-prototype/home-resolve.ts @@ -1,18 +1,7 @@ -// Turns a validated home file into the props the landing page renders, by -// looking every route up in the version's pages: a link without a title takes -// the page's own, a fragment must name a heading on its page, and the section -// cards are the sidebar's top-level sections. A route that resolves to no page -// is left out and reported rather than rendered as a dead link. +// Resolves a validated home file into the props the landing page renders. import type { HomeFile, HomeIconName as IconName, HomeLogoName } from "@coder/docs-config"; -/** - * The file each brand mark name maps to, in lib/home-prototype/logos. `tone` - * marks a single-colour mark: "light" is drawn white for dark backgrounds, - * "dark" is drawn black, and the page inverts it in the theme where it would - * vanish. Marks without a tone are full colour. `invertInDark` is for full - * colour marks with white or black detail inside them (the Kubernetes wheel, - * the JetBrains square), which the dark theme's brightening would flatten. - */ +/** Brand mark files by name; `tone` and `invertInDark` control theme inversion. */ const LOGOS: Record = { aws: { file: "aws.svg", tone: "light" }, azure: { file: "azure.svg" }, @@ -70,8 +59,7 @@ export type HomeProps = { const DEFAULT_SECTION_ICON: IconName = "BookOpenText"; -// `/install/` and `/install` are the same page; the lookup is keyed without -// the trailing slash, and `/` stays `/`. +// Lookup keys drop the trailing slash, except the root "/". function normalize(path: string): string { return path.length > 1 ? path.replace(/\/+$/, "") : path; } diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index 94278370..66782b36 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -45,6 +45,16 @@ const config = keyMdxLoaders( // normal dev server. output: process.env.NODE_ENV === "production" ? "export" : undefined, trailingSlash: true, + // Prototype routes are *.prototype.tsx, so a publish compiles none of them. + pageExtensions: [ + ...(process.env.DOCS_PUBLISH === "1" ? [] : ["prototype.tsx"]), + "mdx", + "md", + "jsx", + "js", + "tsx", + "ts", + ], images: { unoptimized: true }, generateBuildId: () => stableBuildId(process.env), // Build-memory headroom on an 8 GB machine; neither changes the export, and dev keeps its source maps. diff --git a/apps/docs/scripts/a11y-axe-helpers.mjs b/apps/docs/scripts/a11y-axe-helpers.mjs index c8938cce..b4560ce8 100644 --- a/apps/docs/scripts/a11y-axe-helpers.mjs +++ b/apps/docs/scripts/a11y-axe-helpers.mjs @@ -30,12 +30,14 @@ export const DEFAULT_PAGES = [ // The code-server fixture, built by the a11y job with DOCS_CODE_SERVER_ROOT set. "/code-server", "/code-server/install", + "/home-prototype", ]; export const DEFAULT_MOBILE_PAGES = [ "/", "/authoring/tables", "/reference/api/users/create-new-user", "/code-server", + "/home-prototype", ]; // The search dialog is scanned open on this page, with a query the fixture corpus matches. export const SEARCH_PAGE = "/"; diff --git a/apps/docs/scripts/build-helpers.mjs b/apps/docs/scripts/build-helpers.mjs index c7517d39..d2cabf20 100644 --- a/apps/docs/scripts/build-helpers.mjs +++ b/apps/docs/scripts/build-helpers.mjs @@ -2,6 +2,7 @@ // tested without running a build. import { cp, mkdir, readdir, readFile, rename, rm, stat } from "node:fs/promises"; import path from "node:path"; +import { RESERVED_ROUTES } from "@coder/docs-build"; import { isVersionShapedSegment } from "@coder/docs-manifest/version-segment"; /** @@ -103,9 +104,10 @@ export async function unionInto(destDir, sourceDirs) { * (`versionPrefix(version)`: `[]` for the latest version, `["v2.36"]` and the like * otherwise). The `index.html` at the prefix root itself counts — it is the * version's root page, route `""`. For the latest version (`prefixSegments` - * empty, served at the site root) the top-level `404/`, `_not-found/`, and - * any version-shaped directory are excluded: those are shared build output and - * other versions' pages, not this version's. A missing prefix directory + * empty, served at the site root) the top-level `404/`, `_not-found/`, any + * version-shaped directory, and any route in `RESERVED_ROUTES` are excluded: + * those are shared build output, other versions' pages, and the app's own + * routes, not this version's pages. A missing prefix directory * returns 0 rather than throwing, so the caller can report the mismatch * itself. * @@ -124,9 +126,9 @@ export async function countPages(stageDir, prefixSegments) { /** * Whether a path (relative to the root-served latest version) falls under a * top-level directory that is not one of that version's own pages: the - * shared 404/_not-found pair, or another version's prefix directory. A - * top-level file itself (no directory component, e.g. `index.html`) is never - * excluded. + * shared 404/_not-found pair, another version's prefix directory, or a route + * the app owns. A top-level file itself (no directory component, e.g. + * `index.html`) is never excluded. * * @param {string} rel * @returns {boolean} @@ -135,7 +137,13 @@ function isExcludedRootTopLevel(rel) { const segments = rel.split(path.sep); if (segments.length < 2) return false; const top = segments[0]; - return top === "404" || top === "_not-found" || isVersionShapedSegment(top); + const route = segments.join("/"); + return ( + top === "404" || + top === "_not-found" || + isVersionShapedSegment(top) || + RESERVED_ROUTES.some((reserved) => route.startsWith(`${reserved}/`)) + ); } /** diff --git a/apps/docs/scripts/build-helpers.test.mjs b/apps/docs/scripts/build-helpers.test.mjs index f90aefb3..580c1624 100644 --- a/apps/docs/scripts/build-helpers.test.mjs +++ b/apps/docs/scripts/build-helpers.test.mjs @@ -3,6 +3,7 @@ import { mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises" import { tmpdir } from "node:os"; import path from "node:path"; import { afterEach, beforeEach, test } from "node:test"; +import { RESERVED_ROUTES } from "@coder/docs-build"; import { clearNextDir, countPages, @@ -165,6 +166,13 @@ test("countPages counts index.html under the root prefix, excluding 404/_not-fou assert.equal(await countPages(path.join(dir, "stage"), []), 2); }); +test("countPages leaves out pages under a route the app owns", async () => { + await write("stage/index.html", "root"); + for (const route of RESERVED_ROUTES) await write(`stage/${route}/index.html`, "app page"); + + assert.equal(await countPages(path.join(dir, "stage"), []), 1); +}); + test("countPages counts index.html under a version prefix, including its own root", async () => { await write("stage/v0.1/index.html", "v0.1 root"); await write("stage/v0.1/admin/users/index.html", "v0.1 admin users"); diff --git a/apps/docs/scripts/single-version.e2e.mjs b/apps/docs/scripts/single-version.e2e.mjs index eef8e1e9..f374370e 100644 --- a/apps/docs/scripts/single-version.e2e.mjs +++ b/apps/docs/scripts/single-version.e2e.mjs @@ -384,6 +384,11 @@ async function datedFixture() { "_next under the base path", ); assert.ok(files.includes("beta-docs/api/search"), "search index at the base path"); + assert.deepEqual( + files.filter((f) => f.startsWith("beta-docs/home-prototype/")), + [], + "no prototype route is published", + ); // Nothing may carry the root version's own prefix: its pages and assets are // laid out at the base path, and the router reads `v0.2` requests from those // keys. The export emits the plain-text channel under that prefix too (the diff --git a/packages/docs-config/src/home.ts b/packages/docs-config/src/home.ts index 6d605ed3..d1838b67 100644 --- a/packages/docs-config/src/home.ts +++ b/packages/docs-config/src/home.ts @@ -1,13 +1,4 @@ -// The docs home page's content file, `docs/home.json` in the corpus, and the -// rules it is held to. Provisional: the file's location, format, and owner are -// open questions for the engine, and only the home page prototype reads it. -// -// The corpus is untrusted (refer to the "Security: the corpus is untrusted" -// section of packages/docs-transforms/README.md), so the file is data only: -// links are docs routes or a short allowlist of external hosts, icons and -// logos are names the engine looks up in its own static maps, and every string -// has a length cap. Titles default to the linked page's own, so the file names -// pages rather than copying them. +// Schema for docs/home.json (provisional). The corpus is untrusted, so the file is data only. import { z } from "zod"; /** Phosphor icon names the file may use; the engine maps each to its component. */ @@ -69,10 +60,7 @@ export const MAX_HOME_FILE_BYTES = 64 * 1024; const text = (max: number) => z.string().trim().min(1).max(max); -// A docs route with an optional heading fragment: `/install`, -// `/admin/setup#tls--reverse-proxy`. No scheme, no `//` host, no query, no -// `..` segment. Segments are separated by exactly one slash and dots only sit -// between characters, so no input can make the pattern backtrack. +// Single slashes between segments keep this pattern from backtracking. const SEGMENT = "[A-Za-z0-9_~-]+(?:\\.[A-Za-z0-9_~-]+)*"; export const HOME_ROUTE_PATTERN = new RegExp( `^/(?:${SEGMENT}(?:/${SEGMENT})*/?)?(?:#[A-Za-z0-9_-]+)?$`, @@ -97,8 +85,7 @@ const externalUrl = z `must be an https URL on ${[...HOME_EXTERNAL_HOSTS].join(", ")}`, ); -// A link to a docs page: the route alone takes the page's own title, or an -// object overrides the title. +// A link is a route, or an object whose title overrides the page's own. const pageLink = z.union([route, z.object({ href: route, title: text(60).optional() }).strict()]); const button = z.object({ href: route, title: text(40) }).strict(); @@ -170,8 +157,7 @@ export const homeFileSchema = z .strict(), ) .max(6), - // The section cards are the sidebar's top-level sections, in sidebar - // order; the file only leaves some out and picks their icons. + // Section cards follow sidebar order; the file only omits some and sets icons. sections: z .object({ exclude: z.array(route).max(20).default([]), @@ -195,11 +181,7 @@ export type HomeFile = z.infer; export type HomeFileParseResult = { ok: true; data: HomeFile } | { ok: false; issues: string[] }; -/** - * Parse and validate the file's text. Strips a UTF-8 byte order mark, which - * Windows editors add and JSON.parse rejects; CRLF line endings are JSON - * whitespace and need no handling. - */ +/** Parses and validates the file text, stripping a UTF-8 BOM that Windows editors add. */ export function parseHomeFile(raw: string): HomeFileParseResult { const textValue = raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw; let json: unknown; From 4355a036264d19df4ce63772fb2f182fa07a2077 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 16:53:38 +0000 Subject: [PATCH 05/11] fix(docs): type the home prototype's svg imports without a build The logo imports typechecked locally only because next-env.d.ts, which references Next's static image types, exists after a build or a dev run. It is gitignored, and CI typechecks before building, so every import failed there. A committed declaration references the same types. Assisted-by: AI --- apps/docs/lib/home-prototype/image-types.d.ts | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 apps/docs/lib/home-prototype/image-types.d.ts diff --git a/apps/docs/lib/home-prototype/image-types.d.ts b/apps/docs/lib/home-prototype/image-types.d.ts new file mode 100644 index 00000000..19a9988b --- /dev/null +++ b/apps/docs/lib/home-prototype/image-types.d.ts @@ -0,0 +1,2 @@ +// Next's static image types, which next-env.d.ts adds only after a build or dev run. +/// From 75712738364aa8c0f63f4dd2f8bfe38476a5869d Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 17:05:25 +0000 Subject: [PATCH 06/11] feat(docs): show OpenShift on the home prototype's logo wall The wall showed air-gapped networks in OpenShift's place because no mark had been found, but the search covered only coder/coder's site icons. The docs tree ships one, which the sidebar already uses for the OpenShift install page, so the wall links that page again. The copy here is cropped to the artwork and set to brand black. The original's padding and mid grey made it render smaller and fainter than the marks beside it. Assisted-by: AI --- apps/docs/lib/home-prototype/home-blocks.tsx | 2 ++ apps/docs/lib/home-prototype/home-resolve.ts | 1 + apps/docs/lib/home-prototype/home.fixture.json | 6 +++--- apps/docs/lib/home-prototype/logos/openshift.svg | 9 +++++++++ packages/docs-config/src/home.ts | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 apps/docs/lib/home-prototype/logos/openshift.svg diff --git a/apps/docs/lib/home-prototype/home-blocks.tsx b/apps/docs/lib/home-prototype/home-blocks.tsx index ed509a1a..51c99c15 100644 --- a/apps/docs/lib/home-prototype/home-blocks.tsx +++ b/apps/docs/lib/home-prototype/home-blocks.tsx @@ -20,6 +20,7 @@ import microsoft from "./logos/microsoft.svg"; import okta from "./logos/okta.svg"; import codex from "./logos/openai-codex.svg"; import opencode from "./logos/opencode.svg"; +import openshift from "./logos/openshift.svg"; import zed from "./logos/zed.svg"; // Marks are bundled statically, so previews need no copy step. @@ -41,6 +42,7 @@ const LOGO_SRC: Record = { "okta.svg": okta, "openai-codex.svg": codex, "opencode.svg": opencode, + "openshift.svg": openshift, "zed.svg": zed, }; diff --git a/apps/docs/lib/home-prototype/home-resolve.ts b/apps/docs/lib/home-prototype/home-resolve.ts index 32a6532e..626f6ded 100644 --- a/apps/docs/lib/home-prototype/home-resolve.ts +++ b/apps/docs/lib/home-prototype/home-resolve.ts @@ -19,6 +19,7 @@ const LOGOS: Record = { microsoft: { file: "microsoft.svg" }, okta: { file: "okta.svg", tone: "light" }, opencode: { file: "opencode.svg", tone: "light" }, + openshift: { file: "openshift.svg", tone: "dark" }, vscode: { file: "code.svg" }, zed: { file: "zed.svg", tone: "light" }, }; diff --git a/apps/docs/lib/home-prototype/home.fixture.json b/apps/docs/lib/home-prototype/home.fixture.json index 20c21614..6f07d81e 100644 --- a/apps/docs/lib/home-prototype/home.fixture.json +++ b/apps/docs/lib/home-prototype/home.fixture.json @@ -211,9 +211,9 @@ "logo": "gcp" }, { - "name": "Air-gapped networks", - "href": "/install/prepare/airgap", - "icon": "WifiSlash" + "name": "OpenShift", + "href": "/install/server/openshift", + "logo": "openshift" } ] }, diff --git a/apps/docs/lib/home-prototype/logos/openshift.svg b/apps/docs/lib/home-prototype/logos/openshift.svg new file mode 100644 index 00000000..9f36a988 --- /dev/null +++ b/apps/docs/lib/home-prototype/logos/openshift.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/docs-config/src/home.ts b/packages/docs-config/src/home.ts index d1838b67..edac4c12 100644 --- a/packages/docs-config/src/home.ts +++ b/packages/docs-config/src/home.ts @@ -42,6 +42,7 @@ export const HOME_LOGO_NAMES = [ "microsoft", "okta", "opencode", + "openshift", "vscode", "zed", ] as const; From 56cebd61aa32a72f76e6c69164d79fe25ca70291 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 20:10:50 +0000 Subject: [PATCH 07/11] feat(docs): show a CLI walkthrough in the home prototype's hero window The hero window repeated the install commands from coder.com/downloads. It now walks from coder login to coder ssh through a Docker template, and links the CLI reference, so the page adds something the downloads page doesn't. The schema key is terminal, with one to six steps and an optional link; the Windows line is gone. The page no longer mentions Agent Firewall. The AI door links Coder Agents getting started instead, and sections.descriptions lets the file override a section card's description, which the AI Governance card needs because its manifest description names Agent Firewall. Assisted-by: AI --- .../app/home-prototype/page.prototype.tsx | 4 +-- apps/docs/lib/home-prototype/home-blocks.tsx | 25 ++++++-------- apps/docs/lib/home-prototype/home-resolve.ts | 12 +++++-- .../docs/lib/home-prototype/home.fixture.json | 34 +++++++++++++------ apps/docs/scripts/home-resolve.test.mjs | 20 ++++++----- packages/docs-config/src/home.test.ts | 8 ++--- packages/docs-config/src/home.ts | 8 ++--- 7 files changed, 65 insertions(+), 46 deletions(-) diff --git a/apps/docs/app/home-prototype/page.prototype.tsx b/apps/docs/app/home-prototype/page.prototype.tsx index 02c3c060..eb03265d 100644 --- a/apps/docs/app/home-prototype/page.prototype.tsx +++ b/apps/docs/app/home-prototype/page.prototype.tsx @@ -4,7 +4,7 @@ import type { Metadata } from "next"; import Link from "next/link"; import { AudienceDoors, - InstallWindow, + TerminalWindow, LogoWall, PopularPills, SectionCards, @@ -42,7 +42,7 @@ export default function Page() {
  • - +
    diff --git a/apps/docs/lib/home-prototype/home-blocks.tsx b/apps/docs/lib/home-prototype/home-blocks.tsx index 51c99c15..c58cc6f6 100644 --- a/apps/docs/lib/home-prototype/home-blocks.tsx +++ b/apps/docs/lib/home-prototype/home-blocks.tsx @@ -115,36 +115,33 @@ function Command({ command }: { command: string }) { ); } -/** The Quickstart's install commands in an always-dark product window. */ -export function InstallWindow({ install }: { install: HomeProps["install"] }) { +/** A CLI walkthrough in an always-dark product window. */ +export function TerminalWindow({ terminal }: { terminal: HomeProps["terminal"] }) { return ( -
    +
    -

    - {install.title} +

    + {terminal.title}

    - {install.steps.map((step) => ( + {terminal.steps.map((step) => (
    # {step.comment}
    ))}
    -
    - {install.windows ? ( - - On Windows: {install.windows} - - ) : null} - {install.link.title} -
    + {terminal.link ? ( +
    + {terminal.link.title} +
    + ) : null}
    ); } diff --git a/apps/docs/lib/home-prototype/home-resolve.ts b/apps/docs/lib/home-prototype/home-resolve.ts index 626f6ded..9a9abb2e 100644 --- a/apps/docs/lib/home-prototype/home-resolve.ts +++ b/apps/docs/lib/home-prototype/home-resolve.ts @@ -39,7 +39,7 @@ export type ResolvedLogo = { file: string; tone?: "light" | "dark"; invertInDark export type HomeProps = { hero: { title: string; description?: string; primary: ResolvedLink; secondary: ResolvedLink }; - install: HomeFile["install"]; + terminal: Omit & { link?: HomeFile["terminal"]["link"] }; popular: ResolvedLink[]; audiences: { id: string; @@ -105,16 +105,21 @@ export function resolveHome( primary: link(file.hero.primary, "hero.primary") ?? { ...file.hero.primary }, secondary: link(file.hero.secondary, "hero.secondary") ?? { ...file.hero.secondary }, }; - check(file.install.link.href, "install.link"); + const terminalLink = check(file.terminal.link.href, "terminal.link") + ? file.terminal.link + : undefined; const excluded = new Set(file.sections.exclude.map(normalize)); const icons = new Map( Object.entries(file.sections.icons).map(([route, icon]) => [normalize(route), icon]), ); + const descriptions = new Map( + Object.entries(file.sections.descriptions).map(([route, text]) => [normalize(route), text]), + ); const props: HomeProps = { hero, - install: file.install, + terminal: { title: file.terminal.title, steps: file.terminal.steps, link: terminalLink }, popular: links(file.popular, "popular"), audiences: file.audiences.map((audience, index) => { check(audience.href, `audiences[${index}].href`); @@ -134,6 +139,7 @@ export function resolveHome( .filter((section) => !excluded.has(normalize(section.href))) .map((section) => ({ ...section, + description: descriptions.get(normalize(section.href)) ?? section.description, icon: icons.get(normalize(section.href)) ?? DEFAULT_SECTION_ICON, })), help: { diff --git a/apps/docs/lib/home-prototype/home.fixture.json b/apps/docs/lib/home-prototype/home.fixture.json index 6f07d81e..2670c9a7 100644 --- a/apps/docs/lib/home-prototype/home.fixture.json +++ b/apps/docs/lib/home-prototype/home.fixture.json @@ -10,22 +10,33 @@ "href": "/install" } }, - "install": { - "title": "Install Coder on Linux or macOS", + "terminal": { + "title": "From sign-in to your first workspace", "steps": [ { - "comment": "Install the coder CLI", - "command": "curl -fsSL https://coder.com/install.sh | sh" + "comment": "Sign in to your deployment", + "command": "coder login https://coder.example.com" }, { - "comment": "Start Coder", - "command": "coder server" + "comment": "Start from the Docker starter template", + "command": "coder templates init --id docker ./docker" + }, + { + "comment": "Publish it as a template named docker", + "command": "coder templates push -d ./docker docker" + }, + { + "comment": "Create a workspace from it", + "command": "coder create --template docker my-workspace" + }, + { + "comment": "Connect over SSH", + "command": "coder ssh my-workspace" } ], - "windows": "winget install Coder.Coder", "link": { - "title": "Follow the Quickstart", - "href": "/get-started" + "title": "Browse the CLI reference", + "href": "/reference/cli" } }, "popular": [ @@ -136,7 +147,7 @@ "links": [ "/coder-agents", "/ai-governance", - "/ai-governance/agent-firewall", + "/coder-agents/getting-started", { "title": "AI Gateway clients", "href": "/ai-governance/ai-gateway/clients" @@ -301,6 +312,9 @@ "/mcp-server": "Plugs", "/admin": "GearSix", "/reference": "BookOpenText" + }, + "descriptions": { + "/ai-governance": "Govern AI usage at scale with AI Gateway: audit AI sessions, manage MCP servers, and enforce policies." } }, "help": { diff --git a/apps/docs/scripts/home-resolve.test.mjs b/apps/docs/scripts/home-resolve.test.mjs index a1fc2338..d5ee3d4f 100644 --- a/apps/docs/scripts/home-resolve.test.mjs +++ b/apps/docs/scripts/home-resolve.test.mjs @@ -12,8 +12,8 @@ const pages = new Map([ const lookup = { page: (path) => pages.get(path), sections: () => [ - { href: "/get-started", title: "Get started" }, - { href: "/install", title: "Install" }, + { href: "/get-started", title: "Get started", description: "From the sidebar." }, + { href: "/install", title: "Install", description: "From the sidebar." }, { href: "/support", title: "Support" }, ], }; @@ -24,7 +24,7 @@ const file = { primary: { title: "Start", href: "/get-started" }, secondary: { title: "Install", href: "/install" }, }, - install: { title: "Install", steps: [], link: { title: "Quickstart", href: "/get-started" } }, + terminal: { title: "Install", steps: [], link: { title: "Quickstart", href: "/get-started" } }, popular: [ "/install/", { title: "SSH", href: "/workspaces/workspace-access#ssh" }, @@ -33,7 +33,11 @@ const file = { ], audiences: [], integrations: [], - sections: { exclude: ["/support"], icons: { "/install": "DownloadSimple" } }, + sections: { + exclude: ["/support"], + icons: { "/install": "DownloadSimple" }, + descriptions: { "/install/": "From the file." }, + }, help: { title: "Help", text: "Ask.", links: [{ title: "Support", href: "/support" }] }, }; @@ -55,13 +59,13 @@ test("a route or heading the version lacks is left out and reported, not rendere ]); }); -test("section cards follow the sidebar, minus exclusions, with the file's icons", () => { +test("section cards follow the sidebar, minus exclusions, with the file's icons and descriptions", () => { const { props } = resolveHome(file, lookup); assert.deepEqual( - props.sections.map((section) => [section.href, section.icon]), + props.sections.map((section) => [section.href, section.icon, section.description]), [ - ["/get-started", "BookOpenText"], - ["/install", "DownloadSimple"], + ["/get-started", "BookOpenText", "From the sidebar."], + ["/install", "DownloadSimple", "From the file."], ], ); }); diff --git a/packages/docs-config/src/home.test.ts b/packages/docs-config/src/home.test.ts index c590927c..b6b5828c 100644 --- a/packages/docs-config/src/home.test.ts +++ b/packages/docs-config/src/home.test.ts @@ -8,11 +8,9 @@ const valid = { primary: { title: "Start the Quickstart", href: "/get-started" }, secondary: { title: "Install Coder", href: "/install" }, }, - install: { - title: "Install Coder", - steps: [ - { comment: "Install the CLI", command: "curl -fsSL https://coder.com/install.sh | sh" }, - ], + terminal: { + title: "Your first workspace", + steps: [{ comment: "Sign in", command: "coder login https://coder.example.com" }], link: { title: "Follow the Quickstart", href: "/get-started" }, }, popular: ["/mcp-server", { title: "Connect over SSH", href: "/workspaces/workspace-access#ssh" }], diff --git a/packages/docs-config/src/home.ts b/packages/docs-config/src/home.ts index edac4c12..362f0140 100644 --- a/packages/docs-config/src/home.ts +++ b/packages/docs-config/src/home.ts @@ -105,14 +105,13 @@ export const homeFileSchema = z secondary: button, }) .strict(), - install: z + terminal: z .object({ title: text(60), steps: z .array(z.object({ comment: text(60), command: text(120) }).strict()) .min(1) - .max(3), - windows: text(120).optional(), + .max(6), link: button, }) .strict(), @@ -158,11 +157,12 @@ export const homeFileSchema = z .strict(), ) .max(6), - // Section cards follow sidebar order; the file only omits some and sets icons. + // Section cards follow sidebar order; the file omits some and sets icons and descriptions. sections: z .object({ exclude: z.array(route).max(20).default([]), icons: z.record(route, iconName).default({}), + descriptions: z.record(route, text(160)).default({}), }) .strict(), help: z From 3010938aa186f64fd911c30a03acf8f3ddda8435 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 20:11:03 +0000 Subject: [PATCH 08/11] style(docs): give the home prototype's search bars 4px corners HomeLayout draws its header search as a fully round pill, which coder.com's design system doesn't use. Both search bars on the page now take the hero search's 4px corners, coder.com's control radius. The rule sits outside a cascade layer, so it overrides the header's rounded-full utility. Assisted-by: AI --- apps/docs/app/home-prototype/home-prototype.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/docs/app/home-prototype/home-prototype.css b/apps/docs/app/home-prototype/home-prototype.css index c28a504e..15918ce3 100644 --- a/apps/docs/app/home-prototype/home-prototype.css +++ b/apps/docs/app/home-prototype/home-prototype.css @@ -189,6 +189,10 @@ .mk-hero-search:hover { border-color: var(--mk-line-strong); } +/* Every search bar takes the hero's 4px corners, not HomeLayout's pill. */ +.mk-landing [data-search-full] { + border-radius: 4px; +} .mk-pills { display: flex; From ce2a09360b9902dd8d78a03346f3205b86f83a8d Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 20:15:31 +0000 Subject: [PATCH 09/11] feat(docs): add coder.com's grid marks and footer dot mark to the home prototype coder.com frames each block with vertical guides and sets a small Blink rectangle, its registration mark, wherever a guide crosses a section's top hairline. The prototype now does the same, with marks 5 by 7px so a 1px line runs through the middle. Content sits 32px inside the guides, 16px on phones, as it does there; the frame grows to 1344px so content keeps its 1200px width. The hero has guides and no marks. The footer ends with coder.com's dotted wordmark, ported from its footer component with the 5px grid. A canvas draws it over a CSS mask fallback, and the dots move away from the pointer and spring back. It stays still under reduced motion, from the system setting or the docs' motion preference, and settles at once when either changes. The page's own reduced motion rules now also give way to the docs' full motion setting. Assisted-by: AI --- apps/docs/app/home-prototype/dot-mark.tsx | 287 ++++++++++++++++++ .../app/home-prototype/home-prototype.css | 85 +++++- .../app/home-prototype/page.prototype.tsx | 11 + apps/docs/lib/home-prototype/home-blocks.tsx | 16 + 4 files changed, 394 insertions(+), 5 deletions(-) create mode 100644 apps/docs/app/home-prototype/dot-mark.tsx diff --git a/apps/docs/app/home-prototype/dot-mark.tsx b/apps/docs/app/home-prototype/dot-mark.tsx new file mode 100644 index 00000000..09834321 --- /dev/null +++ b/apps/docs/app/home-prototype/dot-mark.tsx @@ -0,0 +1,287 @@ +"use client"; + +// Adapted from coder/coder-site packages/ui/components/FooterDotMark.tsx, grid5 pattern only. +import { useEffect, useRef } from "react"; + +const PATHS = [ + "M0 8.5C0 3.61351 4.15135 0.5 9.85946 0.5C15.5676 0.5 18.7676 3.2027 18.8757 7.18108L13.9459 7.33243C13.8162 5.12703 11.8595 3.67838 9.85946 3.72162C7.11351 3.77568 5.08108 5.6027 5.08108 8.5C5.08108 11.3973 7.11351 13.1919 9.85946 13.1919C11.8595 13.1919 13.773 11.8081 13.9892 9.6027L18.9189 9.71081C18.7892 13.7541 15.3946 16.5 9.85946 16.5C4.32433 16.5 0 13.3649 0 8.5Z", + "M20.6593 8.5C20.6593 3.67838 24.562 0.5 30.1728 0.5C35.7837 0.5 39.6864 3.65676 39.6864 8.5C39.6864 13.3432 35.7837 16.5 30.1728 16.5C24.562 16.5 20.6593 13.3216 20.6593 8.5ZM25.7404 8.5C25.7404 11.3108 27.5674 13.2351 30.1728 13.2351C32.7999 13.2351 34.6053 11.3541 34.6053 8.5C34.6053 5.64595 32.7783 3.67838 30.1728 3.67838C27.5674 3.67838 25.7404 5.68919 25.7404 8.5Z", + "M41.4269 16.0676V0.932454H47.6971C53.7728 0.932454 57.8593 3.76489 57.8593 8.50002C57.8593 13.2352 53.7728 16.0676 47.6971 16.0676H41.4269ZM46.3998 13.0406H47.4809C50.6809 13.0406 52.8215 11.3973 52.8215 8.50002C52.8215 5.60273 50.6809 3.93786 47.4809 3.93786H46.3998V13.0406Z", + "M64.5407 4.06759H72.3245V0.932454H59.611V16.0676H72.4758V12.8243H64.5407V9.84056H71.3515V6.96489H64.5407V4.06759Z", + "M84.8971 9.04056C87.8917 9.23516 89.3079 10.7811 89.8917 13.1487L90.4971 16.0676H84.8106L84.3349 13.3649C83.9241 11.6135 82.5187 10.9865 80.9404 10.9865H79.6214V16.0676H74.6485V0.932454H82.5404C87.0809 0.932454 89.8485 2.59732 89.8485 5.30002C89.8485 7.52705 87.9674 8.91083 84.8971 8.91083V9.04056ZM79.6214 8.32705H82.1079C83.816 8.32705 84.8755 7.46218 84.8755 6.0784C84.8755 4.69462 83.816 3.85137 82.1079 3.85137H79.6214V8.32705Z", + "M92.6811 0.932454H105.654V16.0676H92.6811V0.932454Z", +]; +const VB_W = 106; +const VB_H = 17; +const TILE = 5; +const DOT_R = 0.75; +const INK_ALPHA = 0.36; +const SPRING_K = 0.04; +const DAMP = 0.78; +const REPEL_RADIUS = 90; +const REPEL_FORCE = 5; +const MAX_SPEED = 10; +const PAD = 60; + +// Straight edges in viewBox units, weighted; the grid is shifted so they fall between dot rows. +const EDGES_Y: [number, number][] = [ + [7.25, 4], + [9.66, 4], + [0.93, 2], + [16.07, 2], + [4.0, 1], + [6.96, 1], + [9.84, 1], + [12.93, 1], +]; +const EDGES_X: [number, number][] = [ + [13.97, 3], + [18.9, 3], + [41.43, 1], + [46.4, 1], + [59.61, 1], + [64.54, 1], + [74.65, 1], + [79.62, 1], + [92.68, 1], + [105.65, 1], +]; + +const svgUrl = (svg: string) => `url("data:image/svg+xml,${encodeURIComponent(svg)}")`; +const LOGO = svgUrl( + `${PATHS.map((d) => ``).join("")}`, +); +const DOT_TILE = svgUrl( + ``, +); + +type Dot = { x: number; y: number; ox: number; oy: number; vx: number; vy: number }; + +// The C's cut ends are levelled for the inside test, so each arm keeps its corner dot. +function insideTestPath() { + const path = new Path2D(); + PATHS.forEach((d, index) => { + const level = + index === 0 + ? d + .replace("18.8757 7.18108L13.9459 7.33243", "18.8757 7.25676L13.9459 7.25676") + .replace("13.9892 9.6027L18.9189 9.71081", "13.9892 9.65676L18.9189 9.65676") + : d; + path.addPath(new Path2D(level)); + }); + return path; +} + +function phase(edges: [number, number][], scale: number) { + let best = 0; + let bestCost = Infinity; + for (let shift = 0; shift < TILE; shift += 0.125) { + let cost = 0; + for (const [edge, weight] of edges) { + const offset = (((edge * scale - shift) % TILE) + TILE) % TILE; + cost += weight * Math.max(0, TILE / 2 - Math.min(offset, TILE - offset)); + } + if (cost < bestCost) [best, bestCost] = [shift, cost]; + } + return best; +} + +const REDUCED_QUERY = "(prefers-reduced-motion: reduce)"; + +function reducedMotion() { + const motion = document.documentElement.dataset.motion; + return motion === "reduced" || (motion !== "full" && matchMedia(REDUCED_QUERY).matches); +} + +/** The Coder wordmark as a dot field that moves away from the pointer; it stays still under reduced motion. */ +export function DotMark({ className }: { className?: string }) { + const wrapRef = useRef(null); + const layerRef = useRef(null); + const canvasRef = useRef(null); + + useEffect(() => { + const wrap = wrapRef.current; + const layer = layerRef.current; + const canvas = canvasRef.current; + const ctx = canvas?.getContext("2d"); + if (!wrap || !layer || !canvas || !ctx) return; + + const sw = VB_W * 24; + const sh = VB_H * 24; + const raster = document.createElement("canvas"); + raster.width = sw; + raster.height = sh; + const rctx = raster.getContext("2d"); + if (!rctx) return; + rctx.scale(24, 24); + rctx.fill(insideTestPath(), "evenodd"); + const alpha = rctx.getImageData(0, 0, sw, sh).data; + const inside = (u: number, v: number) => { + const x = Math.min(sw - 1, Math.max(0, Math.floor(u * sw))); + const y = Math.min(sh - 1, Math.max(0, Math.floor(v * sh))); + return alpha[(y * sw + x) * 4 + 3] > 127; + }; + + const state = { + dots: [] as Dot[], + w: 0, + h: 0, + dpr: 1, + mx: -1e6, + my: -1e6, + strength: 0, + moving: false, + active: false, + raf: 0, + }; + + const build = () => { + const rect = layer.getBoundingClientRect(); + state.w = rect.width; + state.h = rect.height; + state.dpr = window.devicePixelRatio || 1; + canvas.width = Math.round((state.w + PAD * 2) * state.dpr); + canvas.height = Math.round((state.h + PAD * 2) * state.dpr); + canvas.style.width = `${canvas.width / state.dpr}px`; + canvas.style.height = `${canvas.height / state.dpr}px`; + const scale = state.w / VB_W; + const px = phase(EDGES_X, scale); + const py = phase(EDGES_Y, scale); + const dots: Dot[] = []; + for (let y = py - TILE + DOT_R; y <= state.h; y += TILE) { + for (let x = px - TILE + DOT_R; x <= state.w; x += TILE) { + if (x >= 0 && y >= 0 && inside(x / state.w, y / state.h)) { + dots.push({ x, y, ox: x, oy: y, vx: 0, vy: 0 }); + } + } + } + state.dots = dots; + }; + + const draw = () => { + if (!state.moving && state.strength > 0) state.strength = Math.max(0, state.strength - 0.018); + const radius = REPEL_RADIUS * state.strength; + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.fillStyle = getComputedStyle(layer).color; + ctx.globalAlpha = INK_ALPHA; + ctx.setTransform(state.dpr, 0, 0, state.dpr, PAD * state.dpr, PAD * state.dpr); + ctx.beginPath(); + let moving = state.active || state.strength > 0; + for (const dot of state.dots) { + if (radius > 1) { + const dx = dot.x - state.mx; + const dy = dot.y - state.my; + const dist = Math.hypot(dx, dy); + if (dist < radius && dist > 0) { + const k = 1 - dist / radius; + const force = k * k * k * REPEL_FORCE * state.strength; + dot.vx += (dx / dist) * force; + dot.vy += (dy / dist) * force; + } + } + dot.vx = (dot.vx + (dot.ox - dot.x) * SPRING_K) * DAMP; + dot.vy = (dot.vy + (dot.oy - dot.y) * SPRING_K) * DAMP; + const speed = Math.hypot(dot.vx, dot.vy); + if (speed > MAX_SPEED) { + dot.vx = (dot.vx / speed) * MAX_SPEED; + dot.vy = (dot.vy / speed) * MAX_SPEED; + } + dot.x += dot.vx; + dot.y += dot.vy; + if (speed > 0.01) moving = true; + if (Math.abs(dot.x - dot.ox) + Math.abs(dot.y - dot.oy) < 0.02 && speed < 0.01) { + dot.x = dot.ox; + dot.y = dot.oy; + dot.vx = 0; + dot.vy = 0; + } + ctx.moveTo(dot.x + DOT_R, dot.y); + ctx.arc(dot.x, dot.y, DOT_R, 0, Math.PI * 2); + } + ctx.fill(); + state.raf = moving ? requestAnimationFrame(draw) : 0; + }; + + const restart = () => { + cancelAnimationFrame(state.raf); + state.raf = requestAnimationFrame(draw); + }; + + const settle = () => { + cancelAnimationFrame(state.raf); + state.raf = 0; + state.strength = 0; + state.moving = false; + state.active = false; + for (const dot of state.dots) { + dot.x = dot.ox; + dot.y = dot.oy; + dot.vx = 0; + dot.vy = 0; + } + draw(); + }; + + let idle: number | undefined; + const onMove = (event: PointerEvent) => { + if (reducedMotion()) return; + const rect = layer.getBoundingClientRect(); + state.mx = event.clientX - rect.left; + state.my = event.clientY - rect.top; + state.moving = true; + state.strength = 1; + state.active = true; + if (!state.raf) restart(); + window.clearTimeout(idle); + idle = window.setTimeout(() => (state.moving = false), 80); + }; + const onLeave = () => { + state.active = false; + state.moving = false; + if (!state.raf) restart(); + }; + const onPreference = () => (reducedMotion() ? settle() : draw()); + + wrap.addEventListener("pointermove", onMove); + wrap.addEventListener("pointerleave", onLeave); + const query = matchMedia(REDUCED_QUERY); + query.addEventListener("change", onPreference); + const resize = new ResizeObserver(() => { + build(); + draw(); + }); + resize.observe(layer); + const prefs = new MutationObserver(onPreference); + prefs.observe(document.documentElement, { + attributes: true, + attributeFilter: ["class", "data-motion", "data-contrast"], + }); + + build(); + draw(); + layer.style.visibility = "hidden"; + + return () => { + wrap.removeEventListener("pointermove", onMove); + wrap.removeEventListener("pointerleave", onLeave); + query.removeEventListener("change", onPreference); + window.clearTimeout(idle); + resize.disconnect(); + prefs.disconnect(); + cancelAnimationFrame(state.raf); + layer.style.visibility = ""; + }; + }, []); + + return ( +