Branch Strip

Where a branch merges, its size, conflicts, checks and the next step: Create PR or Merge.

main←maya/settings-dark-mode
Behind main by 2 commits

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/branch-strip

Usage

import { Button } from "./ui/uicontext/components/Button.ts"import { BranchStrip } from "./ui/uicontext/components/kit/BranchStrip.ts"import type { CheckRun } from "./ui/uicontext/components/kit/Checks.ts"
const Message = UiSchema.TaggedEnum({ ToggledChecks: { open: Schema.Boolean }, ClickedCreatePullRequest: {} })// above the composer: the actions are your buttons, the popover holds your Checksexport const Strip = (h: Html.H<typeof Message.Type>, checks: ReadonlyArray<CheckRun>, checksOpen: boolean) =>	BranchStrip(h, {		id: "ws-4", base: "main", head: "maya/settings-dark-mode", additions: 85, deletions: 12,		checks, checksOpen, toggledChecks: (open) => Message.ToggledChecks({ open }),		actions: [Button(h, { size: "sm", tone: "primary" }).on("click", Message.ClickedCreatePullRequest()).children("Create PR")],	})

API reference

Options

BranchStrip options
NameTypeDescription
idrequiredstringUnique on the page: names the checks' popover
baserequiredstring—
headrequiredstring—
additionsrequirednumber—
deletionsrequirednumber—
sync{ readonly state: "behind"; readonly commits: number } | { readonly state: "conflicts"; readonly files: number } | nullHow the branch stands against the base: behind by some commits, or with files in conflict
syncAction{ readonly label: string; readonly pressed: Message }The sync chip's button: "Update branch", "Resolve"
pullRequest{ readonly number: number; readonly state: "draft" | "open" | "merged" | "closed" } | nullThe pull request, once it's open
checksCheckRun[]—
checksOpenboolean—
toggledChecks(open: boolean) => Message—
checksPanelView.ChildrenWhat the checks' popover holds, as a list: [Checks(h, { ... })]
actionsView.Input—

Accessibility

  • The strip is a named group: the branch into its base, the change size in words, and how it stands against the base.
  • The checks chip is a real button that opens a popover; Escape or a press outside closes it and focus returns to the chip.

Source