Skip to content
Myr

Fix the visual review's findings on the redesign

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- Code tab: the file tree's column draws a filter and skeleton rows on the server and while its body and read load, never an empty box. - Landing now: below tablet a row's refusal and time sit under the title in its column, so every row keeps one shape. - Settings: the head script names the system's scheme in data-system, so the stylesheet shows what each theme choice gives before hydration. - Explore's intro ends its sentence. - Docs: below columns the index shows no repeated tree, and a page's headings fold into a disclosure ahead of the article. - A README's headings go down a level, so the project's name is the one h1. - Install: cards keep their own height, and a command hangs only from tablet. - How to take an ask: on a phone only the first step is a command box. - DESIGN.md records the platform pages' system-sans fallback for sign-off.

authored by oscabriel · committed by oscabriel · parent c96b333 · Browse files · 24 files+436 added−108 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

24 files+436 added−108 removed

  • tests:+170 added−7 removed
  • other:+266 added−101 removed

24 files+436 added−108 removed

modified:apps/web/src/features/agents/install-page.tsx+1 added-1 removed
179 unmodified lines
180 <p className="text-want text-muted-foreground font-normal">181 {INSTALL_LEDE}182 </p>183 </div>184 <div className="columns:grid-cols-2 grid gap-5">184 <div className="columns:grid-cols-2 grid items-start gap-5">185 {installChannels(input).map((channel) => (186 <ChannelCard channel={channel} key={channel.id} />187 ))}188 </div>
16 unmodified lines
added:apps/web/src/features/code/tree-skeleton.tsx+16 added
modified:apps/web/src/features/docs/docs-view.tsx+87 added-58 removed
modified:apps/web/src/features/explore/explore-page.tsx+1 added-1 removed
171 unmodified lines
172 <div className="flex flex-col gap-3">173 <h1 className="text-headline">{EXPLORE_TITLE}</h1>174 <p className="text-body text-muted-foreground max-w-[72ch]">175 <Lede projects={projects} /> Looking for something to work on?{" "}176 <AppLink to={ASKS_PATH}>Every open ask</AppLink>176 <AppLink to={ASKS_PATH}>See every open ask</AppLink>.177 </p>178 </div>179 <Body projects={projects} />180 </main>
1 unmodified line
modified:apps/web/src/features/front/how-to.tsx+19 added-3 removed
87 unmodified lines
88const LINK = "decoration-rule underline hover:decoration-current";8990/**91 * The strip itself. Its onward line links Install through the router and92 * `llms.txt` as a plain anchor, since `llms.txt` is a server route.92 * `llms.txt` as a plain anchor, since `llms.txt` is a server route. On a phone93 * only the first step is a command box; the other two read as code in the94 * list, so the strip never becomes a column of code blocks (ADR 0041).95 */96export const HowToTake = ({97 onDismiss,98}: {
21 unmodified lines
120 >121 <X aria-hidden="true" strokeWidth={1.75} />122 </Button>123 </div>122 <ol className="columns:grid-cols-3 grid gap-4">124 <ol className="columns:grid-cols-3 tablet:gap-4 grid gap-3">125 {STEPS.map(({ command, label }, index) => (126 <li className="flex min-w-0 flex-col gap-1" key={command}>127 <p className="text-label text-muted-foreground">128 {index + 1}. {label}129 </p>130 {index === 0 ? (128 <CommandLine command={command} numbered />131 <CommandLine command={command} numbered />132 ) : (133 <>134 <code135 className="text-mono tablet:hidden font-mono [overflow-wrap:anywhere]"136 data-step-text=""137 >138 {command}139 </code>140 <div className="max-tablet:hidden">141 <CommandLine command={command} numbered />142 </div>143 </>144 )}145 </li>146 ))}147 </ol>148 <p className="text-ui text-muted-foreground">
15 unmodified lines
modified:apps/web/src/features/landing/landing-now-list.tsx+7 added-4 removed
24 unmodified lines
25/** A row's title: the ask's want as sentence text, or, when the list does not know it, the ask's id or the commit in mono. */26const titleOf = (want: string | undefined, code: string): ReactNode =>27 want ?? <span className="text-mono font-mono">{code}</span>;2829/** One row: the mark, the project over what landed or was refused, why it was refused, and when. */29/**30 * One row: the mark, the project over what landed or was refused, why it was refused, and when. Below `tablet` why31 * and when sit under the title in its column, so every row keeps one shape whatever the want's length.32 */33const Row = ({34 children,35 outcome,36 project,
8 unmodified lines
45 readonly to: string;46 readonly when: ReactNode;47}) => (48 <li46 className="border-rule tablet:flex-nowrap flex min-h-16 flex-wrap items-center gap-x-4 gap-y-1 border-b py-2.5"49 className="border-rule tablet:flex grid min-h-16 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1 border-b py-2.5"50 data-outcome={outcome}51 data-project={project}52 >53 <StateMarkIcon mark={outcome} />
11 unmodified lines
65 {title}66 </AppLink>67 </div>68 {children}66 <p className="text-ui tablet:w-32 tablet:text-right shrink-0 tabular-nums">69 <p className="text-ui tablet:w-32 tablet:text-right col-start-2 shrink-0 tabular-nums">70 {when}71 </p>72 </li>73);
39 unmodified lines
113 </span>114 </>115 }116 >114 <p className="text-ui tablet:max-w-64 tablet:text-right flex flex-wrap gap-x-3 gap-y-0.5">117 <p className="text-ui tablet:max-w-64 tablet:text-right col-start-2 flex flex-wrap gap-x-3 gap-y-0.5">118 {/* Two lanes failing read as one tag: the list names no lane. */}119 {Arr.dedupeWith(120 refusals,121 (one, other) => labelOf(one) === labelOf(other)
27 unmodified lines
modified:apps/web/src/features/markdown/markdown.tsx+18 added-5 removed
83 unmodified lines
84);8586const components: Components = { a: Anchor, img: Image };8788const PROSE = [88const PROSE_BASE = [89 "prose prose-tokens text-body max-w-[70ch] min-w-0",90 "prose-headings:font-semibold prose-headings:tracking-[-0.01em]",91 "prose-h1:text-title prose-h1:mb-3 prose-h1:border-b prose-h1:border-rule prose-h1:pb-2",92 "prose-h2:text-title prose-h2:mt-8 prose-h2:mb-3",93 "prose-h3:text-want prose-h4:text-want",91 "prose-code:before:content-none prose-code:after:content-none prose-code:font-normal",92 "[&_:not(pre)>code]:bg-surface [&_:not(pre)>code]:text-mono [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:py-px",93 "prose-pre:bg-surface prose-pre:text-foreground prose-pre:border prose-pre:border-rule prose-pre:rounded-none",94 "prose-pre:text-mono prose-pre:leading-terminal prose-pre:px-4 prose-pre:py-3",
1 unmodified line
96 "prose-blockquote:font-normal prose-blockquote:not-italic",97 "[&_blockquote_p]:before:content-none [&_blockquote_p]:after:content-none",98 "prose-img:my-0 prose-img:inline-block prose-img:max-w-full",99 "prose-table:text-ui prose-th:font-semibold",100];101102/** A page's own Markdown: its `#` is the page's one h1. */103const PROSE = [104 ...PROSE_BASE,105 "prose-h1:text-title prose-h1:mb-3 prose-h1:border-b prose-h1:border-rule prose-h1:pb-2",106 "prose-h2:text-title prose-h2:mt-8 prose-h2:mb-3",107 "prose-h3:text-want prose-h4:text-want",108].join(" ");109110/** A README, its headings a level down (`rehypeShiftHeadings`), drawn as they were before the shift. */111const README_PROSE = [112 ...PROSE_BASE,113 "prose-h2:text-title prose-h2:mt-0 prose-h2:mb-3 prose-h2:border-b prose-h2:border-rule prose-h2:pb-2",114 "prose-h3:text-title prose-h3:mt-8 prose-h3:mb-3",115 "prose-h4:text-want prose-h5:text-want",116].join(" ");117118export const RepoMarkdown = ({119 at,120 dir,121 project,122 source,123}: RepoMarkdownProps): ReactNode => (111 <div className={PROSE}>124 <div className={README_PROSE}>125 <Markdown126 components={components}127 rehypePlugins={rehypePluginsFor({ dir, project, sha: at })}128 remarkPlugins={remarkPlugins}
37 unmodified lines
modified:apps/web/src/features/markdown/pipeline.ts+22 added-3 removed
4 unmodified lines
5 * `user-content-` prefix, which the sanitizer adds next; 5. `rehypeSanitize`6 * with `schema`, the last gate (no script, handler, `javascript:` or `data:`7 * URL, iframe, style or form; every `id` and `name` prefixed, so a README8 * cannot clobber the page's globals); 6. `rehypeSlug`, after the sanitizer, so9 * `#usage` finds `## Usage` unprefixed; 7. `rehypeFragmentLinks`, last, once10 * every id is final. react-markdown's `defaultUrlTransform` stays on as a11 * second net.9 * `#usage` finds `## Usage` unprefixed; 7. `rehypeFragmentLinks`, once10 * every id is final; 8. `rehypeShiftHeadings`, a README's only, which moves no11 * id or URL. react-markdown's `defaultUrlTransform` stays on as a second net.12 */13import { Predicate } from "effect";14import type { Element, Properties, Root } from "hast";15import type { Options } from "react-markdown";
161 unmodified lines
177 }178 });179};180181const SHIFTED = new Map([182 ["h1", "h2"],183 ["h2", "h3"],184 ["h3", "h4"],185 ["h4", "h5"],186 ["h5", "h6"],187]);188189/**190 * A README sits under the page's own h1 (the project's name), so its headings191 * go down a level: its `# name` reads as an h2, and an h6 stays an h6.192 */193export const rehypeShiftHeadings = () => (tree: Root) => {194 visit(tree, "element", (node) => {195 node.tagName = SHIFTED.get(node.tagName) ?? node.tagName;196 });197};198199export const remarkPlugins: PluggableList = [remarkGfm];200201export const rehypePluginsFor = (at: MarkdownAt): PluggableList => [202 rehypeRaw,
1 unmodified line
204 rehypeFootnoteIds,205 [rehypeSanitize, schema],206 rehypeSlug,207 rehypeFragmentLinks,208 rehypeShiftHeadings,209];210211export const sitePlugins: PluggableList = [212 [rehypeSanitize, schema],
3 unmodified lines
modified:apps/web/src/features/settings/appearance.tsx+7 added-1 removed
69 unmodified lines
70 type="radio"71 value={choice}72 />73 <span className="font-medium">{CHOICE_LABELS[choice]}</span>74 {/* Before React knows the system, the head script's `data-system` names it through the stylesheet. */}74 {system === undefined ? null : (75 {system === undefined ? (76 <span77 className="text-muted-foreground ml-auto"78 data-system-resolves={choice}79 />80 ) : (81 <span className="text-muted-foreground ml-auto">82 {THEME_LABELS[resolveTheme(system, choice)]}83 </span>84 )}
112 unmodified lines
modified:apps/web/src/features/shared/shell/app-shell.tsx+28 added-12 removed
1import { useHydrated, useLocation } from "@tanstack/react-router";2import { cn } from "cn";3import { Suspense, useCallback, useMemo, useState } from "react";4import type { ReactNode } from "react";56import { KeysProvider } from "../keys.tsx";7import { SkipLink } from "../layout.tsx";8import { docsPath } from "../paths.ts";9import { ShellContext, ShellReadsContext } from "./context.ts";10import type { Overlay, ShellReads } from "./context.ts";11import { DocsNav } from "./docs-nav.tsx";12import { Footer } from "./footer.tsx";
12 unmodified lines
25 {children}26 </div>27);2829/**30 * The article first, so it is read first; from `columns` the tree stands to its left. Below `columns` the index31 * shows no tree under itself: the index already lists every page.32 */33const DocsFrame = ({ children }: { readonly children: ReactNode }) => {34 const index = useLocation({35 select: ({ pathname }) => pathname.replace(/\/$/u, "") === docsPath(),36 });27/** The article first, so it is read first; from `columns` the tree stands to its left. */28const DocsFrame = ({ children }: { readonly children: ReactNode }) => (29 <div className="columns:grid columns:grid-cols-[var(--column-docs-nav)_minmax(0,1fr)] max-w-site mx-auto flex w-full flex-1 flex-col">30 <div className="columns:col-start-2 columns:row-start-1 flex min-w-0 flex-col">31 {children}3738 return (39 <div className="columns:grid columns:grid-cols-[var(--column-docs-nav)_minmax(0,1fr)] max-w-site mx-auto flex w-full flex-1 flex-col">40 <div className="columns:col-start-2 columns:row-start-1 flex min-w-0 flex-col">41 {children}42 </div>43 <div44 className={cn(45 "border-rule columns:col-start-1 columns:row-start-1 columns:sticky columns:top-(--top-bar) columns:self-start columns:max-h-[calc(100dvh-var(--top-bar))] columns:overflow-y-auto columns:block columns:border-t-0 border-t py-6",46 index && "hidden",47 GUTTER48 )}49 data-docs-tree={index ? "index" : "page"}50 >51 <DocsNav />52 </div>53 </div>33 <div34 className={`border-rule columns:col-start-1 columns:row-start-1 columns:sticky columns:top-(--top-bar) columns:self-start columns:max-h-[calc(100dvh-var(--top-bar))] columns:overflow-y-auto columns:border-t-0 border-t py-6 ${GUTTER}`}35 >36 <DocsNav />37 </div>38 </div>39);54 );55};5657const FRAMES = {58 docs: DocsFrame,59 focus: ({ children }: { readonly children: ReactNode }) => (
94 unmodified lines
modified:apps/web/src/features/shared/command.tsx+10 added-2 removed
1import { Check, Copy } from "lucide-react";2import type { CSSProperties } from "react";34import { Button } from "../../components/ui/button.tsx";5import { useCopy } from "./copy-action.tsx";6import { useNumberedCommand } from "./keys.tsx";
12 unmodified lines
19 hang,20 line.length - Math.max(0, ...words.map(({ length }) => length))21 );2223/** The hang as a variable, which the line takes from `tablet` only: on a phone the words want the whole width. */24const hangStyle = (25 hang: number26): CSSProperties & { readonly "--hang": string } => ({27 "--hang": `${hang}ch`,28});2930// Breaks between words, never after a word's own hyphen (`--project`) nor31// before a closing ` \`.32const wordsOf = (command: string) =>33 command.split("\n").map((line, at, lines) => {
7 unmodified lines
4142 return (43 // A line never moves: its place in the command is its key.44 <span37 className="block"45 className="tablet:pl-(--hang) tablet:-indent-(--hang) block"46 key={at}39 style={{ paddingLeft: `${hang}ch`, textIndent: `-${hang}ch` }}47 style={hangStyle(hang)}48 >49 {parts.map((part, index) =>50 part.trim() === "" ? (51 part
72 unmodified lines
modified:apps/web/src/features/shared/theme.ts+5 added-3 removed
107 unmodified lines
108 * `resolveTheme` gives: sets `data-theme` on `<html>` before first paint and109 * colours a `theme-color` meta of its own, and does it again when the110 * system's scheme changes or another tab writes the preference. Plain ES5111 * with no imports; where it never runs, the stylesheet's media query and the112 * rendered metas are the fallback. `test/theme.test.ts` runs it.112 * rendered metas are the fallback. It also names the system's own scheme in113 * `data-system`, so /settings can show what each choice gives before React114 * runs. `test/theme.test.ts` runs it.115 */114export const THEME_SCRIPT = `(function(){var d=document,m=matchMedia(${JSON.stringify(DARK_SCHEME_QUERY)}),c=${JSON.stringify(themeColors)};function a(){var p,s;try{p=localStorage.getItem(${JSON.stringify(THEME_PREFERENCE_KEY)})}catch(x){}var t=m.matches!==(p==="opposite")?"dark":"light";d.documentElement.dataset.theme=t;s="meta[data-theme-color]";if(!d.querySelector(s))d.head.insertAdjacentHTML("afterbegin",${JSON.stringify(THEME_META)});d.querySelector(s).setAttribute("content",c[t])}a();m.addEventListener("change",a);addEventListener("storage",a)})()`;116export const THEME_SCRIPT = `(function(){var d=document,m=matchMedia(${JSON.stringify(DARK_SCHEME_QUERY)}),c=${JSON.stringify(themeColors)};function a(){var p,s,e=d.documentElement.dataset;try{p=localStorage.getItem(${JSON.stringify(THEME_PREFERENCE_KEY)})}catch(x){}var t=m.matches!==(p==="opposite")?"dark":"light";e.theme=t;e.system=m.matches?"dark":"light";s="meta[data-theme-color]";if(!d.querySelector(s))d.head.insertAdjacentHTML("afterbegin",${JSON.stringify(THEME_META)});d.querySelector(s).setAttribute("content",c[t])}a();m.addEventListener("change",a);addEventListener("storage",a)})()`;117118/**119 * The script's hash as a CSP source. The web sets no Content-Security-Policy120 * on its pages; one added later lists this in `script-src`. A test holds it121 * to the script's text.122 */123export const THEME_SCRIPT_SOURCE =122 "'sha256-AVNSogXudFMj8DxU6fv5GiySiexVFS9KraUSG8LLOSo='";124 "'sha256-wBIkzc5HrsCSaxUQgB2fHQqInWgTrPnNbdSjB9xjqnk='";
modified:apps/web/src/routes/$owner/$project/tree/-code-column.tsx+13 added-3 removed
1 unmodified line
2// (`-code-files.tsx`) once the page is up.3import { ClientOnly } from "@tanstack/react-router";4import { lazy, Suspense } from "react";56import { TreeSkeleton } from "../../../../features/code/tree-skeleton.tsx";7import { SideColumn } from "../../../../features/shared/shell/side-column.tsx";89const Body = import.meta.env.SSR10 ? undefined11 : lazy(() => import("./-code-files.tsx"));1213// The server and the first paint draw the tree's shape, so the column never stands empty while its body loads.14const waiting = (15 <div className="flex min-h-0 flex-1 flex-col pt-3">16 <TreeSkeleton />17 </div>18);1920const Later = ({ commit }: { readonly commit: boolean }) =>13 Body === undefined ? null : (14 <ClientOnly fallback={null}>15 <Suspense fallback={null}>21 Body === undefined ? (22 waiting23 ) : (24 <ClientOnly fallback={waiting}>25 <Suspense fallback={waiting}>26 <Body commit={commit} />27 </Suspense>28 </ClientOnly>29 );
14 unmodified lines
modified:apps/web/src/routes/$owner/$project/tree/-code-files.tsx+14 added-3 removed
29 unmodified lines
30 diffAnchor,31 treeHref,32 whyHref,33} from "../../../../features/code/paths.ts";34import { TreeSkeleton } from "../../../../features/code/tree-skeleton.tsx";3536const isProject = Schema.is(ProjectName);3738const decode = Schema.decodeUnknownOption(CommitPageData);
85 unmodified lines
124 const ordered = useMemo(() => (paths ?? []).toSorted(treeOrder), [paths]);125126 useCodeFileKeys(ordered, path, open);127127 return shown && paths !== undefined ? (128 if (!shown) {129 return null;130 }131132 if (AsyncResult.isInitial(read)) {133 return <TreeSkeleton />;134 }135136 return paths === undefined ? null : (137 <ClientTree138 current={path}139 fallback={<TreeSkeleton />}140 key={`${project}@${rev}`}141 onOpen={open}142 paths={paths}143 />134 ) : null;144 );145};146147export const CodeFiles = ({148 always = false,
5 unmodified lines
154155 return project === undefined ? null : (156 <div className="flex min-h-0 flex-1 flex-col">157 <div className="min-h-0 flex-1 pt-3">148 <ClientOnly fallback={null}>158 <ClientOnly fallback={<TreeSkeleton />}>159 <ProjectTree160 kind={kind}161 path={path}162 project={project}
45 unmodified lines
208 <div className="min-h-0 flex-1 pt-3">209 <ClientTree210 counts={counts}211 current={current}212 fallback={<TreeSkeleton />}213 key={paths.join("\n")}214 onOpen={open}215 open216 paths={paths}
11 unmodified lines
modified:apps/web/src/styles.css+16 added
518 unmodified lines
519 }520 }521}522523/*524 What each theme choice on /settings gives, before React can see the525 system (ADR 0042): the head script names the system's scheme in526 data-system, and these name the resolution the same way the component527 does once it runs. Where the script never ran, nothing is named.528*/529:root[data-system="light"] [data-system-resolves="same"]::after,530:root[data-system="dark"] [data-system-resolves="opposite"]::after {531 content: "Light";532}533534:root[data-system="dark"] [data-system-resolves="same"]::after,535:root[data-system="light"] [data-system-resolves="opposite"]::after {536 content: "Dark";537}538539@layer base {540 * {541 @apply border-border outline-ring/50;542 }
184 unmodified lines
modified:apps/web/test/code.test.tsx+21 added
50 unmodified lines
51import { readCommitPage } from "../src/routes/$owner/$project/commit/$sha.tsx";52import { readLogPage } from "../src/routes/$owner/$project/commits/$rev.tsx";53import { readRefsPage } from "../src/routes/$owner/$project/refs.tsx";54import { readTreePage } from "../src/routes/$owner/$project/tree/$rev/$.tsx";55import {56 CodeColumn,57 CommitColumn,58} from "../src/routes/$owner/$project/tree/-code-column.tsx";59import { elementWith, elementsWith } from "./records.ts";60import { renderAt } from "./render.tsx";61import { reachingTransport } from "./transport.ts";62
1961 unmodified lines
2024 );2025 })2026 );2027});20282029// The column's body loads once the page is up; until then it draws the2030// tree's shape, so it never stands as an empty box beside the page.2031describe("the Code tab's side column before its body loads", () => {2032 it.effect.each([2033 ["the tree", <CodeColumn key="tree" />],2034 ["a commit's files", <CommitColumn key="commit" />],2035 ] as const)("draws %s as a filter and rows, busy", ([, column]) =>2036 Effect.gen(function* () {2037 const markup = yield* renderAt("/oscabriel/burrow/tree/main", column);20382039 expect(markup).toContain('aria-busy="true"');2040 expect(markup).toContain("Reading the files");2041 expect(markup.match(/data-slot="skeleton"/gu)?.length).toBeGreaterThan(1);2042 })2043 );2044});
modified:apps/web/test/docs.test.tsx+49 added-1 removed
12 unmodified lines
13} from "../src/features/docs/docs-view.tsx";14import { docsHead } from "../src/features/docs/head.ts";15import { AppShell } from "../src/features/shared/shell/app-shell.tsx";16import { docsMarkdownHandler } from "../src/routes/docs/{$page}[.]md.ts";17import { textIn } from "./markup.ts";17import { attributeOf, tagsWith, textIn } from "./markup.ts";18import { renderAt } from "./render.tsx";1920const input = {21 commands,
106 unmodified lines
128 })129 );130});131132/** The classes on the docs tree's wrapper. */133const treeClasses = (tag: string) =>134 (attributeOf(tag, "class") ?? "").split(" ");135136describe("the docs below `columns`", () => {137 it.effect(138 "fold a page's headings into a disclosure ahead of its body, linking what On this page links",139 () =>140 Effect.gen(function* () {141 const markup = yield* inDocsShell("start-here");142 const ahead = elementOf(markup, "details", 'class="');143 const article = elementOf(markup, "article", "data-doc");144145 expect(ahead).toContain("columns:hidden");146 expect(147 linksOf(ahead).map(({ href, text }) => [href.slice(1), text])148 ).toStrictEqual(contentsOf(markup));149 expect(article.indexOf("<details")).toBeLessThan(150 article.indexOf("<h2")151 );152 })153 );154155 // The index already lists every page, so the tree under it would say it twice.156 it.effect("show no tree under the index, and the tree under a page", () =>157 Effect.gen(function* () {158 const index = tagsWith(159 yield* renderAt(160 "/docs",161 <AppShell>162 <DocsIndexView pages={pages} />163 </AppShell>164 ),165 "data-docs-tree"166 );167168 const page = tagsWith(yield* inDocsShell("landing"), "data-docs-tree");169170 expect(171 ["hidden", "columns:block"].filter(172 (name) => !index.flatMap(treeClasses).includes(name)173 )174 ).toStrictEqual([]);175 expect(page.flatMap(treeClasses)).not.toContain("hidden");176 })177 );178});179180describe("the docs' links to setup", () => {181 it("send a reader to /install, never the old /agents", () => {182 expect(183 pages.flatMap(({ markdown, slug }) =>
206 unmodified lines
modified:apps/web/test/front.test.tsx+22 added
548 unmodified lines
549 })550 );551552 it.effect(553 "keeps one command box in the strip on a phone, the other two steps as code in the list",554 () =>555 Effect.gen(function* () {556 const strip = stripIn(yield* front({}));557558 expect(559 [560 ...strip.matchAll(561 /<code\b[^>]*data-step-text=""[^>]*>(?<command>[^<]*)<\/code>/gu562 ),563 ].map(({ groups }) => groups?.command)564 ).toStrictEqual([565 `${Brand.cli} check`,566 `git push ${Brand.slug} HEAD:main`,567 ]);568 expect(strip.match(/<div class="max-tablet:hidden">/gu)).toHaveLength(569 2570 );571 })572 );573574 it.effect(575 "puts one strip of three steps above the list, each a command, with a control that dismisses it",576 () =>577 Effect.gen(function* () {578 const markup = yield* front({});
260 unmodified lines
modified:apps/web/test/markdown.test.tsx+14 added-4 removed
227 unmodified lines
228 '<input type="checkbox" disabled=""/>',229 ]);230 });231232 // A README sits under the project's own h1, so its levels go down by one.232 it("gives a heading an id a link can point at", () => {233 expect(rendered("## Hello World")).toContain('<h2 id="hello-world">');233 it("gives a heading an id a link can point at, a level under the page's h1", () => {234 expect(rendered("## Hello World")).toContain('<h3 id="hello-world">');235 });236237 it("draws no h1 of its own, and keeps an h6 an h6", () => {238 const markup = rendered("# burrow\n\n###### Small");239240 expect(markup).not.toContain("<h1");241 expect(markup).toContain('<h2 id="burrow">');242 expect(markup).toContain('<h6 id="small">');243 });244245 describe("a footnote", () => {246 const markup = rendered("Text[^1]\n\n[^1]: Note.");247248 const targetOf = (attribute: string) =>
90 unmodified lines
339 it("keeps lines to 70 characters", () => {340 expect(proseClasses().has("max-w-[70ch]")).toBeTruthy();341 });342343 // Its `#` is an h2 by then (`rehypeShiftHeadings`), under the page's own h1.334 it("sets its h1 at the title size, under the page's own headline", () => {335 expect(proseClasses().has("prose-h1:text-title")).toBeTruthy();344 it("sets its top heading at the title size, under the page's own headline", () => {345 expect(proseClasses().has("prose-h2:text-title")).toBeTruthy();346 });347348 it("sizes every element from the type scale, never an arbitrary size", () => {349 expect(
30 unmodified lines
modified:apps/web/test/settings.test.tsx+48 added
8 unmodified lines
9} from "../src/features/settings/appearance.tsx";10import { SettingsView } from "../src/features/settings/settings-page.tsx";11import {12 readPreference,13 resolveTheme,14 THEME_PREFERENCE_KEY,15 THEME_PREFERENCES,16 writePreference,17} from "../src/features/shared/theme.ts";18import type { Theme, ThemePreference } from "../src/features/shared/theme.ts";19import { attributeOf, textIn } from "./markup.ts";20import { renderAt } from "./render.tsx";21import { keptStorage, refusingStorage } from "./storage.ts";22import { themePage } from "./theme-page.ts";2324import styles from "../src/styles.css?raw";2526const ignore = () => {};2728/** Each choice as its label reads, and the radio it holds. */29const choicesIn = (markup: string) =>
9 unmodified lines
39 };40 }41 );4243/** The word the stylesheet draws after a choice's span on a system, before React can see it. */44const drawnBefore = (system: Theme, choice: ThemePreference) => {45 const css = styles.replaceAll(/\/\*[\s\S]*?\*\//gu, "");46 const selector = `:root[data-system="${system}"] [data-system-resolves="${choice}"]::after`;4748 return [49 ...css.matchAll(/(?<selectors>[^{}]+)\{\s*content: "(?<word>\w+)";\s*\}/gu),50 ].flatMap(({ groups }) =>51 groups?.selectors?.split(",").some((each) => each.trim() === selector) ===52 true53 ? [groups.word]54 : []55 );56};5758const appearanceAt = (system: Theme | undefined, preference: ThemePreference) =>59 renderAt(60 "/settings",61 <AppearanceView onChoose={ignore} preference={preference} system={system} />
35 unmodified lines
97 "Opposite of system",98 ]);99 })100 );101102 // The head script names the system before first paint, so the stylesheet103 // can show what each choice gives without waiting for React.104 it.effect(105 "marks each choice for the stylesheet until the system is known",106 () =>107 Effect.gen(function* () {108 const markup = yield* appearanceAt(undefined, "same");109110 expect(111 [...markup.matchAll(/data-system-resolves="(?<choice>\w+)"/gu)].map(112 ({ groups }) => groups?.choice113 )114 ).toStrictEqual([...THEME_PREFERENCES]);115 })116 );117118 it.each(["light", "dark"] as const)(119 "draws, before React runs, what each choice gives on a %s system",120 (system) => {121 expect(122 THEME_PREFERENCES.map((choice) => drawnBefore(system, choice))123 ).toStrictEqual(124 THEME_PREFERENCES.map((choice) => [125 resolveTheme(system, choice) === "dark" ? "Dark" : "Light",126 ])127 );128 }129 );130});131132describe(SettingsView, () => {133 it.effect(
147 unmodified lines
modified:apps/web/test/shared.test.tsx+2 added-2 removed
142 unmodified lines
143144const hangs = (command: string) =>145 [146 ...markupOf(<CommandLine command={command} />).matchAll(147 /padding-left:(?<hang>\d+)ch;text-indent:-\k<hang>ch/gu147 /class="tablet:pl-\(--hang\) tablet:-indent-\(--hang\) block" style="--hang:(?<hang>\d+)ch"/gu148 ),149 ].map((found) => Number(found.groups?.hang));150151describe(CommandLine, () => {
19 unmodified lines
171 // The words keep the command's own spaces between them.172 expect(textOf(<CommandLine command={command} />)).toContain(command);173 });174175 it("hangs a line 6ch, less when its longest word would not fit beside the hang", () => {175 it("hangs a line 6ch from tablet, less when its longest word would not fit beside the hang", () => {176 // `today` (5ch) beside a 6ch hang needs 11ch; the line is 9ch, so the177 // box hugging it would break the word in two. It never wraps, so its178 // hang never shows.179 expect(hangs(`${Brand.cli} today`)).toStrictEqual([4]);
77 unmodified lines
modified:apps/web/test/theme-page.ts+2 added
119 unmodified lines
120 for (const listener of stored) {121 listener({ key });122 }123 },124 /** The system's own scheme, as the head script names it. */125 system: () => root.system,126 theme: () => root.theme,127 /** The system turns the other way, as at sunset. */128 turnSystem: () => {129 scheme.matches = !scheme.matches;
7 unmodified lines
modified:apps/web/test/theme.test.ts+12 added
142 unmodified lines
143 expect(page.theme()).toBe("light");144 expect(page.shownColour()).toBe(themeColors.light);145 });146147 it("names the system's own scheme whatever the preference, as it turns", () => {148 const page = themePage("light");149150 runHeadScript(page, storedAs("opposite"));151152 expect(page.system()).toBe("light");153154 page.turnSystem();155156 expect(page.system()).toBe("dark");157 });158159 it("follows a preference another tab writes", () => {160 const page = themePage("light");161 const storage = storedAs("same");162
60 unmodified lines
modified:DESIGN.md+2 added-2 removed
430 unmodified lines
431### Project header and tabs432433- **Header:** the name (`owner / project`, the owner muted, both in the UI sans at Headline size), the posture (`PostureBadge`), the description (the README's first sentence), a facts row in UI type, muted (open asks, last landing, latest tag, licence if known, deciders), and three actions at the right: **Watch** (a popover: what already follows the project, this page and its events, plus `myr status --project` for your own claims and answers; the CLI has no watch command), **Clone** (a popover: the `git clone` URL, `myr claim <ask> --project`, and that forks come with a claim), **Contribute** (a popover: take an ask, propose an ask, read the policy). It never changes between tabs.434- **Tabs:** Overview · Code · Asks · Landings · Proposals · People · Policy · Visibility, each a text tab with its count in label type; the current one ink at 500 with a 2 px ink underline (the one current-tab style of the whole web), the rest muted. The header and tabs stick under the top bar together; on a phone the tabs scroll sideways inside their own strip.435- **Overview** (the default tab): open asks, recent landings and the README in the main column; the about column (`--column-about`) with clone, how a change lands (the seven stages), who decides, a visibility summary and languages.435- **Overview** (the default tab): open asks, recent landings and the README in the main column (its headings a level down, so the project's name stays the page's one h1); the about column (`--column-about`) with clone, how a change lands (the seven stages), who decides, a visibility summary and languages.436- **Code:** under the header, the code bar: a Files/Commits toggle, the ref switcher (`main`, tags, and answers in forks, ADR 0043), the HEAD commit, Go to file and Clone; then the file tree in `--column-tree` beside every page of the tab. The history of commits is the Code tab's; the Landings tab opens Overview's recent landings until it has a page of its own.437- **Visibility:** posture, layers, held-back checks, the environment (once "Env shape") and the ledger, one tab.438439### Cards
138 unmodified lines
578- **The control:** two radios in a fieldset, each a plain bordered row with the choice, then the theme it gives, muted, at the right. The server cannot see the system, so it names no theme until the page is up.579580### The platform's own pages581582Sign-in (with the MCP consent), sign-up, the Google handle page, the code, add-email and reset pages, the problem page and the platform's `/` load nothing (no script, no web font), so they carry the sage garden palette as hex literals in their inline style, copied from `apps/web/src/styles.css` for both schemes: paper, card, ink, surface, muted, rule, the 3:1 control border, primary with its on-primary text, refused only for a refusal, and waiting for the marked "Warning" line in the loopback case; `color-scheme: light dark`. Their faces are named as the web's are, IBM Plex Sans then the system sans at 16 px and IBM Plex Mono then the system mono, so Plex shows only where the reader has it installed. Every page but `/` is the focus shell: the wordmark as text from `@repo/brand` above one card with a hairline border and a 2 px radius, no edge accent, no navigation and no eyebrow, its h1 first. The consent names the client, its publisher when known, and the host that receives access; on sign-in and sign-up it also lists what the client may do as the person, and says it never sees the password. The platform's `/` keeps a plain document frame.582Sign-in (with the MCP consent), sign-up, the Google handle page, the code, add-email and reset pages, the problem page and the platform's `/` load nothing (no script, no web font), so they carry the sage garden palette as hex literals in their inline style, copied from `apps/web/src/styles.css` for both schemes: paper, card, ink, surface, muted, rule, the 3:1 control border, primary with its on-primary text, refused only for a refusal, and waiting for the marked "Warning" line in the loopback case; `color-scheme: light dark`. Their faces are named as the web's are, IBM Plex Sans then the system sans at 16 px and IBM Plex Mono then the system mono, so Plex shows only where the reader has it installed. This is the one place the type is not the web's, kept by design and awaiting the maintainer's sign-off: loading Plex would mean a `font-src` in the pages' policy and about 60 KB of font inlined in every page the Worker sends. Every page but `/` is the focus shell: the wordmark as text from `@repo/brand` above one card with a hairline border and a 2 px radius, no edge accent, no navigation and no eyebrow, its h1 first. The consent names the client, its publisher when known, and the host that receives access; on sign-in and sign-up it also lists what the client may do as the person, and says it never sees the password. The platform's `/` keeps a plain document frame.583584### shadcn585586shadcn 4.21.2, style `base-lyra` on Base UI, in `src/components/ui/` (generated, restyled to the tokens). The pages use its button, badge, table, textarea, tooltip, dialog and sheet, select, combobox, popover and skeleton. Overlays load after hydration in their own chunk.
33 unmodified lines