feat(web): refresh pull request details (#7148)

This commit is contained in:
maria authored and GitHub committed 2026-08-19 17:49:55 -04:00
1 parent 0508792c57
commit a850895f68
12 files changed
+740 -570

No files matched your search

-1
View File
@@ -6244,7 +6244,6 @@ function ChatViewContent(props: ChatViewProps) {
? "thread"
: "page"
}
chromeVariant="collapse"
composerDraftTarget={composerDraftTarget}
onStateChange={handlePullRequestTabStatusChange}
/>
@@ -0,0 +1,28 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vite-plus/test";
import { PanelLayoutControls } from "./PanelLayoutControls";
describe("PanelLayoutControls", () => {
it("keeps unavailable panel tooltip triggers interactive", () => {
const markup = renderToStaticMarkup(
<PanelLayoutControls
showTerminalControl
terminalAvailable={false}
terminalOpen={false}
terminalShortcutLabel={null}
rightPanelAvailable={false}
rightPanelOpen={false}
rightPanelShortcutLabel={null}
liveAgentCount={0}
onToggleTerminal={() => {}}
onToggleRightPanel={() => {}}
/>,
);
expect(markup.match(/data-slot="tooltip-trigger"/g)).toHaveLength(2);
expect(markup.match(/data-slot="tooltip-trigger"[^>]*><button[^>]*disabled=""/g)).toHaveLength(
2,
);
});
});
@@ -12,6 +12,7 @@ interface PanelLayoutControlsProps {
rightPanelAvailable: boolean;
rightPanelOpen: boolean;
rightPanelShortcutLabel: string | null;
rightPanelUnavailableLabel?: string;
/** Running + waiting subagents in this thread; badges the right panel toggle. */
liveAgentCount: number;
onToggleTerminal: () => void;
@@ -26,6 +27,7 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
rightPanelAvailable,
rightPanelOpen,
rightPanelShortcutLabel,
rightPanelUnavailableLabel = "Right panel is unavailable",
liveAgentCount,
onToggleTerminal,
onToggleRightPanel,
@@ -37,21 +39,19 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
>
{showTerminalControl ? (
<Tooltip>
<TooltipTrigger
render={
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={terminalOpen}
onPressedChange={onToggleTerminal}
aria-label="Toggle terminal drawer"
variant="ghost"
size="sm"
disabled={!terminalAvailable}
>
<PanelBottomIcon className="size-4" />
</Toggle>
}
/>
<TooltipTrigger render={<span className="flex shrink-0" />}>
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={terminalOpen}
onPressedChange={onToggleTerminal}
aria-label="Toggle terminal drawer"
variant="ghost"
size="sm"
disabled={!terminalAvailable}
>
<PanelBottomIcon className="size-4" />
</Toggle>
</TooltipTrigger>
<TooltipPopup side="bottom">
{terminalAvailable
? `Toggle terminal drawer${terminalShortcutLabel ? ` (${terminalShortcutLabel})` : ""}`
@@ -60,33 +60,31 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
</Tooltip>
) : null}
<Tooltip>
<TooltipTrigger
render={
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={rightPanelOpen}
onPressedChange={onToggleRightPanel}
aria-label={
liveAgentCount > 0
? `Toggle right panel, ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
: "Toggle right panel"
}
variant="ghost"
size="sm"
disabled={!rightPanelAvailable}
>
<PanelRightIcon className="size-4" />
{liveAgentCount > 0 ? (
<span
aria-hidden
className="absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-[9px] font-semibold tabular-nums text-white"
>
{liveAgentCount}
</span>
) : null}
</Toggle>
}
/>
<TooltipTrigger render={<span className="flex shrink-0" />}>
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={rightPanelOpen}
onPressedChange={onToggleRightPanel}
aria-label={
liveAgentCount > 0
? `Toggle right panel, ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
: "Toggle right panel"
}
variant="ghost"
size="sm"
disabled={!rightPanelAvailable}
>
<PanelRightIcon className="size-4" />
{liveAgentCount > 0 ? (
<span
aria-hidden
className="absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-[9px] font-semibold tabular-nums text-white"
>
{liveAgentCount}
</span>
) : null}
</Toggle>
</TooltipTrigger>
<TooltipPopup side="bottom">
{rightPanelAvailable
? `Toggle right panel${rightPanelShortcutLabel ? ` (${rightPanelShortcutLabel})` : ""}${
@@ -94,7 +92,7 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
? ` · ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
: ""
}`
: "Right panel is unavailable"}
: rightPanelUnavailableLabel}
</TooltipPopup>
</Tooltip>
</div>
File diff suppressed because it is too large. Load diff
@@ -45,13 +45,11 @@ export function PullRequestListGhost({
<GhostBar className="size-4 rounded-full" />
<div className="min-w-0 space-y-1.5">
<GhostBar className={cn("h-3.5", TITLE_WIDTHS[index % TITLE_WIDTHS.length])} />
<GhostBar
className={cn("bg-muted-foreground/10", META_WIDTHS[index % META_WIDTHS.length])}
/>
<GhostBar className={META_WIDTHS[index % META_WIDTHS.length]} />
</div>
<div className="flex flex-col items-end gap-1.5">
<GhostBar className="w-12" />
<GhostBar className="w-16 bg-muted-foreground/10" />
<GhostBar className="w-16" />
</div>
</div>
))}
@@ -59,32 +57,101 @@ export function PullRequestListGhost({
);
}
/** The summary's own shape: a title, a byline, the facts rows, the description. */
/**
* The detail panel's current expanded shape. Keeping the chrome, summary facts, and description
* boundaries in the ghost prevents the loaded pull request from replacing one layout with
* another a moment later.
*/
export function PullRequestDetailGhost() {
return (
<div
role="status"
aria-label="Loading pull request"
className="animate-ghost-pulse space-y-6 px-4 py-5"
className="animate-ghost-pulse flex h-full min-h-0 flex-col overflow-hidden bg-background"
>
<div className="space-y-2">
<GhostBar className="h-5 w-4/5" />
<GhostBar className="w-2/5 bg-muted-foreground/10" />
</div>
<div className="space-y-3">
{Array.from({ length: 4 }, (_, index) => (
<div key={index} className="flex items-center gap-3">
<GhostBar className="size-3.5 rounded-full" />
<GhostBar className="w-20 bg-muted-foreground/10" />
<GhostBar className={TITLE_WIDTHS[(index + 1) % TITLE_WIDTHS.length]} />
<div className="shrink-0 border-b border-border/60">
<div className="flex h-7 items-center justify-between gap-3 px-4">
<div className="flex min-w-0 flex-1 items-center gap-1.5">
<GhostBar className="w-24" />
<GhostBar className="w-9" />
</div>
))}
<div className="flex shrink-0 items-center gap-1">
<GhostBar className="h-5 w-16 rounded-md" />
<GhostBar className="size-5 rounded-md" />
</div>
</div>
<div className="px-4 pb-4 pt-1">
<GhostBar className="h-5 w-4/5 max-w-md" />
<div className="mt-2 flex items-center gap-1.5">
<GhostBar className="size-4 rounded-full" />
<GhostBar className="w-24" />
</div>
<div className="mt-4 flex min-w-0 items-center gap-2">
<GhostBar className="h-6 w-24 rounded-md" />
<GhostBar className="size-3 rounded-full" />
<GhostBar className="h-6 w-32 rounded-md" />
<div className="ml-auto flex shrink-0 items-center gap-2">
<GhostBar className="w-10" />
<GhostBar className="w-20" />
</div>
</div>
</div>
<div className="flex min-h-10 items-center justify-between gap-3 border-t border-border/60 px-4 py-2">
<div className="flex items-center gap-1 p-0.5">
<GhostBar className="h-6 w-16 rounded-md" />
<GhostBar className="h-6 w-16 rounded-md" />
<GhostBar className="h-6 w-12 rounded-md" />
</div>
<GhostBar className="w-20" />
</div>
</div>
<div className="space-y-2 pt-1">
<GhostBar className="w-full bg-muted-foreground/10" />
<GhostBar className="w-11/12 bg-muted-foreground/10" />
<GhostBar className="w-4/5 bg-muted-foreground/10" />
<GhostBar className="w-2/3 bg-muted-foreground/10" />
<div className="min-h-0 flex-1 overflow-hidden">
<section className="px-4 py-3">
<div className="grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2">
<div className="flex items-center gap-1.5">
<GhostBar className="size-3.5 rounded-full" />
<GhostBar className="w-14" />
</div>
<div className="flex items-center gap-1">
<GhostBar className="size-4 rounded-full" />
<GhostBar className="size-4 rounded-full" />
<GhostBar className="ml-1 size-5 rounded-md" />
</div>
</div>
<div className="grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2">
<div className="flex items-center gap-1.5">
<GhostBar className="size-3.5 rounded-full" />
<GhostBar className="w-10" />
</div>
<div className="flex items-center gap-1">
<GhostBar className="h-5 w-24 rounded-full" />
<GhostBar className="h-5 w-20 rounded-full" />
</div>
</div>
<div className="grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2">
<div className="flex items-center gap-1.5">
<GhostBar className="size-3.5 rounded-full" />
<GhostBar className="w-14" />
</div>
<GhostBar className="w-20" />
</div>
</section>
<section className="border-t border-border/60">
<div className="flex min-h-11 items-center gap-1.5 px-4 py-3">
<GhostBar className="h-4 w-24" />
<GhostBar className="size-3.5 rounded-full" />
</div>
<div className="space-y-2 px-4 pb-4">
<GhostBar className="w-full" />
<GhostBar className="w-11/12" />
<GhostBar className="w-4/5" />
<GhostBar className="w-2/3" />
</div>
</section>
</div>
</div>
);
@@ -113,7 +180,7 @@ export function PullRequestTimelineGhost({ rows = 6 }: { rows?: number }) {
<div key={index} className="relative pb-5">
<GhostBar className="absolute -left-[1.55rem] top-1 size-2 rounded-full" />
<GhostBar className={cn("h-3.5", TITLE_WIDTHS[index % TITLE_WIDTHS.length])} />
<GhostBar className="mt-1.5 w-16 bg-muted-foreground/10" />
<GhostBar className="mt-1.5 w-16" />
</div>
))}
</div>
@@ -134,8 +201,8 @@ export function PullRequestConversationGhost({ rows = 3 }: { rows?: number }) {
<GhostBar className="size-5 shrink-0 rounded-full" />
<div className="flex-1 space-y-1.5">
<GhostBar className={META_WIDTHS[index % META_WIDTHS.length]} />
<GhostBar className="w-full bg-muted-foreground/10" />
<GhostBar className="w-3/4 bg-muted-foreground/10" />
<GhostBar className="w-full" />
<GhostBar className="w-3/4" />
</div>
</div>
))}
@@ -25,6 +25,7 @@ import { cn } from "~/lib/utils";
import { getSourceControlPresentationForKind } from "~/sourceControlPresentation";
import { ProjectFavicon } from "../ProjectFavicon";
import { InputGroup, InputGroupAddon, InputGroupInput } from "../ui/input-group";
import { Button } from "../ui/button";
import {
Menu,
@@ -273,12 +274,14 @@ export function PullRequestFiltersMenu({
return (
<Menu>
<MenuTrigger
className={cn(
// The icon-button size that pairs with a full-height input, so the two read as one strip.
"relative inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-input text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground sm:size-8",
filtered && "text-foreground",
)}
aria-label="Filter pull requests"
render={
<Button
className={cn("relative", filtered && "[--control-icon-color:currentColor]")}
size="icon"
variant="outline"
aria-label="Filter pull requests"
/>
}
>
<ListFilterIcon className="size-4" />
{filtered ? (
@@ -220,12 +220,12 @@ function MetaRow({
children: ReactNode;
}) {
return (
<div className="flex items-center gap-2 py-1.5 text-xs">
<span className="flex w-24 shrink-0 items-center gap-1.5 text-muted-foreground">
<div className="grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 py-1.5 text-xs">
<span className="flex min-w-0 items-center gap-1.5 text-muted-foreground">
{icon}
{label}
</span>
<span className="min-w-0 flex-1 text-foreground">{children}</span>
<span className="min-w-0 text-foreground">{children}</span>
</div>
);
}
@@ -17,6 +17,7 @@ import {
handoffPrompt,
handoffReviewComments,
isPullRequestVerdictStale,
isStackedPullRequestBase,
isThreadOwnPullRequest,
latestPullRequestReviewOutcomes,
newestPullRequestCommitAt,
@@ -142,8 +143,6 @@ describe("pull request handoff labels", () => {
fixFinding: "Fix in this thread",
fixCheck: "Fix in this thread",
fixFindings: "Fix findings in this thread",
resolve: "Resolve in this thread",
resolveConflicts: "Resolve conflicts in this thread",
});
});
@@ -152,8 +151,6 @@ describe("pull request handoff labels", () => {
fixFinding: "Fix in a thread",
fixCheck: "Fix",
fixFindings: "Fix findings in a thread",
resolve: "Resolve in a new thread",
resolveConflicts: "Resolve conflicts in a thread",
});
});
});
@@ -167,6 +164,47 @@ describe("pull request composer target", () => {
});
});
describe("stacked pull request classification", () => {
it("requires a known default branch", () => {
expect(isStackedPullRequestBase("main", [{ name: "main", isDefault: false }])).toBe(false);
});
it("recognizes local and remote forms of the default branch", () => {
expect(
isStackedPullRequestBase("main", [{ name: "main", isDefault: true, isRemote: false }]),
).toBe(false);
expect(
isStackedPullRequestBase("main", [
{ name: "origin/main", isDefault: true, isRemote: true, remoteName: "origin" },
]),
).toBe(false);
});
it("classifies a non-default base as stacked once the default is known", () => {
expect(
isStackedPullRequestBase("feature-base", [
{ name: "origin/main", isDefault: true, isRemote: true, remoteName: "origin" },
]),
).toBe(true);
});
it("does not mistake a nested branch suffix for the default branch", () => {
expect(
isStackedPullRequestBase("main", [
{
name: "origin/feature/main",
isDefault: true,
isRemote: true,
remoteName: "origin",
},
]),
).toBe(true);
expect(
isStackedPullRequestBase("1.0", [{ name: "release/1.0", isDefault: true, isRemote: false }]),
).toBe(true);
});
});
describe("ordering comments", () => {
it("reverses the chronological list for newest first, and leaves oldest first alone", () => {
const comments = [{ createdAt: "a" }, { createdAt: "b" }, { createdAt: "c" }];
@@ -11,6 +11,7 @@ import type {
PullRequestReviewThread,
PullRequestState,
PullRequestUpdateMethod,
VcsRef,
} from "@t3tools/contracts";
import { inferReviewCommentFenceLanguage, type ReviewCommentContext } from "~/reviewCommentContext";
@@ -75,15 +76,11 @@ export function pullRequestHandoffLabels(inThisThread: boolean) {
fixFinding: "Fix in this thread",
fixCheck: "Fix in this thread",
fixFindings: "Fix findings in this thread",
resolve: "Resolve in this thread",
resolveConflicts: "Resolve conflicts in this thread",
}
: {
fixFinding: "Fix in a thread",
fixCheck: "Fix",
fixFindings: "Fix findings in a thread",
resolve: "Resolve in a new thread",
resolveConflicts: "Resolve conflicts in a thread",
};
}
@@ -103,6 +100,20 @@ export function pullRequestActionMenuHasGroup(
return showsDraftToggle || showsAutoMerge || showsMergeMethods;
}
export function isStackedPullRequestBase(
baseBranch: string,
refs: ReadonlyArray<Pick<VcsRef, "name" | "isDefault" | "isRemote" | "remoteName">>,
): boolean {
const defaultRef = refs.find((refName) => refName.isDefault);
if (!defaultRef) return false;
if (defaultRef.isRemote !== true) return defaultRef.name !== baseBranch;
const remotePrefix = `${defaultRef.remoteName ?? defaultRef.name.split("/")[0]}/`;
const defaultBranch = defaultRef.name.startsWith(remotePrefix)
? defaultRef.name.slice(remotePrefix.length)
: defaultRef.name;
return defaultBranch !== baseBranch;
}
/** Plain-language state, shown beside the author. Conflicts are a merge signal, not a state. */
export function describePullRequestState(state: PullRequestState, isDraft: boolean): string {
if (state === "merged") return "Merged";
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vite-plus/test";
import {
changeRequestRepositoryUrl,
findProjectForChangeRequest,
openPullRequestLink,
parseChangeRequestUrl,
@@ -8,6 +9,24 @@ import {
shouldOpenPullRequestExternally,
} from "./openPullRequestLink";
describe("changeRequestRepositoryUrl", () => {
it("preserves repository path casing", () => {
expect(
changeRequestRepositoryUrl(
"https://gitlab.example.test/Team/Platform/Repo/-/merge_requests/42/diffs#note_1",
),
).toBe("https://gitlab.example.test/Team/Platform/Repo");
});
it("keeps pull-like segments inside nested GitLab repository paths", () => {
expect(
changeRequestRepositoryUrl(
"https://gitlab.example.test/group/pull/123/repo/-/merge_requests/42",
),
).toBe("https://gitlab.example.test/group/pull/123/repo");
});
});
describe("openPullRequestLink", () => {
it("opens the requested pull request URL", async () => {
const openExternal = vi.fn(async () => undefined);
+17
View File
@@ -118,6 +118,23 @@ export function parseChangeRequestUrl(targetUrl: string): ChangeRequestLink | nu
return null;
}
/** The repository root behind a recognised change-request URL, without PR-specific state. */
export function changeRequestRepositoryUrl(targetUrl: string): string | null {
const changeRequest = parseChangeRequestUrl(targetUrl);
if (changeRequest === null) return null;
const url = new URL(targetUrl);
const repositoryPath =
/^(.*?)\/-\/merge_requests\/\d+(?:\/|$)/iu.exec(url.pathname)?.[1] ??
/^(.*?)(?:\/pull\/\d+|\/-\/merge_requests\/\d+|\/pull-requests\/\d+|\/pullrequest\/\d+)(?:\/|$)/iu.exec(
url.pathname,
)?.[1];
if (!repositoryPath) return null;
url.pathname = repositoryPath;
url.search = "";
url.hash = "";
return url.toString();
}
function claim(host: string, match: RegExpExecArray | null): ChangeRequestLink | null {
const repository = match?.[1];
const number = Number(match?.[2]);
+59 -48
View File
@@ -74,6 +74,9 @@ import {
WorkspaceBreadcrumbItem,
WorkspaceBreadcrumbSeparator,
} from "../components/WorkspaceBreadcrumb";
import { WorkspacePageContainer } from "../components/WorkspacePageContainer";
import { WorkspacePageHeader } from "../components/WorkspacePageHeader";
import { isElectron } from "../env";
import { PanelLayoutControls } from "../components/chat/PanelLayoutControls";
import { Button } from "../components/ui/button";
import { Menu, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuTrigger } from "../components/ui/menu";
@@ -100,7 +103,6 @@ import {
import { useAtomCommand } from "../state/use-atom-command";
import { cn } from "~/lib/utils";
import { getSourceControlPresentationForKind } from "~/sourceControlPresentation";
import { COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS } from "~/workspaceTitlebar";
export interface PullRequestsSearch {
readonly involvement: PullRequestInvolvement;
@@ -1181,6 +1183,7 @@ function PullRequestsRouteView() {
: null,
[search.number, search.repository, selectedProject],
);
const rightPanelAvailable = selectedPullRequestSurface !== null;
useEffect(() => {
if (!pullRequestsSupported || rightPanelRef === null || linkedSelection === null) return;
useRightPanelStore.getState().openPullRequest(rightPanelRef, linkedSelection);
@@ -1294,9 +1297,10 @@ function PullRequestsRouteView() {
terminalAvailable={false}
terminalOpen={false}
terminalShortcutLabel={null}
rightPanelAvailable={rightPanelState.surfaces.length > 0}
rightPanelAvailable={rightPanelAvailable}
rightPanelOpen={rightPanelState.isOpen}
rightPanelShortcutLabel={null}
rightPanelUnavailableLabel="Select a pull request first"
liveAgentCount={0}
onToggleTerminal={() => undefined}
onToggleRightPanel={toggleRightPanel}
@@ -1603,7 +1607,6 @@ function PullRequestsRouteView() {
reviewingQuery.refresh();
}}
onStateChange={handlePullRequestTabStatusChange}
chromeVariant="collapse"
/>
</RightPanelTabs>
) : null}
@@ -1612,10 +1615,7 @@ function PullRequestsRouteView() {
);
}
/**
* A compact stand-in for one pill group: the trigger wears the current choice, the choices
* live in a menu. Same options, same handler — only the footprint changes.
*/
/** A compact stand-in for one pill group when the header is narrow. */
function CompactFilterMenu<Value extends string>({
label,
value,
@@ -1627,7 +1627,8 @@ function CompactFilterMenu<Value extends string>({
options: ReadonlyArray<PullRequestFilterOption<Value>>;
onChange: (value: Value) => void;
}) {
const current = options.find((option) => option.value === value) ?? options[0]!;
const current = options.find((option) => option.value === value) ?? options[0];
if (!current) return null;
return (
<Menu>
<MenuTrigger
@@ -1640,15 +1641,12 @@ function CompactFilterMenu<Value extends string>({
<MenuPopup align="start" side="bottom" className="min-w-40">
<MenuRadioGroup value={value} onValueChange={(next) => onChange(next as Value)}>
{options.map((option) => {
// A host the server has already said it cannot read is not a choice here either.
// The pills disable it; a menu that offers it would answer the press by replacing
// a working list with the same failure the pill row exists to explain.
const item = (
<MenuRadioItem
key={option.value}
value={option.value}
className={option.unavailable ? "data-disabled:pointer-events-auto" : undefined}
disabled={option.unavailable !== undefined}
className="data-disabled:pointer-events-auto"
>
<span className="flex min-w-0 items-center gap-2">
<option.Icon aria-hidden className="size-3.5" />
@@ -1656,11 +1654,12 @@ function CompactFilterMenu<Value extends string>({
</span>
</MenuRadioItem>
);
if (!option.unavailable) return item;
return (
return option.unavailable === undefined ? (
item
) : (
<Tooltip key={option.value}>
<TooltipTrigger render={item} />
<TooltipPopup side="top" className="max-w-80">
<TooltipPopup side="right" className="max-w-64 break-words">
{option.unavailable}
</TooltipPopup>
</Tooltip>
@@ -1838,18 +1837,10 @@ function PullRequestsColumn({
// Painted flat like the chat column: the inset underneath carries the chrome grain, and a
// content surface that lets it show reads as a different background than every thread.
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background">
<header
className={cn(
"drag-region flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1.5 px-3 sm:px-5",
// A closed right panel leaves this column full-width, so its header runs
// underneath the native window controls on Windows; reserve the inset the
// way Settings and the chat view do. While the panel is open the column
// ends at the panel's left edge and the absolute controls strip (already
// WCO-aware) owns the top-right corner.
!rightPanelOpen && "wco:pr-[var(--workspace-native-controls-inset)]",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
{/* A closed right panel leaves this column full-width, so the shared header
reserves native window controls. While the panel is open, the column ends
at the panel and the absolute controls strip owns the top-right corner. */}
<WorkspacePageHeader electron={isElectron} reserveNativeControls={!rightPanelOpen}>
{condensed ? (
<WorkspaceBreadcrumb ariaLabel="Pull request scope">
{/* The page name remains the foreground anchor in both states; the live filters are
@@ -1891,27 +1882,22 @@ function PullRequestsColumn({
)}
<div className="min-w-0 flex-1" />
{condensed ? (
<ExpandableSearch
searchInput={searchInput}
searchValue={searchValue}
open={searchOpen}
onOpenChange={setSearchOpen}
focusToken={searchFocusToken}
onFocusWithin={(focused) => {
topbarSearchFocusedRef.current = focused;
}}
/>
<div className="flex shrink-0 items-center gap-1.5">
<ExpandableSearch
searchInput={searchInput}
searchValue={searchValue}
open={searchOpen}
onOpenChange={setSearchOpen}
focusToken={searchFocusToken}
onFocusWithin={(focused) => {
topbarSearchFocusedRef.current = focused;
}}
/>
<PullRequestRefreshControl compact refreshing={refreshing} onRefresh={onRefresh} />
</div>
) : null}
<Button
size="icon-sm"
variant="ghost"
aria-label="Refresh pull requests"
onClick={onRefresh}
>
<RefreshCwIcon className={cn("size-4", refreshing && "animate-spin")} />
</Button>
{rightPanelControl}
</header>
</WorkspacePageHeader>
<div
ref={scrollRef}
@@ -1920,19 +1906,44 @@ function PullRequestsColumn({
{/* The top padding is the fade band's own height (1.5rem here), the same pairing the
settings page makes: at rest the controls sit fully below the mask, and only
content actually passing under the chrome fades. */}
<div className="mx-auto flex w-full max-w-4xl flex-col gap-4 px-5 pt-6 pb-12">
<WorkspacePageContainer className="gap-4">
<div className="flex flex-col gap-3">
<div ref={inFlowSearchRef} className="flex items-center gap-2">
{searchInput}
{filtersMenu}
{!condensed ? (
<PullRequestRefreshControl refreshing={refreshing} onRefresh={onRefresh} />
) : null}
</div>
{/* Scrolled past this marker, the controls are gone and the title takes over. */}
<div ref={markerRef} aria-hidden className="-mt-3 h-px w-full" />
</div>
{listBody}
</div>
</WorkspacePageContainer>
</div>
</div>
);
}
function PullRequestRefreshControl({
compact = false,
refreshing,
onRefresh,
}: {
compact?: boolean;
refreshing: boolean;
onRefresh: () => void;
}) {
return (
<Button
size={compact ? "icon-sm" : "icon"}
variant={compact ? "ghost" : "outline"}
aria-label="Refresh pull requests"
onClick={onRefresh}
disabled={refreshing}
>
<RefreshCwIcon className={cn("size-4", refreshing && "animate-spin")} />
</Button>
);
}