Public: anyone can read this; the crew can change it.
Design: a pull's merge box uses §5's card and buttons, and the merge-* classes leave §5d #4378
scout/forge:scout/3867-design-a-pull-s-merge-box-uses-5-s-card → main 12 commits fork
8 files
changed +200
−206
docs/DESIGN.md +4
| @@ -394,7 +394,11 @@ gone, so this list only shrinks. | ||
| 394 | 394 | A `.field` directly inside a `.bar` drops its bottom margin and the bar aligns to the end, so a labelled input and its button share a baseline |
| 395 | 395 | - **`style/components.ts`** — parts of the §5 components that the table does not spell out — the palette's list, the menu's items, a dialog's head and foot, comments, the theme picker — and a few small helpers beside them: `.cat` `.clone` `.clone-text` `.comment` `.comment-body` `.comment-form` `.dash` `.dialog-body` `.dialog-foot` `.dialog-head` `.empty-title` `.error-note` `.field-row` `.form-actions` `.hex` `.ico` `.ico-loader` `.list` `.live-status` `.menu-item` `.menu-panel` `.menu-sep` `.menu-title` `.palette-empty` `.palette-foot` `.palette-group` `.palette-heading` `.palette-input` `.palette-item` `.palette-list` `.passkey` `.passkey-lead` `.passkey-note` `.passkey-off` `.passkey-on` `.preview` `.sep` `.split` `.sprite` `.swatch` `.table-scroll` `.tell-here` `.theme-apply` `.theme-option` `.tick` `.timeline` `.tl-dot` `.toast-body` `.topbar-search` |
| 396 | 396 | - **`style/components.ts`, settings rows** — a list whose rows are settings (limits, capacity): the `<ul class="list setting-list">` lets title and meta wrap instead of ellipsizing, and a row's controls take their own line under 640px. `.row-fields` is the form in that row's trail (input, Save, Default): always visible, never hover-gated, wrapping under the text before it would clip. Use both for any page whose rows show a name, a current value, and a control to change it; use `.row-actions` only for secondary actions (delete, wake, pin, revoke). Flags, telemetry, cloud, people, crew roles and subscription headroom/budget use `.row-fields`. Classes: `.row-fields` `.setting-list` |
| 397 | <<<<<<< HEAD | |
| 398 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following, lineage: `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.handoff` `.handoff-links` `.headroom` `.issue-head` `.issue-meta` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` | |
| 399 | ======= | |
| 397 | 400 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following, lineage: `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.commit-body` `.commit-head` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` |
| 401 | >>>>>>> origin/main | |
| 398 | 402 | - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable` |
| 399 | 403 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 400 | 404 | - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd` |
src/web/merge-card.ts added +42
| @@ -0,0 +1,42 @@ | ||
| 1 | /** | |
| 2 | * The merge box: one verdict on a pull, drawn from §5's card and row. The | |
| 3 | * `setting-list` row lets the sentence wrap and puts the controls on their | |
| 4 | * own line on a phone. | |
| 5 | */ | |
| 6 | import { card, row, type CardOptions } from "./ui.ts"; | |
| 7 | import { html, raw, type Html } from "./html.ts"; | |
| 8 | ||
| 9 | export interface MergeCardOptions { | |
| 10 | tone?: CardOptions["tone"] | undefined; | |
| 11 | lead: Html; | |
| 12 | title: Html | string; | |
| 13 | /** The sentence under the title, with any chips. */ | |
| 14 | meta?: Html | undefined; | |
| 15 | /** Controls at the row's end: a form, a button. */ | |
| 16 | trail?: Html | undefined; | |
| 17 | /** Content under the row, in the card's body (a list does not belong in | |
| 18 | * the row's one-line meta). */ | |
| 19 | after?: Html | undefined; | |
| 20 | /** Further card classes. */ | |
| 21 | extra?: string | undefined; | |
| 22 | } | |
| 23 | ||
| 24 | export function mergeCard(o: MergeCardOptions): Html { | |
| 25 | return card( | |
| 26 | html`<ul class="list setting-list"> | |
| 27 | ${row({ | |
| 28 | lead: o.lead, | |
| 29 | title: o.title, | |
| 30 | ...(o.meta ? { meta: o.meta } : {}), | |
| 31 | ...(o.trail ? { trail: o.trail } : {}), | |
| 32 | })} | |
| 33 | </ul> | |
| 34 | ${o.after ? html`<div class="card-body">${o.after}</div>` : null}`, | |
| 35 | { | |
| 36 | ...(o.tone ? { tone: o.tone } : {}), | |
| 37 | extra: o.extra ? `mt ${o.extra}` : "mt", | |
| 38 | pad: false, | |
| 39 | attrs: raw("data-verdict"), | |
| 40 | }, | |
| 41 | ); | |
| 42 | } |
src/web/pages/browse.ts +19 −25
| @@ -25,6 +25,7 @@ | ||
| 25 | 25 | * labels and authors instead. |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | import { mergeCard } from "../merge-card.ts"; | |
| 28 | 29 | import { mirrorJobFor, startMirrorJob } from "../../actions/origins.ts"; |
| 29 | 30 | import { forkOrigin } from "../../actions/contribute.ts"; |
| 30 | 31 | import { getOriginFor } from "../../core/origins.ts"; |
| @@ -805,31 +806,24 @@ function timelineOf( | ||
| 805 | 806 | function mergeElsewhere(scope: RepoScope): Html { |
| 806 | 807 | const host = |
| 807 | 808 | scope.origin === undefined ? "the origin" : hostLabel(scope.origin.webUrl); |
| 808 | return card( | |
| 809 | html`${icon(scope.origin ? originIcon(scope.origin.kind) : "globe")} | |
| 810 | <div class="grow"> | |
| 811 | <div class="merge-headline">Merge on ${host}.</div> | |
| 812 | <p class="merge-sub"> | |
| 813 | You are reading this pull request live. Merging, reviewing and | |
| 814 | commenting all happen where it lives — mirror the repository and | |
| 815 | comments come back through this forge instead. | |
| 816 | </p> | |
| 817 | </div> | |
| 818 | ${when( | |
| 819 | scope.originUrl !== "", | |
| 820 | () => | |
| 821 | // Outline: the header's Mirror button is this page's one accent. | |
| 822 | html`<span class="merge-form" | |
| 823 | >${btn("Open on the origin", { | |
| 824 | href: scope.originUrl, | |
| 825 | variant: "outline", | |
| 826 | icon: "external", | |
| 827 | external: true, | |
| 828 | })}</span | |
| 829 | >`, | |
| 830 | )}`, | |
| 831 | { tone: "attn", extra: "merge-box" }, | |
| 832 | ); | |
| 809 | return mergeCard({ | |
| 810 | tone: "attn", | |
| 811 | lead: icon(scope.origin ? originIcon(scope.origin.kind) : "globe"), | |
| 812 | title: `Merge on ${host}.`, | |
| 813 | meta: html`You are reading this pull request live. Merging, reviewing and | |
| 814 | commenting all happen where it lives — mirror the repository and | |
| 815 | comments come back through this forge instead.`, | |
| 816 | // Outline: the header's Mirror button is this page's one accent. | |
| 817 | trail: | |
| 818 | scope.originUrl !== "" | |
| 819 | ? btn("Open on the origin", { | |
| 820 | href: scope.originUrl, | |
| 821 | variant: "outline", | |
| 822 | icon: "external", | |
| 823 | external: true, | |
| 824 | }) | |
| 825 | : undefined, | |
| 826 | }); | |
| 833 | 827 | } |
| 834 | 828 | |
| 835 | 829 | // ---- starting a mirror ---- |
src/web/pages/pull.ts +89 −138
| @@ -64,6 +64,7 @@ import { | ||
| 64 | 64 | repoPalette, |
| 65 | 65 | signInFirst, |
| 66 | 66 | } from "../chrome.ts"; |
| 67 | import { mergeCard } from "../merge-card.ts"; | |
| 67 | 68 | import { notePhase, takeSessionTime } from "../../core/route_timing.ts"; |
| 68 | 69 | import { diffCacheCounts, diffKey, keptDiff } from "../diff-cache.ts"; |
| 69 | 70 | import { diffSyntax } from "../diff-syntax.ts"; |
| @@ -399,38 +400,26 @@ function mergeBox( | ||
| 399 | 400 | </form>`; |
| 400 | 401 | |
| 401 | 402 | if (pull.mergedAt !== null) { |
| 402 | return card( | |
| 403 | html`${icon("merge")} | |
| 404 | <div class="grow"> | |
| 405 | <div class="merge-headline">Merged.</div> | |
| 406 | <p class="merge-sub"> | |
| 407 | <span class="mono">${pull.headBranch}</span> was merged into | |
| 408 | <span class="mono">${pull.baseBranch}</span>${when( | |
| 409 | pull.mergedOid, | |
| 410 | (oid) => html` as ${sha(oid, `${repoBase(repo)}/commit/${oid}`)}`, | |
| 411 | )}. | |
| 412 | </p> | |
| 413 | </div>`, | |
| 414 | { tone: "merged", extra: "merge-box" }, | |
| 415 | ); | |
| 403 | return mergeCard({ | |
| 404 | tone: "merged", | |
| 405 | lead: icon("merge"), | |
| 406 | title: "Merged.", | |
| 407 | meta: html`<span class="mono">${pull.headBranch}</span> was merged into | |
| 408 | <span class="mono">${pull.baseBranch}</span>${when( | |
| 409 | pull.mergedOid, | |
| 410 | (oid) => html` as ${sha(oid, `${repoBase(repo)}/commit/${oid}`)}`, | |
| 411 | )}.`, | |
| 412 | }); | |
| 416 | 413 | } |
| 417 | 414 | |
| 418 | 415 | if (pull.state === "closed") { |
| 419 | return card( | |
| 420 | html`${icon("x")} | |
| 421 | <div class="grow"> | |
| 422 | <div class="merge-headline">Closed without merging.</div> | |
| 423 | <p class="merge-sub"> | |
| 424 | Nothing was applied to | |
| 425 | <span class="mono">${pull.baseBranch}</span>. | |
| 426 | </p> | |
| 427 | </div> | |
| 428 | ${when( | |
| 429 | ctx.auth.user !== undefined, | |
| 430 | () => html`<span class="merge-form">${reopen}</span>`, | |
| 431 | )}`, | |
| 432 | { extra: "merge-box" }, | |
| 433 | ); | |
| 416 | return mergeCard({ | |
| 417 | lead: icon("x"), | |
| 418 | title: "Closed without merging.", | |
| 419 | meta: html`Nothing was applied to | |
| 420 | <span class="mono">${pull.baseBranch}</span>.`, | |
| 421 | trail: ctx.auth.user !== undefined ? reopen : undefined, | |
| 422 | }); | |
| 434 | 423 | } |
| 435 | 424 | |
| 436 | 425 | // A mirror's merge belongs to the origin: merging locally would rewrite the |
| @@ -439,32 +428,24 @@ function mergeBox( | ||
| 439 | 428 | // required checks exactly. So the box says where the button is instead. |
| 440 | 429 | if (repo.origin !== null || pull.originHeadRepo !== null) { |
| 441 | 430 | const at = repo.origin; |
| 442 | return card( | |
| 443 | html`${icon(at?.kind ?? "globe")} | |
| 444 | <div class="grow"> | |
| 445 | <div class="merge-headline">Merge on the origin.</div> | |
| 446 | <p class="merge-sub"> | |
| 447 | This repository mirrors | |
| 448 | ${at === null || at.fullName === "" | |
| 449 | ? html`another forge` | |
| 450 | : html`<span class="mono">${at.fullName}</span>`}, | |
| 451 | which is truth for it. Merge there and the next sync brings back the | |
| 452 | merge commit it actually made. | |
| 453 | </p> | |
| 454 | </div> | |
| 455 | ${when( | |
| 456 | pull.originUrl, | |
| 457 | (url) => | |
| 458 | html`<span class="merge-form" | |
| 459 | >${btn("Open on the origin", { | |
| 460 | href: url, | |
| 461 | variant: "primary", | |
| 462 | icon: "external", | |
| 463 | })}</span | |
| 464 | >`, | |
| 465 | )}`, | |
| 466 | { tone: "attn", extra: "merge-box" }, | |
| 467 | ); | |
| 431 | return mergeCard({ | |
| 432 | tone: "attn", | |
| 433 | lead: icon(at?.kind ?? "globe"), | |
| 434 | title: "Merge on the origin.", | |
| 435 | meta: html`This repository mirrors | |
| 436 | ${at === null || at.fullName === "" | |
| 437 | ? html`another forge` | |
| 438 | : html`<span class="mono">${at.fullName}</span>`}, | |
| 439 | which is truth for it. Merge there and the next sync brings back the | |
| 440 | merge commit it actually made.`, | |
| 441 | trail: pull.originUrl | |
| 442 | ? btn("Open on the origin", { | |
| 443 | href: pull.originUrl, | |
| 444 | variant: "primary", | |
| 445 | icon: "external", | |
| 446 | }) | |
| 447 | : undefined, | |
| 448 | }); | |
| 468 | 449 | } |
| 469 | 450 | |
| 470 | 451 | if (!status.mergeable) { |
| @@ -483,15 +464,12 @@ function mergeBox( | ||
| 483 | 464 | ? html` <a href="${thread}/resolve">Resolve</a> it here.` |
| 484 | 465 | : ""}` |
| 485 | 466 | : html`This branch cannot be applied automatically.`; |
| 486 | return card( | |
| 487 | html`${icon("alert")} | |
| 488 | <div class="grow"> | |
| 489 | <div class="merge-headline">Can't merge.</div> | |
| 490 | <p class="merge-sub">${reason}</p> | |
| 491 | ${reviewsChip(status.reviews, by)} ${checks} | |
| 492 | </div>`, | |
| 493 | { tone: "danger", extra: "merge-box" }, | |
| 494 | ); | |
| 467 | return mergeCard({ | |
| 468 | tone: "danger", | |
| 469 | lead: icon("alert"), | |
| 470 | title: html`Can't merge.`, | |
| 471 | meta: html`${reason} ${reviewsChip(status.reviews, by)} ${checks}`, | |
| 472 | }); | |
| 495 | 473 | } |
| 496 | 474 | |
| 497 | 475 | // Git says yes; the review gate may still say no. It is the same question |
| @@ -509,27 +487,20 @@ function mergeBox( | ||
| 509 | 487 | : html`This repository requires an approving review of the commit that |
| 510 | 488 | is head right now. A verdict passed before the latest push does not |
| 511 | 489 | count.`; |
| 512 | return card( | |
| 513 | html`${icon("eye")} | |
| 514 | <div class="grow"> | |
| 515 | <div class="merge-headline">Waiting on review.</div> | |
| 516 | <p class="merge-sub">${why}</p> | |
| 517 | ${reviewsChip(status.reviews, by)} ${checks} | |
| 518 | </div> | |
| 519 | ${when( | |
| 520 | mayMerge, | |
| 521 | () => | |
| 522 | html`<span class="merge-form" | |
| 523 | >${btn("Merge pull request", { | |
| 524 | variant: "primary", | |
| 525 | icon: "merge", | |
| 526 | disabled: true, | |
| 527 | title: "An approving review of this head is required first", | |
| 528 | })}</span | |
| 529 | >`, | |
| 530 | )}`, | |
| 531 | { tone: "attn", extra: "merge-box" }, | |
| 532 | ); | |
| 490 | return mergeCard({ | |
| 491 | tone: "attn", | |
| 492 | lead: icon("eye"), | |
| 493 | title: "Waiting on review.", | |
| 494 | meta: html`${why} ${reviewsChip(status.reviews, by)} ${checks}`, | |
| 495 | trail: mayMerge | |
| 496 | ? btn("Merge pull request", { | |
| 497 | variant: "primary", | |
| 498 | icon: "merge", | |
| 499 | disabled: true, | |
| 500 | title: "An approving review of this head is required first", | |
| 501 | }) | |
| 502 | : undefined, | |
| 503 | }); | |
| 533 | 504 | } |
| 534 | 505 | |
| 535 | 506 | // The check gate, `mergePull`'s `checks_required`: the deploy of the |
| @@ -552,61 +523,41 @@ function mergeBox( | ||
| 552 | 523 | or push again.` |
| 553 | 524 | : html`There is no deploy of this head yet. Nothing merges until one |
| 554 | 525 | passes.`; |
| 555 | return card( | |
| 556 | html`${icon("loader")} | |
| 557 | <div class="grow"> | |
| 558 | <div class="merge-headline">Waiting on checks.</div> | |
| 559 | <p class="merge-sub">${why}</p> | |
| 560 | ${reviewsChip(status.reviews, by)} ${checks} | |
| 561 | </div> | |
| 562 | ${when( | |
| 563 | mayMerge, | |
| 564 | () => | |
| 565 | html`<span class="merge-form" | |
| 566 | >${btn("Merge pull request", { | |
| 567 | variant: "primary", | |
| 568 | icon: "merge", | |
| 569 | disabled: true, | |
| 570 | title: "A passing deploy of this head is required first", | |
| 571 | })}</span | |
| 572 | >`, | |
| 573 | )}`, | |
| 574 | { tone: "attn", extra: "merge-box" }, | |
| 575 | ); | |
| 526 | return mergeCard({ | |
| 527 | tone: "attn", | |
| 528 | lead: icon("loader"), | |
| 529 | title: "Waiting on checks.", | |
| 530 | meta: html`${why} ${reviewsChip(status.reviews, by)} ${checks}`, | |
| 531 | trail: mayMerge | |
| 532 | ? btn("Merge pull request", { | |
| 533 | variant: "primary", | |
| 534 | icon: "merge", | |
| 535 | disabled: true, | |
| 536 | title: "A passing deploy of this head is required first", | |
| 537 | }) | |
| 538 | : undefined, | |
| 539 | }); | |
| 576 | 540 | } |
| 577 | 541 | |
| 578 | return card( | |
| 579 | html`${icon("check")} | |
| 580 | <div class="grow"> | |
| 581 | <div class="merge-headline"> | |
| 582 | Ready to merge — no conflicts with | |
| 583 | <span class="mono">${pull.baseBranch}</span>. | |
| 584 | </div> | |
| 585 | <p class="merge-sub"> | |
| 586 | ${status.ahead} commit${status.ahead === 1 ? "" : "s"} will land on | |
| 587 | <span class="mono">${pull.baseBranch}</span>. | |
| 588 | </p> | |
| 589 | ${reviewsChip(status.reviews, by)} ${checks} | |
| 590 | </div> | |
| 591 | ${mayMerge | |
| 592 | ? html`<span class="merge-form"> | |
| 593 | <form method="post" action="${thread}/merge" class="merge-form"> | |
| 594 | <label class="sr-only" for="strategy">Merge strategy</label> | |
| 595 | <select class="input" id="strategy" name="strategy"> | |
| 596 | <option value="merge">Merge commit</option> | |
| 597 | <option value="squash">Squash and merge</option> | |
| 598 | </select> | |
| 599 | ${btn("Merge pull request", { | |
| 600 | variant: "primary", | |
| 601 | icon: "merge", | |
| 602 | })} | |
| 603 | </form> | |
| 604 | </span>` | |
| 605 | : html`<span class="muted small" | |
| 606 | >You need write access to merge.</span | |
| 607 | >`}`, | |
| 608 | { tone: "success", extra: "merge-box" }, | |
| 609 | ); | |
| 542 | return mergeCard({ | |
| 543 | tone: "success", | |
| 544 | lead: icon("check"), | |
| 545 | title: html`Ready to merge — no conflicts with | |
| 546 | <span class="mono">${pull.baseBranch}</span>.`, | |
| 547 | meta: html`${status.ahead} commit${status.ahead === 1 ? "" : "s"} will land | |
| 548 | on <span class="mono">${pull.baseBranch}</span>. | |
| 549 | ${reviewsChip(status.reviews, by)} ${checks}`, | |
| 550 | trail: mayMerge | |
| 551 | ? html`<form method="post" action="${thread}/merge"> | |
| 552 | <label class="sr-only" for="strategy">Merge strategy</label> | |
| 553 | <select class="input" id="strategy" name="strategy"> | |
| 554 | <option value="merge">Merge commit</option> | |
| 555 | <option value="squash">Squash and merge</option> | |
| 556 | </select> | |
| 557 | ${btn("Merge pull request", { variant: "primary", icon: "merge" })} | |
| 558 | </form>` | |
| 559 | : html`<span class="muted small">You need write access to merge.</span>`, | |
| 560 | }); | |
| 610 | 561 | } |
| 611 | 562 | |
| 612 | 563 | // ---- threads ---- |
src/web/studio/change.ts +18 −21
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | * bigger. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | import { mergeCard } from "../merge-card.ts"; | |
| 12 | 13 | import { notePhase, takeSessionTime } from "../../core/route_timing.ts"; |
| 13 | 14 | import { cardPath } from "../og/path.ts"; |
| 14 | 15 | import { pullProposalOf } from "../../core/proposal_token.ts"; |
| @@ -109,27 +110,23 @@ export function pullContext(ctx: Ctx): { repo: Repo; pull: Pull } | Response { | ||
| 109 | 110 | * the person reading. |
| 110 | 111 | */ |
| 111 | 112 | export function wallCard(wall: Wall): Html { |
| 112 | return card( | |
| 113 | html`${icon("shield")} | |
| 114 | <div class="grow"> | |
| 115 | <div class="merge-headline"> | |
| 116 | ${wall.unsound !== undefined | |
| 117 | ? "This pull's contract does not read." | |
| 118 | : `This pull changes the policy: ${wall.loosened.length === 1 ? "one door opens" : `${wall.loosened.length} doors open`} wider.`} | |
| 119 | </div> | |
| 120 | <p class="merge-sub"> | |
| 121 | ${wall.unsound !== undefined | |
| 122 | ? "An app built on it does not boot. A person decides this one." | |
| 123 | : "A cell loosened is a decision undone, so the crew leaves this to a person: read the cells, then land or say what is off."} | |
| 124 | </p> | |
| 125 | <ul class="wall-cells"> | |
| 126 | ${(wall.unsound ?? wall.loosened.map(wallSentence)).map( | |
| 127 | (line) => html`<li>${line}</li>`, | |
| 128 | )} | |
| 129 | </ul> | |
| 130 | </div>`, | |
| 131 | { tone: "attn", extra: "merge-box wall" }, | |
| 132 | ); | |
| 113 | return mergeCard({ | |
| 114 | tone: "attn", | |
| 115 | extra: "wall", | |
| 116 | lead: icon("shield"), | |
| 117 | title: | |
| 118 | wall.unsound !== undefined | |
| 119 | ? html`This pull's contract does not read.` | |
| 120 | : `This pull changes the policy: ${wall.loosened.length === 1 ? "one door opens" : `${wall.loosened.length} doors open`} wider.`, | |
| 121 | meta: html`${wall.unsound !== undefined | |
| 122 | ? "An app built on it does not boot. A person decides this one." | |
| 123 | : "A cell loosened is a decision undone, so the crew leaves this to a person: read the cells, then land or say what is off."}`, | |
| 124 | after: html`<ul class="wall-cells"> | |
| 125 | ${(wall.unsound ?? wall.loosened.map(wallSentence)).map( | |
| 126 | (line) => html`<li>${line}</li>`, | |
| 127 | )} | |
| 128 | </ul>`, | |
| 129 | }); | |
| 133 | 130 | } |
| 134 | 131 | |
| 135 | 132 | // ---- verdicts, in the timeline ---- |
src/web/style/components.ts +14 −1
| @@ -452,7 +452,20 @@ details[open] > summary.row > .row-lead { transform: rotate(90deg); } | ||
| 452 | 452 | .setting-list .row-main { flex: 1 1 18rem; } |
| 453 | 453 | .setting-list .row-title, .setting-list .row-meta { white-space: normal; overflow: visible; overflow-wrap: anywhere; } |
| 454 | 454 | .setting-list .row-trail { flex: 0 1 auto; max-width: 100%; } |
| 455 | @media (max-width: 640px) { .setting-list .row-trail { flex-basis: 100%; } } | |
| 455 | .card[data-verdict] .row-trail form { align-items: center; gap: 8px; } | |
| 456 | /* A verdict card (the merge box) tints only its lead glyph; the title stays full-weight foreground. */ | |
| 457 | .card[data-verdict] .row-lead { color: var(--muted-fg); } | |
| 458 | .card[data-verdict][data-tone="success"] .row-lead { color: var(--success); } | |
| 459 | .card[data-verdict][data-tone="danger"] .row-lead { color: var(--danger); } | |
| 460 | .card[data-verdict][data-tone="merged"] .row-lead { color: var(--merged); } | |
| 461 | .card[data-verdict][data-tone="attn"] .row-lead { color: var(--attn); } | |
| 462 | @media (max-width: 640px) { | |
| 463 | .setting-list .row-trail { flex-basis: 100%; } | |
| 464 | /* A form in the trail takes the line, its controls sharing it: the primary action where the thumb is. */ | |
| 465 | .card[data-verdict] .row-trail form { flex: 1 1 100%; flex-wrap: wrap; } | |
| 466 | .card[data-verdict] .row-trail form select { flex: 1 1 140px; width: auto; } | |
| 467 | .card[data-verdict] .row-trail form .btn { flex: 1 1 180px; } | |
| 468 | } | |
| 456 | 469 | @media (pointer: coarse) { .row-actions { opacity: 1; } .row { min-height: 44px; } } |
| 457 | 470 | .row[data-state="closed"] .row-title, .row[data-state="merged"] .row-title { color: var(--muted-fg); } |
| 458 | 471 |
src/web/style/content.ts −21
| @@ -233,27 +233,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 233 | 233 | .bar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } |
| 234 | 234 | @media (max-width: 420px) { .bar .seg > a { padding: 0 8px; } } |
| 235 | 235 | |
| 236 | .merge-box { margin-top: 14px; } | |
| 237 | .merge-box .card-body { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; } | |
| 238 | /* Only the verdict glyph, never the merge button's own icon. */ | |
| 239 | .merge-box .card-body > .ico { margin-top: 2px; flex: none; color: var(--muted-fg); } | |
| 240 | .merge-box[data-tone="success"] .card-body > .ico { color: var(--success); } | |
| 241 | .merge-box[data-tone="danger"] .card-body > .ico { color: var(--danger); } | |
| 242 | .merge-box[data-tone="merged"] .card-body > .ico { color: var(--merged); } | |
| 243 | .merge-box .card-body > .grow { flex: 1 1 220px; } | |
| 244 | .merge-headline { font-weight: 600; text-wrap: pretty; } | |
| 245 | .merge-sub { color: var(--muted-fg); font-size: 13px; margin-top: 2px; text-wrap: pretty; } | |
| 246 | .merge-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: none; } | |
| 247 | .merge-form select { min-width: 150px; width: auto; } | |
| 248 | /* On a phone the sentence gets the width and the controls go under it, with | |
| 249 | the primary action full-width where the thumb already is. */ | |
| 250 | @media (max-width: 719px) { | |
| 251 | .merge-box .card-body > .grow { flex-basis: 100%; } | |
| 252 | .merge-box .merge-form, .merge-box .merge-form > form { width: 100%; } | |
| 253 | .merge-box .merge-form select { flex: 1 1 140px; } | |
| 254 | .merge-box .merge-form .btn { flex: 1 1 180px; } | |
| 255 | } | |
| 256 | ||
| 257 | 236 | .commit-head .card-body { padding: 14px 16px; } |
| 258 | 237 | .commit-body { |
| 259 | 238 | white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; |
test/pulls.test.ts +14
| @@ -125,6 +125,18 @@ describe("pull requests end to end", () => { | ||
| 125 | 125 | expect(pr).toContain("BETA"); |
| 126 | 126 | expect(pr).toMatch(/class="[^"]*\bwd\b/); // word-diff highlight present (possibly with a token class) |
| 127 | 127 | expect(pr).toContain("Ready to merge"); |
| 128 | // The merge box is §5's card and row, and the Ship form posts as before. | |
| 129 | for (const gone of ["merge-box", "merge-form", "merge-headline", "merge-sub"]) | |
| 130 | expect(pr).not.toContain(gone); | |
| 131 | ||
| 132 | // A signed-in writer gets the Ship form: strategy and the merge button. | |
| 133 | const mine = await ( | |
| 134 | await fetch(`${base}/dev/app/pulls/1/files`, { headers: { cookie } }) | |
| 135 | ).text(); | |
| 136 | expect(mine).toMatch( | |
| 137 | /<form method="post" action="\/dev\/app\/pulls\/1\/merge">[\s\S]*?name="strategy"[\s\S]*?Merge pull request[\s\S]*?<\/form>/, | |
| 138 | ); | |
| 139 | expect(mine).toContain('value="squash"'); | |
| 128 | 140 | }); |
| 129 | 141 | |
| 130 | 142 | test("merge the PR, base advances, PR shows merged", async () => { |
| @@ -220,6 +232,8 @@ describe("pull requests end to end", () => { | ||
| 220 | 232 | const pr = await (await fetch(`${base}${loc}/files`)).text(); |
| 221 | 233 | expect(pr).toContain("Can't merge"); |
| 222 | 234 | expect(pr).toContain("Conflicts"); |
| 235 | for (const gone of ["merge-box", "merge-form", "merge-headline", "merge-sub"]) | |
| 236 | expect(pr).not.toContain(gone); | |
| 223 | 237 | |
| 224 | 238 | // And the merge endpoint refuses. |
| 225 | 239 | const attempt = await fetch(`${base}${loc}/merge`, { |
new above
offline