Skip to content
Myr

Merge build/1500-design-draws into main

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

# Conflicts: # apps/web/src/features/shared/shell/sections.ts # apps/web/test/front.test.tsx

authored by oscabriel · committed by oscabriel · parents 47dd2f8, 1031007 · Browse files · 32 files+998 added−263 removed
This commit

State

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

Diff stats

32 files+998 added−263 removed

  • tests:+531 added−20 removed
  • other:+467 added−243 removed

32 files+998 added−263 removed

modified:apps/web/src/components/ui/kbd.tsx+1 added-1 removed
modified:apps/web/src/features/answer/answer-page.tsx+151 added-29 removed
28 unmodified lines
29} from "@repo/protocol/domain/answer";30import type { Ask } from "@repo/protocol/domain/ask";31import type { LandingView } from "@repo/protocol/domain/landing";32import { Outcome } from "@repo/protocol/domain/outcome";33import type { AskId, CommitSha, Handle } from "@repo/protocol/ids";33import type { AskId, CommitSha, Handle, ProjectName } from "@repo/protocol/ids";34import { ChecksFailed } from "@repo/protocol/refusal";35import type { DateTime } from "effect";36import { ChevronDown, LockKeyhole } from "lucide-react";36import { ArrowRight, ChevronDown, LockKeyhole } from "lucide-react";37import { useState } from "react";38import type { ReactNode } from "react";3940import { Region } from "../ask/fields.tsx";41import { commitHref, shortSha } from "../code/paths.ts";42import type { AskProgress } from "../shared/ask-progress.ts";42import type { AskProgress, Round } from "../shared/ask-progress.ts";43import { CommandLine } from "../shared/command.tsx";44import { CreditTrailers } from "../shared/credits.tsx";44import { CompactCredit, CreditTrailers } from "../shared/credits.tsx";45import { EmptyState } from "../shared/empty.tsx";46import {47 ClaimFacts,48 CodeValue,49 FamilyFacts,50 ProvenanceFacts,50 RoundsFacts,51 shortValue,52 StateFacts,53 TerritoryFacts,54 verdictProvenance,55} from "../shared/facts.tsx";
1 unmodified line
57import { StateMarkIcon } from "../shared/marks.tsx";58import type { StateMark } from "../shared/marks.tsx";59import { OutcomeView, StageStrip } from "../shared/outcome.tsx";60import { answerPath, askPath } from "../shared/paths.ts";60import { MetaCode, MetaLine } from "../shared/row.tsx";61import { MetaCode, MetaLine, Row, RowList } from "../shared/row.tsx";62import type { Crumb } from "../shared/shell/sections.ts";63import { Workspace } from "../shared/shell/workspace.tsx";63import { StatusLine } from "../shared/status-line.tsx";64import { readStatus, StatusLine } from "../shared/status-line.tsx";65import type { StatusSubject } from "../shared/status-line.tsx";66import { distanceInWords, When } from "../shared/time.tsx";67import {68 deleteChildOf,
188 unmodified lines
257 className="mt-1 size-3.5 shrink-0"258 strokeWidth={1.75}259 />260 <span className="min-w-0">260 {area} {passed}/{total} @ {suite}261 {area} {passed}/{total} @{" "}262 <span title={suite}>{shortValue(suite)}</span>263 </span>264 </li>265 ))}266 </ul>
16 unmodified lines
283 {children}284 </div>285);286287/**288 * Every push the gate checked, newest first, the one the page reads289 * selected: first in main, once there is more than one, so a verdict is290 * read against its round.291 */292const RoundsRegion = ({293 ask,294 current,295 now,296 project,297 rounds,298}: {299 readonly ask: AskId;300 readonly project: ProjectName;301 readonly rounds: readonly Round[];302 /** The head the page shows. */303 readonly current: CommitSha | undefined;304 readonly now: DateTime.Utc;305}) => {306 // The page reads the last round at its head.307 const read =308 current === undefined309 ? 0310 : rounds.findLastIndex(({ head }) => head === current) + 1;311312 return (313 <Region id="answer-rounds" title="Rounds">314 <RowList label="Rounds">315 {rounds316 .map((round, index) => ({ number: index + 1, round }))317 .toReversed()318 .map(({ number, round: { at, head, outcome } }) => {319 const { lead, mark } = readStatus({ kind: "answer", outcome });320321 return (322 <Row323 href={answerPath(project, ask)}324 id={`${head}:${number}`}325 key={`${head}:${number}`}326 meta={<CodeValue value={head} />}327 search={{ head }}328 selected={number === read}329 size="one-line"330 state={{ mark, time: <When at={at} now={now} />, word: lead }}331 title={`Round ${number} of ${rounds.length}`}332 />333 );334 })}335 </RowList>336 </Region>337 );338};339340/**341 * What a waiting answer's contributor needs, from its rounds: there is342 * nothing to run, and what another push would start.343 */344const waitingSentence = (round: ReturnType<typeof roundOf>) =>345 round === undefined346 ? "Nothing for you to run."347 : `Nothing for you to run. Pushing again starts round ${round.of + 1}; this verdict stays as round ${round.number}.`;348349/** What the hero says before any answer was judged: who holds the ask, or how to take it. */350const NoAnswerYet = ({351 ask,352 now,
125 unmodified lines
478const Run = ({479 holds,480 landing,481 now,482 round,483 verdict,484}: {485 readonly holds: ReturnType<typeof holdsOf>;486 readonly landing: LandingView | undefined;487 readonly now: DateTime.Utc;488 /** Which round the verdict is, of how many. */489 readonly round: ReturnType<typeof roundOf>;490 readonly verdict: Verdict;491}) => (492 <>493 <Region id="answer-gate" title="Gate">
1 unmodified line
495 holds={holds}496 outcome={verdict.outcome}497 stage={verdict.stage}498 />499 {Outcome.isAnyOf([500 "AwaitingDecision",501 "AwaitingFinish",502 "WaitingOnParent",503 ])(verdict.outcome) ? (504 <p className="text-body max-w-[70ch]" data-waiting="">505 {waitingSentence(round)}506 </p>507 ) : null}508 <p className="text-ui text-muted-foreground">509 Checked on the tree it would land as: <Sha sha={verdict.head} /> merged510 onto main at{" "}511 <AppLink
25 unmodified lines
537 )}538539 {landing === undefined ? null : (540 <Region id="answer-landing" title="Landing">465 <CreditTrailers466 assisted={landing.assisted}467 credits={landing.credits}468 {...(landing.heldBackTrailer === undefined469 ? {}470 : { heldBack: landing.heldBackTrailer })}471 />472 <AppLink473 className="text-ui decoration-rule self-start font-medium underline hover:decoration-current"474 to={commitHref(landing.project, landing.sha)}475 >476 The landing commit477 </AppLink>541 {/* The landing told as a sentence before it is shown as a hash:542 the page's job is to credit the people. */}543 <p className="text-title flex min-w-0 flex-wrap items-baseline gap-x-2 font-normal">544 <span className="flex items-center gap-2 font-semibold">545 <StateMarkIcon mark="landed" />546 <span className="text-landed">Landed</span>547 </span>548 <span className="min-w-0 [overflow-wrap:anywhere]">549 {/* The space is the sentence's; the gap only draws it. */}550 {" as "}551 <AppLink552 className="decoration-rule underline hover:decoration-current"553 to={commitHref(landing.project, landing.sha)}554 >555 <code556 className="font-mono text-[length:inherit]"557 title={landing.sha}558 >559 {shortSha(landing.sha)}560 </code>561 </AppLink>562 {landing.credits.length === 0 ? null : (563 <>564 {" · "}565 <CompactCredit credits={landing.credits} within />566 </>567 )}568 {" · "}569 <span className="text-muted-foreground">570 <When at={landing.landedAt} now={now} />571 </span>572 </span>573 </p>574 {/* More room above Credit's head than under it. */}575 <div className="mt-3">576 <CreditTrailers577 assisted={landing.assisted}578 credits={landing.credits}579 label="title"580 {...(landing.heldBackTrailer === undefined581 ? {}582 : { heldBack: landing.heldBackTrailer })}583 />584 </div>585 <div className="flex min-w-0 flex-col gap-1.5">586 <span className="text-label text-muted-foreground">587 In a clone of {landing.project}588 </span>589 <CommandLine command={`git show ${landing.sha}`} />590 </div>591 <AppLink592 className="text-ui flex items-center gap-1.5 self-start font-medium no-underline hover:underline"593 to={commitHref(landing.project, landing.sha)}594 >595 The landing commit596 <ArrowRight597 aria-hidden="true"598 className="size-4"599 strokeWidth={1.75}600 />601 </AppLink>602 </Region>603 )}604605 {/* Below the shell's width the inspector's facts sit above the run, so
25 unmodified lines
631}632633const NONE: ReadonlyMap<AskId, AskProgress> = new Map();634517/** The answer's facts: its state, rounds, claim, family, territory and check, then what was judged. */635/** The answer's facts: its state, claim, family, territory and check, then what was judged. */636const AnswerFacts = ({637 ask,638 now,639 parent,
24 unmodified lines
664 <InspectorOnly>665 <StateFacts subject={subject} />666 </InspectorOnly>667 )}550 <RoundsFacts551 ask={ask.id}552 now={now}553 project={ask.project}554 rounds={roundsAsTheyStand(progress, verdict)}555 {...(verdict === undefined ? {} : { current: verdict.head })}556 />668 {landed ? null : (669 <ClaimFacts670 now={now}671 {...(progress?.claimant === undefined
80 unmodified lines
752 verdict,753 viewer,754}: AnswerViewProps) => {755 const progress = states.get(ask.id);756 const rounds = roundsAsTheyStand(progress, verdict);757758 const subject: StatusSubject | undefined =759 verdict === undefined760 ? undefined
62 unmodified lines
823 }824 said825 title={ask.brief.want}826 >827 {rounds.length > 1 ? (828 <RoundsRegion829 ask={ask.id}830 current={verdict?.head}831 now={now}832 project={ask.project}833 rounds={rounds}834 />835 ) : null}836 {verdict === undefined ? null : (837 <Run838 holds={holdsOf(verdict, landing, progress?.rounds ?? [])}839 landing={landing}840 now={now}841 round={roundOf(progress?.rounds ?? [], verdict.head)}842 verdict={verdict}843 />844 )}845 </Workspace>
2 unmodified lines
modified:apps/web/src/features/code/commit-view.tsx+17 added-2 removed
117 unmodified lines
118const GitLine = ({119 commit,120 now,121 project,122 stats,123}: {124 readonly commit: Commit;125 readonly now: DateTime.Utc;126 readonly project: ProjectName;127 readonly stats: DiffStats;128}) => (129 <span className="[overflow-wrap:anywhere]">130 authored by {commit.author.name} <When at={commit.author.at} now={now} />131 {" · "}
21 unmodified lines
153 {" · "}154 <AppLink className={LINK} to={treeHref(project, commit.sha)}>155 Browse files156 </AppLink>157 {" · "}158 <a159 className="inline-flex items-baseline gap-[1ch] no-underline hover:underline"160 href="#diff"161 >162 <span className="tabular-nums">163 {stats.files} {stats.files === 1 ? "file" : "files"}164 </span>165 <span aria-hidden="true">·</span>166 <ChangeCounts additions={stats.additions} deletions={stats.deletions} />167 </a>168 </span>169);170171const PART_WORDS = {
240 unmodified lines
412 facts={<CommitFacts commit={commit} project={project} stats={stats} />}413 factsHeading={414 commit.landing === undefined ? "This commit" : "This landing"415 }403 meta={<GitLine commit={commit} now={now} project={project} />}416 meta={417 <GitLine commit={commit} now={now} project={project} stats={stats} />418 }419 state={420 commit.landing === undefined ? undefined : (421 <span className="flex items-center gap-1.5">422 <StateMarkIcon mark="landed" />
39 unmodified lines
462 path, without their changes.463 </p>464 </div>465 ) : null}451 <DiffPane>466 <DiffPane id="diff">467 {drawing ?? (468 <div className={PANE_SCROLLER}>469 <PlainDiff470 drawn={drawn}
11 unmodified lines
modified:apps/web/src/features/code/diff-pane.tsx+9 added-1 removed
modified:apps/web/src/features/code/repo-tree.tsx+11 added-4 removed
46 unmodified lines
47}4849const NO_STATUS: readonly GitStatusEntry[] = [];5051/** The page's own row: its name set heavier than its neighbours'. */52const SELECTED_CSS =53 "[data-type='item'][aria-selected='true'] { font-weight: 600; color: var(--foreground); }";51/**52 * The page's own row: its name set heavier than its neighbours'. A53 * flattened row (`src / parse`) mutes the folders it passes through and54 * keeps its last name in ink, so the name reads first.55 */56const TREE_CSS = [57 "[data-type='item'][aria-selected='true'] { font-weight: 600; color: var(--foreground); }",58 "[data-item-flattened-subitems] { color: var(--muted); }",59 "[data-item-flattened-subitem]:last-child { color: var(--foreground); }",60].join("\n");6162/** A folder's id in the tree: its path and a slash. */63const folderId = (path: string) => `${path}/`;64
38 unmodified lines
103 search: false,104 stickyFolders: true,105 // The selected row's fill is faint on paper: its name in ink at 600106 // says it too.100 unsafeCSS: SELECTED_CSS,107 unsafeCSS: TREE_CSS,108 };109110 if (counts !== undefined) {111 options.renderRowDecoration = ({ item }) => {
103 unmodified lines
modified:apps/web/src/features/front/facts.tsx+13 added-18 removed
15 unmodified lines
16import type { AskId, ProjectName } from "@repo/protocol/ids";17import type { Posture } from "@repo/protocol/posture";18import { ArrowRight } from "lucide-react";1920import { postureLabel } from "../project/posture-label.ts";20import type { AskProgress } from "../shared/ask-progress.ts";21import { CommandLine } from "../shared/command.tsx";22import {23 FactBlock,
2 unmodified lines
26 TerritoryFacts,27} from "../shared/facts.tsx";28import { AppLink } from "../shared/link.tsx";29import { askPath, projectPath } from "../shared/paths.ts";31import { PostureBadge } from "../shared/posture.tsx";30import { MetaCode } from "../shared/row.tsx";31import { FactsSkeleton } from "../shared/skeleton.tsx";32import { StatusLine } from "../shared/status-line.tsx";33
56 unmodified lines
90/** A count and its noun: "1 open ask", "7 open asks". */91export const plural = (count: number, one: string, many: string) =>92 `${count} ${count === 1 ? one : many}`;9396/** Every project the platform lists, its posture and its open asks; bars until the list arrives. */94/**95 * Every project the platform lists, by its open asks; bars until the list96 * arrives. Each project's posture is its group header's to say, once.97 */98export const ProjectsFacts = ({99 projects,100}: {101 readonly projects: readonly ProjectListing[] | undefined;
4 unmodified lines
106 <FactBlock label="Projects">107 <ul className="flex flex-col">108 {projects.map((listing) => (109 <li109 className="flex min-h-11 min-w-0 flex-col justify-center gap-0.5 py-1"110 className="flex min-h-8 min-w-0 items-baseline justify-between gap-3 py-1"111 data-project={listing.project}112 key={listing.project}113 >113 <span className="flex min-w-0 items-baseline justify-between gap-3">114 <AppLink115 className="text-ui decoration-rule truncate font-semibold no-underline hover:underline"116 to={projectPath(listing.project)}117 >118 {listing.project}119 </AppLink>120 <span className="text-label text-muted-foreground shrink-0 tabular-nums">121 {plural(listing.openAsks, "open ask", "open asks")}114 <AppLink115 className="text-ui decoration-rule truncate font-semibold no-underline hover:underline"116 to={projectPath(listing.project)}117 >118 {listing.project}119 </AppLink>120 <span className="text-label text-muted-foreground shrink-0 tabular-nums">121 {plural(listing.openAsks, "open ask", "open asks")}122 </span>122 </span>124 <PostureBadge125 label={postureLabel(listing.posture)}126 posture={listing.posture}127 />123 </li>124 ))}125 </ul>126 </FactBlock>
130 unmodified lines
modified:apps/web/src/features/front/front-page.tsx+5 added
303 unmodified lines
304/** A project's group: its header (name, posture once, counts), then its rows. */305const ProjectGroup = ({306 group,307 listing,308 now,309 onSelect,310 parents,311 selected,312 stamps,313}: {314 readonly group: Group;315 readonly listing: ProjectListing | undefined;316 readonly now: DateTime.Utc;317 readonly parents: readonly Ask[];318 readonly selected: string | undefined;319 readonly onSelect: (id: string) => void;320 readonly stamps: ReadonlySet<AskId>;
4 unmodified lines
325 const row = (listingOf: FrontPageEntry["ask"], strip?: ReactNode) => (326 <AskRow327 key={listingOf.ask}328 listing={listingOf}329 now={now}330 onSelect={onSelect}331 progress={states.get(listingOf.ask)}332 project={project}333 selected={selected === listingOf.ask}
111 unmodified lines
445export const FrontPageView = ({446 entries,447 events,448 filter,449 now,450 parents,451 platformUrl,452 projects,453 selectedAsk,
87 unmodified lines
541 key={group.project}542 listing={projects?.find(543 ({ project }) => project === group.project544 )}545 now={now}546 onSelect={select}547 parents={parents}548 selected={selected}549 stamps={stampsOf?.(group.project) ?? new Set()}
7 unmodified lines
modified:apps/web/src/features/project/asks.tsx+4 added
4 unmodified lines
5 * sees how many of them landed and which wait.6 */7import type { Ask, AskListing } from "@repo/protocol/domain/ask";8import type { AskId, ProjectName } from "@repo/protocol/ids";9import type { DateTime } from "effect";10import type { ReactNode } from "react";1112import { arrange } from "../front/families.ts";13import type { AskProgress } from "../shared/ask-progress.ts";
24 unmodified lines
3839/** The project's asks, families as fans with their children listed. */40export const AskList = ({41 asks,42 now,43 onSelect,44 parents,45 project,46 selected,47 stamps,48 states,49}: {50 readonly asks: readonly AskListing[];51 readonly now: DateTime.Utc;52 readonly project: ProjectName;53 /** Each family's parent in full, which counts its children. */54 readonly parents: readonly Ask[];55 readonly states: ReadonlyMap<AskId, AskProgress>;
4 unmodified lines
60 const row = (listing: AskListing, strip?: ReactNode) => (61 <AskRow62 key={listing.ask}63 listing={listing}64 now={now}65 onSelect={onSelect}66 progress={states.get(listing.ask)}67 project={project}68 selected={selected === listing.ask}
47 unmodified lines
modified:apps/web/src/features/project/posture-label.ts+15 added
15 unmodified lines
16 sourceAvailable: "Source available",17} as const satisfies Record<Posture, string>;1819export const postureLabel = (posture: Posture): string => labels[posture];2021/**22 * A posture in its short form: the one the rail and a project's head both23 * say, so a project reads the same in both places (the platform's full24 * label is its title).25 */26const words = {27 open: "Open",28 openCore: "Open core",29 openOnSchedule: "Open on schedule",30 openWithSealedEvidence: "Sealed evidence",31 sourceAvailable: "Source available",32} as const satisfies Record<Posture, string>;3334export const postureWord = (posture: Posture): string => words[posture];
modified:apps/web/src/features/project/project-page.tsx+94 added-48 removed
13 unmodified lines
14import type { FileView, TreeListing } from "@repo/protocol/domain/code";15import type { Glob } from "@repo/protocol/domain/common";16import type { ProjectListing } from "@repo/protocol/domain/front-page";17import type { LandingView } from "@repo/protocol/domain/landing";18import { StageName } from "@repo/protocol/domain/outcome";19import type { ImportSource } from "@repo/protocol/domain/policy";20import { LedgerEntry } from "@repo/protocol/domain/visibility";21import type { Ledger } from "@repo/protocol/domain/visibility";22import type { AreaName, AskId, Handle, ProjectName } from "@repo/protocol/ids";
16 unmodified lines
39import type { AskProgress } from "../shared/ask-progress.ts";40import { LINK } from "../shared/classes.ts";41import { CommandLine } from "../shared/command.tsx";42import { EmptyState } from "../shared/empty.tsx";42import {43 FactBlock,44 GateFacts,45 HeldBackFacts,46 PostureFacts,47} from "../shared/facts.tsx";43import { FactBlock, GateFacts, HeldBackFacts } from "../shared/facts.tsx";44import { AppLink } from "../shared/link.tsx";45import { ledgerPath } from "../shared/paths.ts";46import { ReadingRows, UnreachableNotice } from "../shared/pending.tsx";47import { PostureBadge } from "../shared/posture.tsx";50import { MetaCode, useRowSelection } from "../shared/row.tsx";48import { MetaCode, MetaLine, useRowSelection } from "../shared/row.tsx";49import { Workspace } from "../shared/shell/workspace.tsx";52import { FactsSkeleton } from "../shared/skeleton.tsx";50import { When } from "../shared/time.tsx";51import { AskList, askListIds, openAsks, openToTake } from "./asks.tsx";52import { LandingList, recentShown } from "./landings.tsx";56import { postureLabel } from "./posture-label.ts";53import { postureLabel, postureWord } from "./posture-label.ts";54import { ProjectNav } from "./project-nav.tsx";55import { ReadmeSection } from "./readme-section.tsx";5657/** A project's code as its home reads it: the root folder at main, and its README. */
10 unmodified lines
6869/** One area a layer holds checks in, and how many. */70export interface HeldBackArea {71 readonly area: AreaName;72 /** How many sealed checks it holds. */73 readonly checks: number;74 readonly detail: string;75}7677/** An entry that says nothing about an area's count. */
25 unmodified lines
103 return [...checks]104 .toSorted(([a], [b]) => a.localeCompare(b))105 .map(([area, count]) => ({106 area,107 checks: count,108 detail: `${count} sealed ${count === 1 ? "check" : "checks"}`,109 }));110};111
197 unmodified lines
309310 return <FactBlock label="Recent landings">{shown}</FactBlock>;311};312313/** How a change lands here: the facts with nothing selected. */313/** How a change lands here: the facts with nothing selected; the posture is the head's to say. */314const HowItLands = ({315 deciders,316 heldBack,317 importedFrom,
1 unmodified line
319 landings,320 listing,321 now,322 platformUrl,323 posture,323}: Pick<324 ProjectViewProps,325 | "deciders"326 | "heldBack"
2 unmodified lines
329 | "listing"330 | "now"331 | "platformUrl"332> & {334 readonly posture: KnownPosture | undefined;333 readonly landedAt: DateTime.Utc | undefined;334}) => (335 <>338 {posture === undefined ? (339 <FactsSkeleton labels={["Posture"]} />340 ) : (341 <PostureFacts342 label={posture.label}343 posture={posture.posture}344 project={listing.project}345 />346 )}336 <GateFacts />337 <WhoDecides deciders={deciders} project={listing.project} />338 {heldBack === undefined ? null : <HeldBackFacts areas={heldBack} />}339 {importedFrom === undefined ? null : <ImportedFrom source={importedFrom} />}
8 unmodified lines
348 <ForAgents href={`/${listing.project}/llms.txt`} />349 </>350);351363/** The project line: its posture, its open asks, when it last landed; then its README's first sentence. */352/**353 * How a change lands here, in one sentence built only from typed facts:354 * the gate, the paths deciders are set for, what is held back (the ledger355 * linked from it), and when it last landed. The one place the project's356 * own pages state it; the inspector carries the same as facts.357 */358const RuleSentence = ({359 deciders,360 heldBack,361 landedAt,362 now,363 project,364}: {365 readonly deciders: readonly Deciders[] | undefined;366 readonly heldBack: readonly HeldBackArea[] | undefined;367 readonly landedAt: DateTime.Utc | undefined;368 readonly now: DateTime.Utc;369 readonly project: ProjectName;370}) => {371 const checks = (heldBack ?? []).reduce((sum, area) => sum + area.checks, 0);372373 const sealed =374 heldBack === undefined ? undefined : (375 <AppLink className={LINK} key="ledger" to={ledgerPath(project)}>376 {heldBack.length === 0377 ? "nothing held back"378 : `${plural(checks, "sealed check", "sealed checks")} in ${plural(heldBack.length, "area", "areas")}`}379 </AppLink>380 );381382 const parts = [383 `Gate: ${plural(StageName.literals.length, "stage", "stages")}`,384 deciders === undefined || deciders.length === 0385 ? undefined386 : `deciders set for ${plural(deciders.length, "path", "paths")}`,387 sealed,388 landedAt === undefined ? (389 "nothing landed yet"390 ) : (391 <span key="landed">392 last landed <When at={landedAt} now={now} />393 </span>394 ),395 ];396397 return (398 <p className="text-ui text-muted-foreground max-w-[70ch]" data-rule="">399 <MetaLine parts={parts} />400 </p>401 );402};403404/** The project line: its posture and its open asks; its README's first sentence; then its one rule sentence. */405const ProjectLine = ({406 count,366 landedAt,407 lede,368 now,408 posture,409 rule,410}: {411 readonly count: number;412 readonly posture: KnownPosture | undefined;373 readonly landedAt: DateTime.Utc | undefined;413 readonly lede: string | undefined;375 readonly now: DateTime.Utc;414 readonly rule: ReactNode;415}) => (416 <div className="flex flex-col gap-3">417 <p className="text-ui text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1">379 {/* Each part keeps its dot after it, so a line never opens on one; on380 a phone the posture has a line of its own. */}418 {/* The posture in the short form the rail says, the platform's own419 label its title; its dot after it, so a line never opens on one. */}420 {posture === undefined ? null : (382 <span className="max-tablet:basis-full flex items-center gap-x-2">383 <PostureBadge label={posture.label} posture={posture.posture} />384 <span aria-hidden="true" className="max-tablet:hidden">385 ·386 </span>421 <span className="flex items-center gap-x-2">422 <PostureBadge423 label={postureWord(posture.posture)}424 posture={posture.posture}425 title={posture.label}426 />427 <span aria-hidden="true">·</span>428 </span>429 )}389 <span className="inline-flex gap-x-2 tabular-nums">430 <span className="tabular-nums">431 {plural(count, "open ask", "open asks")}391 <span aria-hidden="true">·</span>432 </span>393 <span>394 {landedAt === undefined ? (395 "nothing landed yet"396 ) : (397 <>398 last landed <When at={landedAt} now={now} />399 </>400 )}401 </span>433 </p>434 {lede === undefined ? null : (435 <p className="text-want max-w-[70ch]">{lede}</p>436 )}437 {rule}438 </div>439);440441/** The asks' place on the page, as far as they have been read. */442const AsksSection = ({443 asks,444 now,445 onSelect,446 parents,447 project,448 selected,
2 unmodified lines
451 states,452 unreachable,453}: {454 readonly asks: readonly AskListing[] | undefined;455 readonly now: DateTime.Utc;456 readonly unreachable: boolean;457 readonly project: ProjectName;458 readonly parents: readonly Ask[];459 readonly states: ReadonlyMap<AskId, AskProgress>;
16 unmodified lines
476 } else {477 list = (478 <AskList479 asks={asks}480 now={now}481 onSelect={onSelect}482 parents={parents}483 project={project}484 selected={selected}
45 unmodified lines
530 landings={props.landings}531 listing={listing}532 now={props.now}533 platformUrl={platformUrl}499 posture={posture}534 />535 );536 }537
77 unmodified lines
615 {...Option.match(Option.fromUndefinedOr(selected), {616 onNone: () => ({}),617 onSome: (factsKey) => ({ factsKey }),618 })}585 factsSummary={posture?.label ?? "Posture, gate, who decides, take part"}619 factsSummary={620 posture === undefined621 ? "Gate, who decides, take part"622 : postureWord(posture.posture)623 }624 status={625 <ProjectLine626 count={Option.match(open, {627 onNone: () => listing.openAsks,628 onSome: (each) => each.length,629 })}592 landedAt={landedAt}630 lede={Predicate.isString(text) ? ledeOf(text) : undefined}594 now={props.now}631 posture={posture}632 rule={633 <RuleSentence634 deciders={props.deciders}635 heldBack={props.heldBack}636 landedAt={landedAt}637 now={props.now}638 project={project}639 />640 }641 />642 }643 title={project}644 variant="list"645 >646 <ProjectNav current="overview" project={project} />647 <AsksSection648 asks={asks}649 now={props.now}650 onSelect={select}651 parents={props.parents ?? []}652 project={project}653 selected={selected}
38 unmodified lines
modified:apps/web/src/features/shared/shell/rail.tsx+4 added-4 removed
33 unmodified lines
3435import { Button } from "../../../components/ui/button.tsx";36import { Skeleton } from "../../../components/ui/skeleton.tsx";37import { SessionSlot } from "../../auth/session-slot.tsx";38import { postureLabel } from "../../project/posture-label.ts";38import { postureLabel, postureWord } from "../../project/posture-label.ts";39import { AppLink } from "../link.tsx";40import { POSTURE_MARKS } from "../mark-look.ts";41import { ASKS_PATH, docsPath, HOME_PATH } from "../paths.ts";42import {
2 unmodified lines
45 useShell,46 useTodayCount,47} from "./context.ts";48import { RailSlotOutlet, useRailContent } from "./rail-slot.tsx";49import { POSTURE_WORD, projectSections, sectionOf } from "./sections.ts";49import { projectSections, sectionOf } from "./sections.ts";5051/** A row of the rail, before the fill that marks the current one. */52const RAIL_BASE =53 "text-ui text-foreground hover:bg-surface flex h-8 min-w-0 items-center gap-2.5 px-2 no-underline transition-colors duration-[120ms] focus-visible:outline-offset-[-2px] [&[aria-current]]:font-semibold [&[aria-current]>svg]:text-foreground";
68 unmodified lines
122 ))}123 </ul>124);125126/** A project's posture at its row's end: the mark in its role, a short word muted, the full label as its title. */126/** A project's posture at its row's end: the mark in its role, its short form muted (the head's), the full label as its title. */127export const PostureMark = ({ posture }: { readonly posture: Posture }) => {128 const { icon: Icon, tone } = POSTURE_MARKS[posture];129130 return (
6 unmodified lines
137 aria-hidden="true"138 className={`size-3.5 ${tone}`}139 strokeWidth={1.75}140 />141 {POSTURE_WORD[posture]}141 {postureWord(posture)}142 <span className="sr-only">: {postureLabel(posture)}</span>143 </span>144 );145};
273 unmodified lines
modified:apps/web/src/features/shared/shell/sections.ts-10 removed
3 unmodified lines
4 * the bottom bar, the section row and the context bar all read them here,5 * so one address names one place everywhere.6 */7import { projectAddressOf } from "@repo/protocol/ids";8import type { Posture } from "@repo/protocol/posture";8import { Option } from "effect";910import { segmentsOf } from "../paths.ts";11
230 unmodified lines
242 { label: rest.at(-1) ?? third ?? page ?? project },243 ]244 : projectCrumbs(project, tab, false);245};247248/** A posture in one short word for the rail, beside its mark; the full label is its title. */249export const POSTURE_WORD = {250 open: "Open",251 openCore: "Core",252 openOnSchedule: "Scheduled",253 openWithSealedEvidence: "Sealed",254 sourceAvailable: "Source",255} as const satisfies Record<Posture, string>;
modified:apps/web/src/features/shared/shell/workspace.tsx+5 added-2 removed
19 unmodified lines
20import { Suspense, useState } from "react";21import type { ReactNode } from "react";2223import { Button } from "../../../components/ui/button.tsx";24import { InspectorCommands } from "../command.tsx";25import { CommandSlotProvider } from "../keys.tsx";26import { ContextBar } from "./context-bar.tsx";27import { LazyFactsSheet } from "./lazy-overlays.ts";28import { crumbsFor } from "./sections.ts";
259 unmodified lines
288 </main>289 {hasFacts ? (290 <aside291 aria-label="Facts"291 className={`border-rule bg-background h-dvh w-[19rem] shrink-0 flex-col overflow-y-auto overscroll-contain border-l ${292 className={`border-rule bg-background codefacts:w-[22rem] h-dvh w-[20rem] shrink-0 flex-col overflow-y-auto overscroll-contain border-l ${293 code ? "codefacts:flex hidden" : "shell:flex hidden"294 }`}295 data-facts="inspector"296 id="facts"297 >298 <CommandSlotProvider slot="facts">299 <FactsHeading heading={factsHeading} />300 <div className="flex flex-col px-4 py-4">301 <InspectorCommands>300 <Settling id={factsKey}>{facts}</Settling>302 <Settling id={factsKey}>{facts}</Settling>303 </InspectorCommands>304 </div>305 </CommandSlotProvider>306 </aside>307 ) : null}
22 unmodified lines
modified:apps/web/src/features/shared/ask-progress.ts+4 added-2 removed
36 unmodified lines
37 * lapse starts the ask over, so an earlier answerer's refusal no longer38 * speaks for it (its round stays in `rounds`).39 */40 readonly latest?: Outcome;41 /** When it was opened, once the events say so. */42 readonly opened?: DateTime.Utc;43 /** Every answer checked, oldest first. */44 readonly rounds: readonly Round[];45}46
58 unmodified lines
105 ...unclaimed(progress),106 landed: { seq, sha: landing },107 }));108 },107 AskOpened: ({ ask }) => {108 change(ask.ask, identity);109 AskOpened: ({ ask, at }) => {110 change(ask.ask, (progress) => ({ ...progress, opened: at }));111 },112 Claimed: ({ ask, claimant }) => {113 change(ask, (progress) => ({ ...startedOver(progress), claimant }));114 },
139 unmodified lines
modified:apps/web/src/features/shared/command.tsx+42 added-10 removed
4 unmodified lines
5// A page marks its main commands `numbered`: while the single keys are on,6// each shows its number before the `$`, and that number key copies it7// ("Copy (1)" in the button's title).8import { Check, Copy } from "lucide-react";9import { createContext, useContext } from "react";10import type { ReactNode } from "react";1112import { Button } from "../../components/ui/button.tsx";13import { useCopy } from "./copy-action.tsx";14import { useNumberedCommand } from "./keys.tsx";1514/** How far a line of the command hangs, in ch, when the column breaks it. */15const HANG = 6;16/**17 * Where a command line is drawn: a box hugging its command in main, or18 * the inspector's bleed form, pane-wide between two hairlines, where the19 * column is narrow and every character of the line counts.20 */21type Form = "bleed" | "box";2223const FormContext = createContext<Form>("box");2425/** Command lines under it take the inspector's bleed form. */26export const InspectorCommands = ({27 children,28}: {29 readonly children: ReactNode;30}) => <FormContext value="bleed">{children}</FormContext>;3132/** How far a line of the command hangs, in ch, when the column breaks it: less in the inspector's narrow column. */33const HANGS = { bleed: 2, box: 6 } as const satisfies Record<Form, number>;3435/** The box around the command, in each form. */36const BOXES = {37 bleed:38 "border-rule bg-surface text-mono leading-terminal -mx-4 flex min-w-0 items-start gap-2 border-y py-1 pr-1 pl-4 font-mono",39 box: "border-rule bg-surface text-mono leading-terminal flex w-fit max-w-full min-w-0 items-start gap-2 border py-1 pr-1 pl-3 font-mono",40} as const satisfies Record<Form, string>;4142/**18 * A line's hang: 6ch, or less on a line so short that its longest word43 * A line's hang: `hang` ch, or less on a line so short that its longest word44 * would not fit beside the hang. The box hugs its longest line, so a line's45 * room beside its hang is its own length less the hang; a word wider than46 * that room is broken in two (`<cli> today` read "tod" / "<cli> ay"). Such a47 * line fits whole wherever its box does, so its hang never shows.48 */24const hangOf = (words: readonly string[], line: string) =>49const hangOf = (hang: number, words: readonly string[], line: string) =>50 Math.min(26 HANG,51 hang,52 line.length - Math.max(0, ...words.map(({ length }) => length))53 );5455// The command's words, each kept whole on its line: a narrow column breaks
1 unmodified line
57// (`lint-heading-levels`, `--project`) nor before a closing ` \`; a word58// longer than the line (a URL) still breaks, anywhere. Each of the59// command's own lines hangs, so a line the column breaks reads as one line60// going on. The text is the command's, space for space.36const wordsOf = (command: string) =>61const wordsOf = (command: string, form: Form) =>62 command.split("\n").map((line, at, lines) => {63 const parts = line.split(/(?<space>\s+)(?!\\$)/u);6465 const hang = hangOf(66 HANGS[form],67 parts.filter((part) => part.trim() !== ""),68 line69 );70
28 unmodified lines
99 readonly command: string;100 readonly number: number | undefined;101}) => {102 const { copied, copy } = useCopy(command);103 const form = useContext(FormContext);104 const bleed = form === "bleed";105106 return (79 <div className="border-rule bg-surface text-mono leading-terminal flex w-fit max-w-full min-w-0 items-start gap-2 border py-1 pr-1 pl-3 font-mono">107 <div className={BOXES[form]} data-form={form}>108 {number === undefined ? null : (109 <span110 aria-hidden="true"111 className="text-muted-foreground font-sans tabular-nums select-none"
4 unmodified lines
116 <span aria-hidden="true" className="text-muted-foreground select-none">117 $118 </span>119 <code className="min-w-0 flex-1 py-0.5 whitespace-pre-wrap select-all">92 {wordsOf(command)}120 {wordsOf(command, form)}121 </code>122 <Button123 className="shrink-0 font-sans"124 onClick={copy}97 size="sm"125 size={bleed ? "icon-sm" : "sm"}126 title={number === undefined ? undefined : `Copy (${number})`}127 type="button"128 variant="ghost"129 >130 {copied ? <Check aria-hidden="true" /> : <Copy aria-hidden="true" />}103 <span className="sr-only sm:not-sr-only @max-xs:sr-only">131 <span132 className={133 bleed ? "sr-only" : "sr-only sm:not-sr-only @max-xs:sr-only"134 }135 >136 {copied ? "Copied" : "Copy"}137 </span>138 </Button>139 </div>
20 unmodified lines
modified:apps/web/src/features/shared/credits.tsx+10 added-2 removed
33 unmodified lines
34export const CreditTrailers = ({35 assisted,36 credits,37 heldBack,38 label = "fact",39}: {40 readonly assisted: readonly AgentTrailer[];41 readonly credits: readonly Credit[];42 readonly heldBack?: string;43 /** "Credit" as a fact's label, or at Title weight, a region's own head (the Landed page). */44 readonly label?: "fact" | "title";45}) => (46 <div className="flex flex-col gap-4">47 {credits.length === 0 ? null : (48 <section className="flex flex-col gap-1.5">46 <h3 className={LABEL}>Credit</h3>49 <h3 className={label === "title" ? "text-title" : LABEL}>Credit</h3>50 <ul className={LINES}>51 {inTrailerOrder(credits).map(({ handle, role }) => (52 <li className="[overflow-wrap:anywhere]" key={`${role}:${handle}`}>53 <span className="text-muted-foreground">{role}:</span>{" "}
61 unmodified lines
115116/** A landing's credit in one line: each role once, in trailer order, its people linked. */117export const CompactCredit = ({118 credits,119 within = false,120}: {121 readonly credits: readonly Credit[];122 /** Inside a sentence, after a ` · `: its first word stays lower case. */123 readonly within?: boolean;124}) => {125 const roles = CreditRole.literals.flatMap((role) => {126 const people = credits.filter((credit) => credit.role === role);127
3 unmodified lines
131 return roles.length === 0 ? null : (132 <span className="min-w-0">133 {roles.map(({ people, role }, index) => (134 <Fragment key={role}>129 {index === 0 ? raised(roleWords[role]) : ` · ${roleWords[role]}`}{" "}135 {index === 0 && !within136 ? raised(roleWords[role])137 : `${index === 0 ? "" : " · "}${roleWords[role]}`}{" "}138 <Joined people={people} />139 </Fragment>140 ))}141 </span>
2 unmodified lines
modified:apps/web/src/features/shared/facts.tsx+15 added-63 removed
4 unmodified lines
5 * (`7fbe4b2`, `sha256:7fbe4b…`), its whole value in its title and on copy.6 * Blocks never repeat the page's prose: they hold the facts it refers to.7 *8 * The blocks every page shares are here (State, Take it, Claim, Gate,9 * Posture, Held back, Family, Territory and check, Rounds, Credit,9 * Posture, Held back, Family, Territory and check, Credit,10 * Provenance); a block only one page has is that page's own.11 */12import { Brand } from "@repo/brand";13import type { Verdict } from "@repo/protocol/domain/answer";
2 unmodified lines
16import type { AgentTrailer, Credit } from "@repo/protocol/domain/credit";17import type { LandingView } from "@repo/protocol/domain/landing";18import { StageName } from "@repo/protocol/domain/outcome";19import type { Outcome } from "@repo/protocol/domain/outcome";20import type {21 AreaName,22 AskId,23 CommitSha,24 Handle,25 ProjectName,26} from "@repo/protocol/ids";20import type { AreaName, Handle, ProjectName } from "@repo/protocol/ids";21import type { Posture } from "@repo/protocol/posture";22import { DateTime, Match } from "effect";23import { ChevronDown, LockKeyhole } from "lucide-react";24import { useState } from "react";25import type { ReactNode } from "react";2627import { blobHref, shortSha, treeHref } from "../code/paths.ts";34import type { AskProgress, Round } from "./ask-progress.ts";28import type { AskProgress } from "./ask-progress.ts";29import { CommandLine } from "./command.tsx";30import { CopyAction } from "./copy-action.tsx";31import { CreditTrailers } from "./credits.tsx";32import { FamilyTree } from "./family.tsx";
2 unmodified lines
35import { StateMarkIcon } from "./marks.tsx";36import type { StateMark } from "./marks.tsx";37import { stageStates } from "./outcome.tsx";38import type { StageHolds, StageState } from "./outcome.tsx";45import { answerPath, ledgerPath } from "./paths.ts";39import { ledgerPath } from "./paths.ts";40import { PostureBadge } from "./posture.tsx";47import { MetaCode, Row } from "./row.tsx";41import { MetaCode } from "./row.tsx";42import { StatusLine, readStatus, stageNames } from "./status-line.tsx";43import type { StatusSubject } from "./status-line.tsx";44import { When } from "./time.tsx";45
472 unmodified lines
518 <CheckLine ask={ask} />519 </FactBlock>520);521528/** An outcome's mark and word in a round's row. */529const roundState = (outcome: Outcome) =>530 readStatus({ kind: "answer", outcome });531532/** Every answer to an ask, one row each, oldest first; the one on the page marked. */533export const RoundsFacts = ({534 ask,535 current,536 now,537 project,538 rounds,539}: {540 readonly ask: AskId;541 readonly project: ProjectName;542 readonly rounds: readonly Round[];543 /** The head the page shows. */544 readonly current?: CommitSha;545 readonly now: DateTime.Utc;546}) => (547 <FactBlock label="Rounds">548 {rounds.length === 0 ? (549 <p className="text-ui text-muted-foreground">No answer checked yet.</p>550 ) : (551 <ul className="flex flex-col">552 {rounds.map(({ at, head, outcome }, index) => {553 const { lead, mark } = roundState(outcome);554555 return (556 <Row557 href={answerPath(project, ask)}558 id={head}559 key={`${head}:${DateTime.formatIso(at)}`}560 meta={<CodeValue value={head} />}561 search={{ head }}562 selected={head === current}563 size="one-line"564 state={{ mark, time: <When at={at} now={now} />, word: lead }}565 title={`Round ${index + 1}`}566 />567 );568 })}569 </ul>570 )}571 </FactBlock>572);573522/** A landing's credit as the commit carries it, the agents apart. */523export const CreditFacts = (props: {524 readonly assisted: readonly AgentTrailer[];525 readonly credits: readonly Credit[];
80 unmodified lines
606 className={`size-3.5 transition-transform duration-150 ${open ? "rotate-180" : ""}`}607 strokeWidth={1.75}608 />609 </button>662 <dl className={`${open ? "flex" : "shell:flex hidden"} flex-col`}>610 <dl className={`${open ? "flex" : "shell:flex hidden"} flex-col gap-1.5`}>611 {entries.map(({ label, shown, value }) => (664 <div className="flex min-h-8 min-w-0 items-center gap-3" key={label}>665 <dt className="text-label text-muted-foreground w-24 shrink-0">666 {label}667 </dt>668 <dd className="text-ui flex min-w-0 flex-1 items-center gap-3">612 // A label over its value, as every block is: never a key and613 // value grid.614 <div615 className="flex min-w-0 flex-col"616 data-provenance={label}617 key={label}618 >619 <dt className="text-label text-muted-foreground">{label}</dt>620 <dd className="text-ui flex min-h-8 min-w-0 items-center gap-3">621 <span className="min-w-0 flex-1 truncate">622 {shown ?? <CodeValue value={value} />}623 </span>624 {shown === undefined ? (
13 unmodified lines
modified:apps/web/src/features/shared/keys.tsx+1 added-3 removed
156 unmodified lines
157 <span className="text-muted-foreground" key={key}>158 to159 </span>160 ) : (161 <Kbd className="font-mono" key={key}>162 {key}163 </Kbd>161 <Kbd key={key}>{key}</Kbd>162 )163 )}164 </dt>165 <dd>{does}</dd>
449 unmodified lines
modified:apps/web/src/features/shared/posture.tsx+8 added-1 removed
20 unmodified lines
2122export const PostureBadge = ({23 label,24 posture,25 title,26}: {27 readonly label: string;28 readonly posture: Posture;29 /** The platform's full label, when the badge says a short form. */30 readonly title?: string | undefined;31}) => (32 <StateBadge33 className="text-ui items-start [&>svg]:mt-0.5"34 mark={POSTURE_MARKS[posture]}32 word={<span data-posture={posture}>{label}</span>}35 word={36 <span data-posture={posture} title={title}>37 {label}38 </span>39 }40 wordTone={wordTone[posture]}41 />42);
modified:apps/web/src/features/shared/row.tsx+55 added-33 removed
8 unmodified lines
9 * - Line 1 is the thing in its own words, one line, ellipsised, the whole10 * text its `title`; it is the link, never the id.11 * - Line 2 is metadata, parted by ` · `; a value that means nothing (the12 * whole repo's territory, ".") is left out (`MetaLine`).13 * - The state's mark sits in its own column and its word at the right, in14 * its role; the mark is hidden from screen readers, the word is not.13 * - The state's mark sits in its own column, in its role's colour, and its14 * word at the right in ink (Refused and Landed keep theirs: DESIGN.md's15 * Mark Carries Rule); the mark is hidden from screen readers, the word16 * is not.17 * - A row with a command has one copy action, the command as text inside it.18 *19 * From the shell's width a click anywhere off the link selects the row20 * (its facts fill the inspector); below it the whole row is the link's to
3 unmodified lines
24import type { AskListing } from "@repo/protocol/domain/ask";25import type { ClaimState } from "@repo/protocol/domain/claim";26import { Outcome } from "@repo/protocol/domain/outcome";27import type { ProjectName } from "@repo/protocol/ids";28import type { DateTime } from "effect";29import type { MouseEvent, ReactNode } from "react";30import { Fragment } from "react";3132import type { AskProgress } from "./ask-progress.ts";
4 unmodified lines
37import type { StateMark } from "./marks.tsx";38import { askPath } from "./paths.ts";39import { useSelection } from "./shell/selection.ts";40import type { SelectionParam } from "./shell/selection.ts";41import { When } from "./time.tsx";4243/** A row's state: its mark, its word, and when (a `When`, or words). */44export interface RowState {45 readonly mark: StateMark;
38 unmodified lines
84/** The shell's width, from which a row selects rather than opens. */85const SHELL_WIDTH = "(min-width: 70rem)";8687/**84 * The word's colour: the state's role; ink for open and claimed, which have85 * none. A refusal that can be retried keeps its ochre mark, but its word is86 * a refusal's, as the status line says it.88 * The word's colour (DESIGN.md's Mark Carries Rule): ink, its role's colour89 * left to the mark, so a list of waiting asks is not an ochre stripe; a90 * refusal keeps red and a landing green. A refusal that can be retried91 * keeps its ochre mark, but its word is a refusal's, as the status line92 * says it.93 */88const wordTone = (mark: StateMark) => {89 if (mark === "open" || mark === "claimed") {90 return "text-foreground";94export const wordTone = (mark: StateMark) => {95 if (mark === "refused" || mark === "retry") {96 return STATE_MARKS.refused.tone;97 }9893 return mark === "retry" ? "text-refused" : STATE_MARKS[mark].tone;99 return mark === "landed" ? STATE_MARKS.landed.tone : "text-foreground";100};101102/** Whether a press on `target` was meant for a link or a control in the row. */103const onControl = (target: EventTarget) =>
118 unmodified lines
222223 // `isolate` keeps the row's raised controls (its copy button, a fan's224 // nodes) inside the row, so a sticky header passes over them.225 const rowClass = `group/row border-rule relative isolate -mx-2 border-b px-2 transition-colors duration-[120ms] ${220 selected ? "bg-surface" : "hover:bg-surface/50"226 selected ? "bg-surface hover:bg-surface-2" : "hover:bg-surface/50"227 }`;228229 return (230 // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- selecting by a click off the link is the pointer's twin of j and k
22 unmodified lines
253 <span className="flex h-6 w-5 shrink-0 items-center justify-center">254 {mark}255 </span>256 <div className="flex min-w-0 flex-1 flex-col">251 <p className={`text-want truncate ${weight} ${face}`}>{link}</p>257 {/* Below a tablet the want, the one line that says what done258 means, may take two lines. */}259 <p260 className={`text-want tablet:line-clamp-1 line-clamp-2 break-words ${weight} ${face}`}261 >262 {link}263 </p>264 {meta === undefined && state === undefined ? null : (265 <p className="text-ui text-muted-foreground truncate leading-5">266 {state === undefined ? null : (267 // On a phone the want takes the width; its state leads line 2.
127 unmodified lines
395 released: { mark: "notNeeded", word: "Given up" },396 warned: { mark: "waiting", word: "Warned, no push lately" },397} as const satisfies Record<ClaimState, RowState>;398399/** Who an ask is held for, as its state word. */400const reserveWords = {401 newcomers: "Held for newcomers",402 people: "Held for people",403} as const;404405/** Where an open ask stands for its reader, as a row's state. */406const askState = (407 listing: AskListing,408 takeable: boolean | undefined,
14 unmodified lines
423 if (listing.blockedBy.length > 0) {424 return { mark: "waiting", word: "Waiting" };425 }426409 if (takeable === false) {410 return { mark: "notYet", word: "Not open to you" };427 // An ask held for someone says so wherever it is listed and whoever428 // reads it, before whether this reader may take it.429 if (listing.reserve !== undefined) {430 return { mark: "open", word: reserveWords[listing.reserve] };431 }432413 if (takeable === undefined && listing.reserve !== undefined) {414 return {415 mark: "open",416 word:417 listing.reserve === "newcomers"418 ? "Held for newcomers"419 : "Held for people",420 };421 }422423 return { mark: "open", word: "Open to take" };433 return takeable === false434 ? { mark: "notYet", word: "Not open to you" }435 : { mark: "open", word: "Open to take" };436};437426/** Who an ask is held for, in a row's metadata. */427const reserveWords = {428 newcomers: "held for newcomers",429 people: "held for people, not agents",430} as const;438/**439 * The time an ask row shows: its last push, else its last round, else its440 * opening, so a list scans by recency.441 */442const askTime = (progress: AskProgress | undefined) =>443 progress?.lastPush?.at ?? progress?.rounds.at(-1)?.at ?? progress?.opened;444445/**446 * An open ask as a row: its want, its kind, territory and id, where it447 * stands (from the listing, and the event fold when the page has it), and448 * the claim command when the reader may take it.449 */450export const AskRow = ({451 listing,452 now,453 onSelect,454 progress,455 project,456 selected,
12 unmodified lines
469 /** Name the project in the metadata: a list across projects with no groups. */470 readonly showProject?: boolean;471 /** A family's fan, when the ask is a parent. */472 readonly strip?: ReactNode;473 /** The page's now, which the row's time is told against. */474 readonly now?: DateTime.Utc | undefined;475}) => {476 const at = askTime(progress);460 const state = askState(listing, takeable, progress);477 const standing = askState(listing, takeable, progress);478479 const state =480 at === undefined || now === undefined481 ? standing482 : { ...standing, time: <When at={at} now={now} /> };483484 const claimant = progress?.claimant;485 const rounds = progress?.rounds.length ?? 0;486 const open = state.mark === "open";487488 return (489 <Row
16 unmodified lines
506 listing.kind,507 territoryPart(listing.territory),508 <MetaCode key="id">{listing.ask}</MetaCode>,509 claimant === undefined ? undefined : `claimed by ${claimant}`,486 listing.reserve === undefined || takeable === undefined487 ? undefined488 : reserveWords[listing.reserve],510 rounds === 0 ? undefined : `round ${rounds}`,511 ]}512 />513 }514 onSelect={onSelect}
7 unmodified lines
modified:apps/web/test/answer.test.tsx+78 added-3 removed
303 unmodified lines
304 );305 }306 });307308 it("shows held-back checks only as an area's counts and its suite root", () => {308 it("shows held-back checks only as an area's counts and its suite root, shortened, the whole root in its title", () => {309 const bits =310 /<ul aria-label="Held-back checks by area"[^>]*>(?<inner>.*?)<\/ul>/su.exec(311 markupOf(refusedPage)312 )?.groups?.inner;313314 expect(plainText(bits ?? "").trim()).toBe(`export 6/7 @ ${suite}`);314 expect(plainText(bits ?? "").trim()).toBe("export 6/7 @ sha256:4f2a4f…");315 expect(bits).toContain(`title="${suite}"`);316 });317318 it("reads an answer's rounds first in main, newest first, the one on the page selected, and leaves them out of the inspector", () => {319 const states = askStates([320 claimedEvent(1, "okafor"),321 judgedEvent(2, refused.outcome, CommitSha.make("e".repeat(40))),322 judgedEvent(3, refused.outcome),323 ]);324325 const markup = markupOf(page({ states, verdict: refused }));326 const main = mainOf(markup);327 const rounds = main.slice(main.indexOf('id="answer-rounds"'));328329 expect(main.indexOf('id="answer-rounds"')).toBeGreaterThan(-1);330 expect(main.indexOf('id="answer-rounds"')).toBeLessThan(331 main.indexOf('id="answer-gate"')332 );333 expect(334 inOrder(textIn(rounds), ["Round 2 of 2", "Round 1 of 2"])335 ).toBeTruthy();336 expect(rounds).toMatch(/data-selected="true"[^>]*>[\s\S]*?Round 2 of 2/u);337 expect(textIn(asideOf(markup))).not.toContain("Rounds");338 });339340 it("draws no rounds region for an answer's only round", () => {341 const states = askStates([342 claimedEvent(1, "okafor"),343 judgedEvent(2, refused.outcome),344 ]);345346 expect(mainOf(markupOf(page({ states, verdict: refused })))).not.toContain(347 'id="answer-rounds"'348 );349 });350351 it("tells a waiting answer's contributor there is nothing to run, and what a push would start", () => {352 const waiting = verdictOf(353 Outcome.cases.AwaitingDecision.make({354 decision: DecisionId.make("dec-000001"),355 })356 );357358 const states = askStates([359 claimedEvent(1, "okafor"),360 judgedEvent(2, refused.outcome, CommitSha.make("e".repeat(40))),361 judgedEvent(3, waiting.outcome),362 ]);363364 expect(365 textIn(mainOf(markupOf(page({ states, verdict: waiting }))))366 ).toContain(367 "Nothing for you to run. Pushing again starts round 3; this verdict stays as round 2."368 );369 expect(textIn(mainOf(markupOf(refusedPage)))).not.toContain(370 "Nothing for you to run."371 );372 });373374 it("tells a landing as a sentence, then credits the people at title weight, then links the landing commit", () => {375 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));376 const markup = markupOf(page({ landing, verdict: landed }));377 const region = markup.slice(markup.indexOf('id="answer-landing"'));378379 expect(380 inOrder(textIn(region), [381 "Landed as 9b1c3e5",382 "asked by ines-v",383 "Credit",384 "Asked-by: ines-v",385 "The landing commit",386 ])387 ).toBeTruthy();388 expect(region).toMatch(/<h3 class="[^"]*text-title[^"]*">Credit<\/h3>/u);389 });390391 it("shows the refusals' explain lines in order, as git printed them", () => {392 expect(393 inOrder(394 textOf(refusedPage),
76 unmodified lines
471 [`/${project}/commit/${landedSha}`, "9b1c3e5"],472 ]);473 expect(commitLinksOf(runOf(markup))).toStrictEqual([474 [`/${project}/commit/${landed.base}`, landed.base.slice(0, 7)],475 [`/${project}/commit/${landedSha}`, "9b1c3e5"],476 [`/${project}/commit/${landedSha}`, "The landing commit"],477 ]);478 });479
49 unmodified lines
529 { area: AreaName.make("parse"), passed: 3, suite, total: 3 },530 ];531532 expect(textOf(<HeldBackBits results={results} />).trim()).toBe(458 `export 6/7 @ ${suite} parse 3/3 @ ${suite}`533 "export 6/7 @ sha256:4f2a4f… parse 3/3 @ sha256:4f2a4f…"534 );535 });536});537
229 unmodified lines
modified:apps/web/test/code-client.test.tsx+11 added
114 unmodified lines
115116 expect(opened).toStrictEqual([]);117 });118119 it("sets a flattened row's leading folders muted and its last name in ink, so the name reads first", () => {120 const css = treeOptionsFor({ paths: PATHS }).unsafeCSS ?? "";121122 expect(css).toMatch(123 /\[data-item-flattened-subitems\]\s*\{[^}]*color:\s*var\(--muted\)/u124 );125 expect(css).toMatch(126 /\[data-item-flattened-subitem\]:last-child\s*\{[^}]*color:\s*var\(--foreground\)/u127 );128 });129130 it("keeps its filter outside the tree, which holds only rows", () => {131 const { tree } = treeAt("src/parse.ts");132133 // A field inside a tree's role is not one of its rows to a screen
31 unmodified lines
modified:apps/web/test/code.test.tsx+19 added
1038 unmodified lines
1039 expect(text).toContain("committed by the platform");1040 expect(text).toContain(`parent ${IMPORTED.slice(0, 7)}`);1041 });10421043 it("ends its head's meta line with the files and lines it changed, linking the diff", () => {1044 const markup = markupOf(page);10451046 const meta =1047 /<div class="text-ui text-muted-foreground">[\s\S]*?<\/div>/u.exec(1048 markup1049 )?.[0] ?? "";10501051 expect(1052 meta1053 .replaceAll(/<[^>]+>/gu, " ")1054 .replaceAll(/\s+/gu, " ")1055 .trim()1056 ).toMatch(/Browse files · \d+ files? · \+\d+ added −\d+ removed$/u);1057 expect(meta).toMatch(/<a\b[^>]*href="#diff"/u);1058 expect(meta).toContain("text-diff-add-sign");1059 expect(markup).toMatch(/<div\b[^>]*id="diff"/u);1060 });10611062 it("sends each changed file's diff as plain text, at the drawing's measures", () => {1063 const markup = markupOf(page);10641065 const plain =
554 unmodified lines
added:apps/web/test/design-rules.test.tsx+110 added
1/**2 * DESIGN.md's named values, held against the components that draw them:3 * the inspector's widths (its `spacing` tokens) and the row's state word4 * (the Mark Carries Rule), and a path's file name read before its5 * folders. A change to either side without the other6 * fails here, so the document and the web never drift apart.7 */8import { describe, expect, it } from "@effect/vitest";9import { ProjectName } from "@repo/protocol/ids";10import { Effect } from "effect";11import { renderToStaticMarkup } from "react-dom/server";1213import design from "../../../DESIGN.md?raw";14import { PathTrail } from "../src/features/code/file-header.tsx";15import {16 STATE_MARK_NAMES,17 STATE_MARKS,18} from "../src/features/shared/marks.tsx";19import { wordTone } from "../src/features/shared/row.tsx";20import { Workspace } from "../src/features/shared/shell/workspace.tsx";21import { renderAt } from "./render.tsx";2223/** A `spacing` token's value in DESIGN.md's frontmatter. */24const spacing = (name: string) =>25 new RegExp(`^ {2}${name}: "(?<value>[^"]+)"$`, "mu").exec(design)?.groups26 ?.value;2728/** The inspector's class list, as a page with facts draws it. */29const inspectorClasses = (code: boolean) => {30 const markup = renderToStaticMarkup(31 <Workspace32 crumbs={[{ label: "Ledger" }]}33 facts={<p>Posture: open</p>}34 factsHeading="This ledger"35 title="Ledger"36 variant={code ? "code" : "document"}37 >38 <p>Entries</p>39 </Workspace>40 );4142 const aside =43 /<aside\b[^>]*data-facts="inspector"[^>]*>/u.exec(markup)?.[0] ?? "";4445 return (46 /class="(?<classes>[^"]*)"/u.exec(aside)?.groups?.classes ?? ""47 ).split(" ");48};4950describe("DESIGN.md's named values", () => {51 it("sizes the inspector as the spacing tokens say, wider from codefacts", () => {52 const narrow = spacing("inspector");53 const wide = spacing("inspector-codefacts");5455 expect([narrow, wide]).toStrictEqual(["20rem", "22rem"]);56 expect(inspectorClasses(false)).toStrictEqual(57 expect.arrayContaining([`w-[${narrow}]`, `codefacts:w-[${wide}]`])58 );59 expect(inspectorClasses(true)).toStrictEqual(60 expect.arrayContaining([`codefacts:w-[${wide}]`])61 );62 });6364 it("sets a row's state word in ink but for Refused and Landed, as the Mark Carries Rule says", () => {65 const coloured = STATE_MARK_NAMES.filter(66 (mark) => wordTone(mark) !== "text-foreground"67 );6869 expect(design).toContain(70 "the state word is ink at 500, except Refused (red) and Landed (green)"71 );72 expect(coloured).toStrictEqual(["landed", "refused", "retry"]);73 expect(coloured.map(wordTone)).toStrictEqual([74 STATE_MARKS.landed.tone,75 STATE_MARKS.refused.tone,76 STATE_MARKS.refused.tone,77 ]);78 });7980 it.effect(81 "sets a path's folders muted and its file name in ink in the code header",82 () =>83 Effect.gen(function* () {84 const markup = yield* renderAt(85 "/oscabriel/datekit/blob/main/src/parse/week.ts",86 <PathTrail87 path="src/parse/week.ts"88 project={ProjectName.make("oscabriel/datekit")}89 rev="main"90 />91 );9293 const folders = [94 ...markup.matchAll(95 /<a\b[^>]*class="(?<classes>[^"]*)"[^>]*>(?:src|parse)<\/a>/gu96 ),97 ].map((match) => match.groups?.classes ?? "");9899 expect(folders).toHaveLength(2);100 expect(101 folders.every((classes) =>102 classes.split(" ").includes("text-muted-foreground")103 )104 ).toBeTruthy();105 expect(markup).toMatch(106 /<span aria-current="page" class="[^"]*\btext-foreground\b[^"]*"[^>]*>week\.ts<\/span>/u107 );108 })109 );110});
modified:apps/web/test/events.test.ts+6 added-2 removed
151 unmodified lines
152 ])153 ).toStrictEqual(once);154 });155156 it("knows an ask from its opening on", () => {156 it("knows an ask from its opening on, and when it was opened", () => {157 const states = askStates([158 ProjectEvent.cases.AskOpened.make({159 ask: {160 ask,
7 unmodified lines
168 seq: 4,169 }),170 ]);171172 expect(states.get(ask)).toStrictEqual({ lastSeq: 4, rounds: [] });172 expect(states.get(ask)).toStrictEqual({173 lastSeq: 4,174 opened: at,175 rounds: [],176 });177 });178});179180describe(whoseMove, () => {
199 unmodified lines
modified:apps/web/test/facts.test.tsx+22 added
127 unmodified lines
128 expect(list).toContain("<button");129 expect(outside).not.toContain("<button");130 });131132 it("sets each entry as a label over its value, the block shape every other block has", () => {133 const markup = markupOf(134 <ProvenanceFacts entries={verdictProvenance(verdictOf(checking), now)} />135 );136137 const terms = [138 ...markup.matchAll(/<dt\b[^>]*class="(?<classes>[^"]*)"/gu),139 ].map((match) => match.groups?.classes ?? "");140141 const entries = (142 markup.match(/<div\b[^>]*data-provenance="[^"]*"[^>]*>/gu) ?? []143 ).map(144 (tag) => /class="(?<classes>[^"]*)"/u.exec(tag)?.groups?.classes ?? ""145 );146147 expect(entries).toHaveLength(7);148 expect(149 entries.every((classes) => classes.split(" ").includes("flex-col"))150 ).toBeTruthy();151 expect(terms.some((classes) => /\bw-\d+\b/u.test(classes))).toBeFalsy();152 });153154 it("shortens a hash named by its algorithm, keeping the algorithm", () => {155 const markup = markupOf(156 <ProvenanceFacts entries={[{ label: "Suite", value: suite }]} />157 );
132 unmodified lines
modified:apps/web/test/front.test.tsx+25 added-5 removed
398 unmodified lines
399 })400 );401402 it.effect(403 "lists the projects in the inspector by their counts, leaving the posture to the group headers",404 () =>405 Effect.gen(function* () {406 const markup = yield* front({});407408 const inspector = markup.slice(409 markup.indexOf('data-facts="inspector"')410 );411412 const block =413 /<section aria-label="Projects"[\s\S]*?<\/section>/u.exec(414 inspector415 )?.[0] ?? "";416417 expect(textIn(block)).toContain("open ask");418 expect(block).not.toContain("data-posture=");419 })420 );421422 it.effect(423 "draws its rows when the list of projects has not arrived, with no posture yet",424 () =>425 Effect.gen(function* () {426 const markup = yield* front({}, { projects: undefined });
3 unmodified lines
430 })431 );432433 it.effect(414 "marks an ask the viewer may not take with the reason, and no command",434 "says an ask held for newcomers is held for them whoever reads it, with no command for a viewer who may not take it",435 () =>436 Effect.gen(function* () {437 const markup = yield* front({});438 const row = rowOf(markup, "explain-iso-week");439440 expect(row).toContain('data-takeable="false"');441 expect(textIn(row)).toMatch(422 /Not open to you[\s\S]*held for newcomers/u442 /^(?!.*Not open to you).*Held for newcomers/su443 );444 expect(row).not.toContain("Open to take");445 expect(row).not.toContain(`${Brand.cli} claim explain-iso-week`);446 expect(rowOf(markup, "fix-week-start")).toContain("Open to take");
67 unmodified lines
514 })515 );516517 it.effect(498 "with nothing selected, says where to start and lists every project with its posture",518 "with nothing selected, says where to start and lists every project with its open asks",519 () =>520 Effect.gen(function* () {521 const markup = yield* front({});522 const facts = markup.slice(markup.indexOf('data-facts="inspector"'));
7 unmodified lines
530 ].filter((words) => !text.includes(words))531 ).toStrictEqual([]);532 expect(facts).toContain('href="/llms.txt"');533 expect(facts).toMatch(514 /href="\/oscabriel\/burrow"[\s\S]*?1 open ask\b[\s\S]*?Open with sealed evidence/u534 /href="\/oscabriel\/burrow"[\s\S]*?1 open ask\b/u535 );536 expect(facts).toMatch(517 /href="\/oscabriel\/datekit"[\s\S]*?2 open asks[\s\S]*?>Open</u537 /href="\/oscabriel\/datekit"[\s\S]*?2 open asks/u538 );539 })540 );541
184 unmodified lines
modified:apps/web/test/keys.test.tsx+32 added
139 unmodified lines
140 }).not.toThrow();141 expect(readShortcuts()).toBeTruthy();142 });143144 it("draws each key as a key: label type on the paper, a hairline border, the 2 px radius, 4 px of side padding", () => {145 const markup = renderToStaticMarkup(146 <KeysHelp147 on148 onChange={() => {149 // A static render never presses it.150 }}151 />152 );153154 const caps = [155 ...markup.matchAll(/<kbd\b[^>]*class="(?<classes>[^"]*)"/gu),156 ].map(({ groups }) => groups?.classes?.split(" ") ?? []);157158 expect(caps.length).toBeGreaterThan(0);159 expect(160 caps.filter(161 (classes) =>162 ![163 "bg-background",164 "border",165 "border-rule",166 "rounded-md",167 "px-1",168 "text-label",169 "font-sans",170 ].every((one) => classes.includes(one)) ||171 classes.includes("font-mono")172 )173 ).toStrictEqual([]);174 });175176 it("is in the dialog, with every key and what it does", () => {177 const markup = renderToStaticMarkup(178 <KeysHelp179 on={false}
30 unmodified lines
modified:apps/web/test/project.test.tsx+43 added-7 removed
38 unmodified lines
39import { devServer } from "../src/dev/server.ts";40import { ledeOf } from "../src/features/front/head.ts";41import { stampStep } from "../src/features/front/stamps.ts";42import { recentShown } from "../src/features/project/landings.tsx";43import { postureWord } from "../src/features/project/posture-label.ts";44import {45 ProjectView,46 heldBackOf,47 homeListing,48} from "../src/features/project/project-page.tsx";49import type { ProjectViewProps } from "../src/features/project/project-page.tsx";50import { UnknownProjectView } from "../src/features/project/unknown-project.tsx";51import { askStates } from "../src/features/shared/ask-progress.ts";52import { PostureMark } from "../src/features/shared/shell/rail.tsx";53import {54 ProjectPageData,55 readProjectPage,56} from "../src/server/project-page.ts";
278 unmodified lines
335 })336 );337338 it.effect(337 "says its posture once, in the platform's words, then its open asks and when it last landed",339 "says its posture once, in the short form the rail uses, the platform's words in its title, then its open asks",340 () =>341 Effect.gen(function* () {342 const markup = yield* page({343 postureLabel: "Open with sealed evidence · sealed checks in export",
3 unmodified lines
347 markup.indexOf("<h1"),348 markup.indexOf('id="open-asks"')349 );350351 const rail = markupOf(<PostureMark posture="openWithSealedEvidence" />);352353 expect(head).toContain('data-posture="openWithSealedEvidence"');350 expect(textIn(head)).toContain(351 "Open with sealed evidence · sealed checks in export"354 expect(textIn(head)).toMatch(355 new RegExp(356 `${postureWord("openWithSealedEvidence")}\\s*·\\s*5 open asks`,357 "u"358 )359 );353 expect(textIn(head)).toContain("5 open asks");354 expect(textIn(head)).toContain("last landed 1 d ago");360 expect(textIn(rail)).toContain(postureWord("openWithSealedEvidence"));361 expect(head).toContain(362 'title="Open with sealed evidence · sealed checks in export"'363 );364 // The delete child waits on its siblings, so it is not counted open yet.365 expect(textIn(markup)).toContain("5 open asks, 2 open to take");366 })367 );368369 it.effect(361 "says how a change lands here: the posture, the gate, who decides, what is held back",370 "states how a change lands in one rule sentence under the head, from typed facts, the ledger linked",371 () =>372 Effect.gen(function* () {373 const markup = yield* page({374 deciders: [375 {376 handles: [Handle.make("ines-v")],377 paths: Glob.make("src/**"),378 },379 ],380 heldBack: heldBackOf(vellumLedger),381 });382383 const rule =384 /<p\b[^>]*data-rule=""[^>]*>[\s\S]*?<\/p>/u.exec(385 mainOf(markup)386 )?.[0] ?? "";387388 expect(textIn(rule)).toBe(389 "Gate: 7 stages · deciders set for 1 path · 7 sealed checks in 1 area · last landed 1 d ago"390 );391 expect(rule).toContain('href="/oscabriel/datekit/ledger"');392 expect(inspectorOf(markup)).not.toContain("data-posture=");393 })394 );395396 it.effect(397 "says how a change lands here: the gate, who decides, what is held back",398 () =>399 Effect.gen(function* () {400 const facts = inspectorOf(401 yield* page({402 deciders: [403 {
373 unmodified lines
777 const head = mainOf(yield* sentFrom(data));778779 expect(yield* Ref.get(listed)).toBe(0);780 expect(head).toContain('data-posture="openWithSealedEvidence"');745 expect(textIn(head)).toContain("Open with sealed evidence");781 expect(head).toContain('title="Open with sealed evidence');782 }),783 seededWorld784 );785
160 unmodified lines
modified:apps/web/test/row.test.tsx+159 added-2 removed
7 unmodified lines
8import { describe, expect, it } from "@effect/vitest";9import { Brand } from "@repo/brand";10import { AskListing } from "@repo/protocol/domain/ask";11import { Outcome } from "@repo/protocol/domain/outcome";12import { CommitSha, ProjectName } from "@repo/protocol/ids";12import { CommitSha, Handle, ProjectName } from "@repo/protocol/ids";13import { StaleBase } from "@repo/protocol/refusal";14import { Effect, Schema } from "effect";14import { DateTime, Effect, Schema } from "effect";15import type { ReactElement } from "react";1617import { STATE_MARKS } from "../src/features/shared/marks.tsx";18import { AskRow, Row, RowGroup } from "../src/features/shared/row.tsx";19import { attributeOf, tagsWith, textIn } from "./markup.ts";20import { renderAt } from "./render.tsx";21
160 unmodified lines
182 })183 );184});185186/** The classes on each element whose text is `word`, in `markup`. */187const wordClasses = (markup: string, word: string) =>188 [189 ...markup.matchAll(190 new RegExp(`<span class="(?<classes>[^"]*)">${word}<`, "gu")191 ),192 ].map((match) => match.groups?.classes ?? "");193194describe("an ask row's standing, word and time", () => {195 const now = DateTime.makeUnsafe("2026-10-11T12:00:00Z");196 const held = { ...listing("@burrow/auth"), reserve: "newcomers" } as const;197198 it.effect(199 "reads an ask held for newcomers as held for them, whether or not the viewer may take it",200 () =>201 Effect.gen(function* () {202 const refused = textIn(203 yield* rowsAt(204 <AskRow listing={held} project={burrow} takeable={false} />205 )206 );207208 const unknown = textIn(209 yield* rowsAt(<AskRow listing={held} project={burrow} />)210 );211212 expect(refused).toContain("Held for newcomers");213 expect(refused).not.toContain("Not open to you");214 expect(unknown).toContain("Held for newcomers");215 })216 );217218 it.effect(219 "sets a waiting word in ink, its colour on the mark alone, and keeps Landed green",220 () =>221 Effect.gen(function* () {222 const waiting = yield* rowsAt(223 <AskRow224 listing={{ ...listing("@burrow/auth"), blockedBy: [held.ask] }}225 project={burrow}226 />227 );228229 const landed = yield* rowsAt(230 <Row231 href="/burrow/asks/a"232 id="a"233 state={{ mark: "landed", word: "Landed" }}234 title="Format ordinals"235 />236 );237238 expect(wordClasses(waiting, "Waiting").length).toBeGreaterThan(0);239 expect(wordClasses(waiting, "Waiting").join(" ")).not.toContain(240 STATE_MARKS.waiting.tone241 );242 expect(waiting).toMatch(/<svg\b[^>]*text-waiting/u);243 expect(wordClasses(landed, "Landed").join(" ")).toContain(244 "text-landed"245 );246 })247 );248249 it.effect(250 "fills the time slot with the last push, and names the round in line 2",251 () =>252 Effect.gen(function* () {253 const at = DateTime.subtract(now, { hours: 3 });254 const head = CommitSha.make("c".repeat(40));255256 const markup = yield* rowsAt(257 <AskRow258 listing={listing("@burrow/auth")}259 now={now}260 progress={{261 claimant: Handle.make("bram"),262 lastPush: { at, head },263 lastSeq: 4,264 rounds: [265 {266 at,267 head,268 outcome: Outcome.cases.Checking.make({ stage: "checks" }),269 seq: 3,270 },271 {272 at,273 head,274 outcome: Outcome.cases.Checking.make({ stage: "checks" }),275 seq: 4,276 },277 ],278 }}279 project={burrow}280 />281 );282283 expect(markup).toMatch(284 new RegExp(285 `<time dateTime="${DateTime.formatIso(at)}"[^>]*>3 h ago</time>`,286 "u"287 )288 );289 expect(textIn(markup)).toContain("round 2");290 })291 );292293 it.effect(294 "fills the time slot with the ask's opening when nothing was pushed",295 () =>296 Effect.gen(function* () {297 const opened = DateTime.subtract(now, { days: 2 });298299 const markup = yield* rowsAt(300 <AskRow301 listing={listing("@burrow/auth")}302 now={now}303 progress={{ lastSeq: 1, opened, rounds: [] }}304 project={burrow}305 takeable306 />307 );308309 expect(textIn(markup)).toContain("2 d ago");310 })311 );312313 it.effect(314 "gives a selected row the pressed surface under the pointer, and lets the want take two lines on a phone",315 () =>316 Effect.gen(function* () {317 const markup = yield* rowsAt(318 <Row319 data={{ "data-ask": "a" }}320 href="/burrow/asks/a"321 id="a"322 selected323 title="Format ordinals"324 />325 );326327 const [row] = tagsWith(markup, "data-ask");328329 const want = /<p class="(?<classes>[^"]*)"><a\b/u.exec(markup)?.groups330 ?.classes;331332 expect(attributeOf(row ?? "", "class")?.split(" ")).toStrictEqual(333 expect.arrayContaining(["bg-surface", "hover:bg-surface-2"])334 );335 expect(want?.split(" ")).toStrictEqual(336 expect.arrayContaining(["line-clamp-2", "tablet:line-clamp-1"])337 );338 })339 );340});341342describe(Row, () => {343 it.effect(344 "puts the state's word beside its mark, and keeps the mark from the screen reader",345 () =>
105 unmodified lines
modified:apps/web/test/shared.test.tsx+26 added-1 removed
9 unmodified lines
10import { Handle } from "@repo/protocol/ids";11import { DateTime, Schema } from "effect";1213import { Definition, Definitions } from "../src/features/ask/fields.tsx";14import {15 CommandLine,16 InspectorCommands,14import { CommandLine } from "../src/features/shared/command.tsx";17} from "../src/features/shared/command.tsx";18import { CopyAction } from "../src/features/shared/copy-action.tsx";19import { EmptyState } from "../src/features/shared/empty.tsx";20import { HandleLink } from "../src/features/shared/handle.tsx";21import {
171 unmodified lines
193 `${Brand.cli} claim lint-heading-levels --project oscabriel/vellum \\\n --json`194 )195 ).toStrictEqual([6, 2]);196 });197198 it("takes the bleed form in the inspector: pane-wide, ruled above and below, hanging 2ch, an icon-only Copy", () => {199 const command = `${Brand.cli} claim lint-heading-levels --project vellum`;200201 const markup = markupOf(202 <InspectorCommands>203 <CommandLine command={command} />204 </InspectorCommands>205 );206207 const box = /<div\b[^>]*data-form="bleed"[^>]*>/u.exec(markup)?.[0] ?? "";208209 expect(box).toMatch(/\bborder-y\b/u);210 expect(box).not.toMatch(/\bborder\b(?!-)/u);211 expect(markup).toMatch(/padding-left:2ch;text-indent:-2ch/u);212 expect(markup).toMatch(213 /<button\b[^>]*class="[^"]*\bsize-7\b[^"]*"[^>]*>.*<span class="sr-only">Copy<\/span><\/button>/u214 );215 expect(markupOf(<CommandLine command={command} />)).toMatch(216 /data-form="box"/u217 );218 });219});220221describe(EmptyState, () => {222 it("says what is empty and the command that would change it", () => {
67 unmodified lines
modified:DESIGN.md+3 added-10 removed
358 unmodified lines
359360### Rail (`Rail`)361362- **Character:** where you are, always in the same place.363- **Shape:** the wordmark row (44 px, linking `/`, the landing); the site's sections, each a 32 px row of a 16 px mark and its word (Home, Asks at `/asks`, Today with the count of decisions waiting for a signed-in decider, Docs, For agents); "Projects" over one 32 px row per project, its posture's mark and one short word at the row's end (the same short form the project's head uses, from `posture-label.ts`; "Sealed" in the rail where the head says "Open with sealed evidence" is the thing to fix, not a second form); the current project's sections indented under it (Asks with its open count, Code, Landings, Refs, Policy, Ledger, Env shape); "All projects" opening the switcher after the first eight; the session (handle or Sign in) and a Keys button pinned at the foot.363- **Shape:** the wordmark row (44 px, linking `/`, the landing); the site's sections, each a 32 px row of a 16 px mark and its word (Home, Asks at `/asks`, Today with the count of decisions waiting for a signed-in decider, Docs, For agents); "Projects" over one 32 px row per project, its posture's mark and one short word at the row's end (`postureWord` in `posture-label.ts`, the same short form the project's head says, such as "Sealed evidence", the platform's full label its title); the current project's sections indented under it (Asks with its open count, Code, Landings, Refs, Policy, Ledger, Env shape); "All projects" opening the switcher after the first eight; the session (handle or Sign in) and a Keys button pinned at the foot.364- **Current item:** the surface fill, ink at 600, `aria-current`. Never a coloured bar or an accent.365- **Code form:** a route that fills the rail's slot (`staticData.rail`: the tree on tree, blob and why; the changed files on a commit and a finish) folds the site's sections and projects into a Menu button on the wordmark row and the project's sections into a one-line disclosure, and the slot fills the rest.366367### Top bar and bottom bar
126 unmodified lines
494### Decided, not yet drawn495496Each rule below is decided in this document (ADR 0039) and not yet in the code; the build issues are cut from this list, and an item leaves it when its file changes.497498- The inspector at 20 rem from `shell` and 22 rem from `codefacts`: `apps/web/src/features/shared/shell/workspace.tsx` (its `w-[19rem]`). Decided, not yet drawn.499- The command line's bleed form in the inspector (pane-wide, hairlines top and bottom, a 28 px icon-only Copy) and the 2ch hang there, 6ch in main: `apps/web/src/features/shared/command.tsx`. Decided, not yet drawn.500- The row's state word in ink at 500 except Refused and Landed (`wordTone`), the time slot filled on every ask row, "round n" and "mentored by" in line 2, the two-line want below `tablet`, the pressed surface on a selected row under the pointer, and held-for-newcomers read before takeable (`askState`): `apps/web/src/features/shared/row.tsx`. Decided, not yet drawn.501- The head meta line's `files · +n −m` on answer and commit subjects: `apps/web/src/features/shared/status-line.tsx` and the answer and commit heads. Decided, not yet drawn.502- Provenance in the one block shape, the Rounds block removed from the inspector, the front page's Projects block as counts only, and the held-back roots shortened: `apps/web/src/features/shared/facts.tsx`. Decided, not yet drawn.503- The Rounds region, the waiting sentence and the Landing region's sentence-first order with "The landing commit" as its onward link: `apps/web/src/features/answer/answer-page.tsx`; "Credit" at Title weight there: `apps/web/src/features/shared/credits.tsx`. Decided, not yet drawn.504- The project head's one rule sentence, the How a change lands block without its Posture, and one short posture form for the rail and the head: `apps/web/src/features/project/project-page.tsx`, `apps/web/src/features/project/posture-label.ts`, `apps/web/src/features/shared/posture.tsx`. Decided, not yet drawn.505- The path split (directories muted, name ink) in the code file header and the tree's flattened rows: `apps/web/src/features/code/file-header.tsx`, `apps/web/src/features/code/repo-tree.tsx`. Decided, not yet drawn.506- The `kbd` look in the keys dialog: `apps/web/src/features/shared/keys.tsx`. Decided, not yet drawn.498- "mentored by" in an ask row's line 2: the row reads an `AskListing`, which carries no mentor, so it waits on the listing gaining one (a contract change in `packages/protocol`): `apps/web/src/features/shared/row.tsx`. Decided, not yet drawn.499- The head meta line's `files · +n −m` on an answer's subject: the answer page reads an `AnswerView`, which carries no diff stats, so it waits on the view gaining them (a contract change in `packages/protocol`); the commit's head has it. `apps/web/src/features/answer/answer-page.tsx`. Decided, not yet drawn.500501## Do's and Don'ts502503### Do:
23 unmodified lines