fix(web): collapse PR header actions to icons when narrow (#9334)

Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
mariaandmaria-rcks authored and GitHub committed 2026-09-03 00:21:27 -04:00
1 parent 5f84efa1ec
commit 2a3cfe4563
1 file changed
+179 -54
@@ -1296,8 +1296,8 @@ export function PullRequestDetailPanel({
return (
<div className="flex h-full min-h-0 w-full flex-col bg-background">
<div className="grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60">
<div className="ml-4 grid h-7 min-w-0 items-center">
<div className="@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60">
<div className="ml-4 grid h-7 min-w-0 items-center overflow-hidden">
<div
aria-hidden={condensed}
inert={condensed}
@@ -1402,7 +1402,7 @@ export function PullRequestDetailPanel({
) : null}
</div>
</div>
<div className="mr-4 flex h-7 min-w-0 flex-nowrap items-center justify-end gap-1">
<div className="mr-4 flex h-7 shrink-0 items-center justify-end gap-1">
{detail ? (
<>
{/* Checking a pull request out is the reason to open one here at all, so it is a
@@ -1415,9 +1415,17 @@ export function PullRequestDetailPanel({
<MenuTrigger
disabled={handoff !== null}
render={
<Button size="xs" variant="outline">
<Button
size="xs"
variant="outline"
aria-label={
handoff?.startsWith("checkout") ? "Checking out..." : "Check out"
}
>
<GitBranchIcon aria-hidden className="size-3.5" />
{handoff?.startsWith("checkout") ? "Checking out..." : "Check out"}
<span className="@max-[35rem]/pr-header:hidden">
{handoff?.startsWith("checkout") ? "Checking out..." : "Check out"}
</span>
<ChevronDownIcon aria-hidden className="size-3.5 text-muted-foreground" />
</Button>
}
@@ -1453,17 +1461,39 @@ export function PullRequestDetailPanel({
</Menu>
) : null}
{workflowApprovalsRequired > 0 && can("approve-workflows") ? (
<Button
size="xs"
variant="warning-outline"
disabled={actionPending}
onClick={() => setConfirmation({ open: true, action: "approve-workflows" })}
>
<PlayIcon className="size-3.5" />
{pendingAction === "approve-workflows"
? "Approving..."
: "Approve workflows to run"}
</Button>
<Tooltip>
<TooltipTrigger
render={
<span className="inline-flex shrink-0">
<Button
size="xs"
variant="warning-outline"
disabled={actionPending}
onClick={() =>
setConfirmation({ open: true, action: "approve-workflows" })
}
aria-label={
pendingAction === "approve-workflows"
? "Approving..."
: "Approve workflows to run"
}
>
<PlayIcon aria-hidden className="size-3.5" />
<span className="@max-[40rem]/pr-header:hidden">
{pendingAction === "approve-workflows"
? "Approving..."
: "Approve workflows to run"}
</span>
</Button>
</span>
}
/>
<TooltipPopup side="top">
{pendingAction === "approve-workflows"
? "Approving..."
: "Approve workflows to run"}
</TooltipPopup>
</Tooltip>
) : null}
{/* Said where the Merge button is, because it is the answer to why nobody has
pressed it: the merge is already asked for, and the host is holding it. */}
@@ -1471,62 +1501,150 @@ export function PullRequestDetailPanel({
<Tooltip>
<TooltipTrigger
render={
<Badge size="control" variant="info">
<Badge
size="control"
variant="info"
role="img"
aria-label={armedAutoMergeLabel}
>
<GitMergeIcon aria-hidden className="size-3.5" />
{armedAutoMergeLabel}
<span className="@max-[30rem]/pr-header:hidden">{armedAutoMergeLabel}</span>
</Badge>
}
/>
<TooltipPopup side="top">
The host will merge this on its own once its requirements are met
{armedAutoMergeLabel}: the host will merge this on its own once its requirements
are met
</TooltipPopup>
</Tooltip>
) : null}
{primaryAction === "resolve" ? (
<Button
size="xs"
variant="destructive-outline"
disabled={handoff !== null}
onClick={startResolveConflicts}
>
<TriangleAlertIcon className="size-3.5" />
{handoff === "conflicts" ? "Preparing..." : "Resolve conflicts"}
</Button>
<Tooltip>
<TooltipTrigger
render={
<span className="inline-flex shrink-0">
<Button
size="xs"
variant="destructive-outline"
disabled={handoff !== null}
onClick={startResolveConflicts}
aria-label={
handoff === "conflicts" ? "Preparing..." : "Resolve conflicts"
}
>
<TriangleAlertIcon aria-hidden className="size-3.5" />
<span className="@max-[30rem]/pr-header:hidden">
{handoff === "conflicts" ? "Preparing..." : "Resolve conflicts"}
</span>
</Button>
</span>
}
/>
<TooltipPopup side="top">
{handoff === "conflicts" ? "Preparing..." : "Resolve conflicts"}
</TooltipPopup>
</Tooltip>
) : primaryAction === "ready" ? (
<Button size="xs" disabled={actionPending} onClick={() => void perform("ready")}>
Ready for review
</Button>
<Tooltip>
<TooltipTrigger
render={
<span className="inline-flex shrink-0">
<Button
size="xs"
disabled={actionPending}
onClick={() => void perform("ready")}
aria-label="Ready for review"
>
<GitPullRequestIcon
aria-hidden
className="hidden size-3.5 @max-[30rem]/pr-header:inline"
/>
<span className="@max-[30rem]/pr-header:hidden">Ready for review</span>
</Button>
</span>
}
/>
<TooltipPopup side="top">Ready for review</TooltipPopup>
</Tooltip>
) : primaryAction === "enable-auto-merge" ? (
<Button
size="xs"
disabled={actionPending}
onClick={() => setConfirmation({ open: true, action: "enable-auto-merge" })}
>
<GitMergeIcon className="size-3.5" />
{pendingAction === "enable-auto-merge" ? "Enabling..." : pendingAutoMergeLabel}
</Button>
<Tooltip>
<TooltipTrigger
render={
<span className="inline-flex shrink-0">
<Button
size="xs"
disabled={actionPending}
onClick={() =>
setConfirmation({ open: true, action: "enable-auto-merge" })
}
aria-label={
pendingAction === "enable-auto-merge"
? "Enabling..."
: pendingAutoMergeLabel
}
>
<GitMergeIcon aria-hidden className="size-3.5" />
<span className="@max-[30rem]/pr-header:hidden">
{pendingAction === "enable-auto-merge"
? "Enabling..."
: pendingAutoMergeLabel}
</span>
</Button>
</span>
}
/>
<TooltipPopup side="top">
{pendingAction === "enable-auto-merge" ? "Enabling..." : pendingAutoMergeLabel}
</TooltipPopup>
</Tooltip>
) : primaryAction === "auto-merge-armed" ? (
<Tooltip>
<TooltipTrigger
render={
<Badge size="control" variant="info">
<GitMergeIcon className="size-3.5" />
{armedAutoMergeLabel}
<Badge
size="control"
variant="info"
role="img"
aria-label={armedAutoMergeLabel}
>
<GitMergeIcon aria-hidden className="size-3.5" />
<span className="@max-[30rem]/pr-header:hidden">{armedAutoMergeLabel}</span>
</Badge>
}
/>
<TooltipPopup side="top">
The host will merge this on its own once its requirements are met
{armedAutoMergeLabel}: the host will merge this on its own once its requirements
are met
</TooltipPopup>
</Tooltip>
) : primaryAction === "merge" ? (
<Button
size="xs"
disabled={actionPending}
onClick={() => setConfirmation({ open: true, action: "merge" })}
>
{pendingAction === "merge" ? "Merging..." : selectedMergeMethodLabel}
</Button>
<Tooltip>
<TooltipTrigger
render={
<span className="inline-flex shrink-0">
<Button
size="xs"
disabled={actionPending}
onClick={() => setConfirmation({ open: true, action: "merge" })}
aria-label={
pendingAction === "merge" ? "Merging..." : selectedMergeMethodLabel
}
>
<GitMergeIcon
aria-hidden
className="hidden size-3.5 @max-[30rem]/pr-header:inline"
/>
<span className="@max-[30rem]/pr-header:hidden">
{pendingAction === "merge" ? "Merging..." : selectedMergeMethodLabel}
</span>
</Button>
</span>
}
/>
<TooltipPopup side="top">
{pendingAction === "merge" ? "Merging..." : selectedMergeMethodLabel}
</TooltipPopup>
</Tooltip>
) : (primaryAction === "merged" || primaryAction === "closed") &&
statePresentation !== null ? (
<Badge size="control" variant="outline" className={statePresentation.toneClassName}>
@@ -1857,10 +1975,17 @@ export function PullRequestDetailPanel({
{detail ? (
<div className="col-span-2 mt-1 min-w-0 px-4 pb-4">
{titleDraft === null ? (
<div className="group flex min-w-0 items-start gap-1">
<h1 className="min-w-0 flex-1 text-base font-semibold leading-snug">
{detail.title}
</h1>
<div className="group flex min-w-0 items-center gap-1">
<Tooltip>
<TooltipTrigger
render={
<h1 className="min-w-0 flex-1 truncate text-base font-semibold leading-snug">
{detail.title}
</h1>
}
/>
<TooltipPopup side="top">{detail.title}</TooltipPopup>
</Tooltip>
{canEditPullRequestChangeRequest(detail) ? (
<Button
size="icon-xs"