Skip to content
TypeScript

fix(web): show completed pull request checks and align rows (#22090)

Yash Singh618c46478a36
diff --git a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
index 47adb13580c..10ad05b12e3 100644
--- a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx
@@ -156,10 +156,15 @@ it("requires a new merge click after passing checks become pending and pass agai
it.each<[PullRequestCheck["status"], PullRequestCheck["status"], string]>([
["success", "skipped", ""],
["failure", "cancelled", ""],
- ["success", "action-required", ""],
+ ["success", "action-required", "1/2"],
["success", "pending", "1/2"],
+ ["pending", "pending", "0/2"],
+ ["pending", "action-required", "0/2"],
+ ["skipped", "pending", "1/2"],
+ ["neutral", "pending", "1/2"],
["failure", "pending", "1/2"],
-])("shows a count only while checks run (%s, %s)", (status, extraStatus, count) => {
+ ["cancelled", "pending", "1/2"],
+])("counts finished checks while work remains (%s, %s)", (status, extraStatus, count) => {
state.status = status;
state.extraStatus = extraStatus;
act(() => {
diff --git a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
index 49f70b23b73..dd3ac359a8e 100644
--- a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
@@ -68,30 +68,38 @@ function ChecksBody({
const { attention, running, completed } = groupPullRequestChecks(checks);
const canCollapse = attention.length + running.length > 0 && completed.length > 0;
const visibleChecks = [...attention, ...running, ...(showAll || !canCollapse ? completed : [])];
+ const hasDetails = visibleChecks.some((check) => check.url !== null);
if (checks.length === 0) {
return <p className="text-muted-foreground text-xs">No checks reported</p>;
}
return (
<>
<ScrollArea className="max-h-64">
- <ul className="flex flex-col gap-1">
- {}
+ <ul
+ className={cn(
+ "grid gap-x-2 gap-y-1",
+ hasDetails
+ ? "grid-cols-[auto_minmax(0,1fr)_auto_auto]"
+ : "grid-cols-[auto_minmax(0,1fr)_auto]",
+ )}
+ >
{visibleChecks.map((check, index) => (
- <li key={`${index}:${check.name}`} className="flex items-center gap-2 text-xs">
+ <li
+ key={`${index}:${check.name}`}
+ className="col-span-full grid grid-cols-subgrid items-center text-xs"
+ >
<PullRequestCheckStatusIcon status={check.status} />
<Tooltip>
- <TooltipTrigger
- render={<span className="min-w-0 flex-1 truncate">{check.name}</span>}
- />
+ <TooltipTrigger render={<span className="min-w-0 truncate">{check.name}</span>} />
<TooltipPopup side="top">{check.description ?? check.name}</TooltipPopup>
</Tooltip>
- <span className="shrink-0 text-muted-foreground">
+ <span className="justify-self-end whitespace-nowrap text-muted-foreground">
{pullRequestCheckStatusLabel(check)}
</span>
{check.url === null ? null : (
<button
type="button"
- className="shrink-0 text-primary hover:underline"
+ className="text-primary hover:underline"
onClick={() => {
if (!check.url) return;
void openLink(check.url).catch((error: unknown) => {
@@ -143,7 +151,9 @@ export function PullRequestChecksPopover({
render?: React.ReactElement;
}) {
const presentation = pullRequestChecksStatePresentation(checksState);
- const runningCount = checks?.filter((check) => check.status === "pending").length ?? 0;
+ const incompleteCount =
+ checks?.filter((check) => check.status === "pending" || check.status === "action-required")
+ .length ?? 0;
const failedCount =
checks?.filter((check) => check.status === "failure" || check.status === "cancelled").length ??
0;
@@ -176,9 +186,9 @@ export function PullRequestChecksPopover({
<presentation.Icon aria-hidden className={cn("size-3.5", presentation.toneClassName)} />
{variant === "count" ? (
<>
- {checks !== undefined && runningCount > 0 ? (
+ {checks !== undefined && incompleteCount > 0 ? (
<span className="tabular-nums">
- {runningCount}/{checks.length}
+ {checks.length - incompleteCount}/{checks.length}
</span>
) : failedCount > 0 ? (
<span className="tabular-nums">{failedCount} failed</span>