Skip to content

g1t/apps/web/app/components/checks.tsx

39 lines1,521 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Fast pages, required checks on the branch, self-hosted runners, honest incidents1import { CircleCheck, CircleX, LoaderCircle, TriangleAlert } from "lucide-react";
Acceptance checks in sandboxes, line comments and review verdicts2
Fast pages, required checks on the branch, self-hosted runners, honest incidents3import type { CheckStatus } from "@g1t/contracts";
Acceptance checks in sandboxes, line comments and review verdicts4
Merge branch 'worktree-agent-ae1299e92e4462012'5import { Hint } from "./ui/hint";
6
Fast pages, required checks on the branch, self-hosted runners, honest incidents7/**
8 * What a pull request's own check status says. A pull request's checks are
9 * the workflows run on it (see the merge box); this is set when the merge
10 * queue took it out, and on older pull requests, by commands their issue
11 * once had run.
12 */
Acceptance checks in sandboxes, line comments and review verdicts13const LABELS: Record<CheckStatus, string> = {
14 queued: "Checks queued",
15 running: "Checks running",
16 passed: "Checks passed",
Fast pages, required checks on the branch, self-hosted runners, honest incidents17 failed: "Failed in the merge queue",
Acceptance checks in sandboxes, line comments and review verdicts18 errored: "Checks could not run",
19};
20
21export function CheckIcon({ status, size = 15 }: { status: CheckStatus; size?: number }) {
Merge branch 'worktree-agent-ad7c6d88d93adc817'22 if (status === "passed") return <CircleCheck size={size} className="shrink-0 text-success" />;
Acceptance checks in sandboxes, line comments and review verdicts23 if (status === "failed") return <CircleX size={size} className="shrink-0 text-danger" />;
24 if (status === "errored") return <TriangleAlert size={size} className="shrink-0 text-muted" />;
25 return <LoaderCircle size={size} className="shrink-0 animate-spin text-info" />;
26}
27
28/** The state of a pull request's checks at a glance, for lists. */
29export function CheckBadge({ status }: { status: CheckStatus | null }) {
30 if (!status) return null;
31 return (
Merge branch 'worktree-agent-ae1299e92e4462012'32 <Hint label={LABELS[status]}>
33 <span className="flex shrink-0 items-center gap-1 text-xs text-muted">
34 <CheckIcon status={status} size={13} />
35 <span className="sr-only">{LABELS[status]}</span>
36 </span>
37 </Hint>
Acceptance checks in sandboxes, line comments and review verdicts38 );
39}

This file's history is long; its oldest lines are credited to the oldest commit read.