Skip to content

Commit 618c464

Browse files
authored
fix(web): show completed pull request checks and align rows (pingdotgg#22090)
1 parent 2821004 commit 618c464

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

‎apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,15 @@ it("requires a new merge click after passing checks become pending and pass agai
156156
it.each<[PullRequestCheck["status"], PullRequestCheck["status"], string]>([
157157
["success", "skipped", ""],
158158
["failure", "cancelled", ""],
159-
["success", "action-required", ""],
159+
["success", "action-required", "1/2"],
160160
["success", "pending", "1/2"],
161+
["pending", "pending", "0/2"],
162+
["pending", "action-required", "0/2"],
163+
["skipped", "pending", "1/2"],
164+
["neutral", "pending", "1/2"],
161165
["failure", "pending", "1/2"],
162-
])("shows a count only while checks run (%s, %s)", (status, extraStatus, count) => {
166+
["cancelled", "pending", "1/2"],
167+
])("counts finished checks while work remains (%s, %s)", (status, extraStatus, count) => {
163168
state.status = status;
164169
state.extraStatus = extraStatus;
165170
act(() => {

‎apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,38 @@ function ChecksBody({
6868
const { attention, running, completed } = groupPullRequestChecks(checks);
6969
const canCollapse = attention.length + running.length > 0 && completed.length > 0;
7070
const visibleChecks = [...attention, ...running, ...(showAll || !canCollapse ? completed : [])];
71+
const hasDetails = visibleChecks.some((check) => check.url !== null);
7172
if (checks.length === 0) {
7273
return <p className="text-muted-foreground text-xs">No checks reported</p>;
7374
}
7475
return (
7576
<>
7677
<ScrollArea className="max-h-64">
77-
<ul className="flex flex-col gap-1">
78-
{}
78+
<ul
79+
className={cn(
80+
"grid gap-x-2 gap-y-1",
81+
hasDetails
82+
? "grid-cols-[auto_minmax(0,1fr)_auto_auto]"
83+
: "grid-cols-[auto_minmax(0,1fr)_auto]",
84+
)}
85+
>
7986
{visibleChecks.map((check, index) => (
80-
<li key={`${index}:${check.name}`} className="flex items-center gap-2 text-xs">
87+
<li
88+
key={`${index}:${check.name}`}
89+
className="col-span-full grid grid-cols-subgrid items-center text-xs"
90+
>
8191
<PullRequestCheckStatusIcon status={check.status} />
8292
<Tooltip>
83-
<TooltipTrigger
84-
render={<span className="min-w-0 flex-1 truncate">{check.name}</span>}
85-
/>
93+
<TooltipTrigger render={<span className="min-w-0 truncate">{check.name}</span>} />
8694
<TooltipPopup side="top">{check.description ?? check.name}</TooltipPopup>
8795
</Tooltip>
88-
<span className="shrink-0 text-muted-foreground">
96+
<span className="justify-self-end whitespace-nowrap text-muted-foreground">
8997
{pullRequestCheckStatusLabel(check)}
9098
</span>
9199
{check.url === null ? null : (
92100
<button
93101
type="button"
94-
className="shrink-0 text-primary hover:underline"
102+
className="text-primary hover:underline"
95103
onClick={() => {
96104
if (!check.url) return;
97105
void openLink(check.url).catch((error: unknown) => {
@@ -143,7 +151,9 @@ export function PullRequestChecksPopover({
143151
render?: React.ReactElement;
144152
}) {
145153
const presentation = pullRequestChecksStatePresentation(checksState);
146-
const runningCount = checks?.filter((check) => check.status === "pending").length ?? 0;
154+
const incompleteCount =
155+
checks?.filter((check) => check.status === "pending" || check.status === "action-required")
156+
.length ?? 0;
147157
const failedCount =
148158
checks?.filter((check) => check.status === "failure" || check.status === "cancelled").length ??
149159
0;
@@ -176,9 +186,9 @@ export function PullRequestChecksPopover({
176186
<presentation.Icon aria-hidden className={cn("size-3.5", presentation.toneClassName)} />
177187
{variant === "count" ? (
178188
<>
179-
{checks !== undefined && runningCount > 0 ? (
189+
{checks !== undefined && incompleteCount > 0 ? (
180190
<span className="tabular-nums">
181-
{runningCount}/{checks.length}
191+
{checks.length - incompleteCount}/{checks.length}
182192
</span>
183193
) : failedCount > 0 ? (
184194
<span className="tabular-nums">{failedCount} failed</span>

0 commit comments

Comments
 (0)