Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dd5525de4 |
No files matched your search
@@ -6160,7 +6160,6 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
? "thread"
|
||||
: "page"
|
||||
}
|
||||
chromeVariant="collapse"
|
||||
composerDraftTarget={composerDraftTarget}
|
||||
onStateChange={handlePullRequestTabStatusChange}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ChevronDownIcon } from "lucide-react";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { Button } from "./ui/button";
|
||||
import { Menu, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuTrigger } from "./ui/menu";
|
||||
@@ -6,6 +7,8 @@ import { Menu, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuTrigger } from "./u
|
||||
export interface HeaderFilterMenuOption<Value extends string> {
|
||||
value: Value;
|
||||
label: string;
|
||||
icon?: ReactNode;
|
||||
disabledReason?: string;
|
||||
}
|
||||
|
||||
export function HeaderFilterMenu<Value extends string>({
|
||||
@@ -38,8 +41,22 @@ export function HeaderFilterMenu<Value extends string>({
|
||||
<MenuPopup align={align} side="bottom" className={popupClassName ?? "min-w-40"}>
|
||||
<MenuRadioGroup value={current.value} onValueChange={(next) => onChange(next as Value)}>
|
||||
{options.map((option) => (
|
||||
<MenuRadioItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
<MenuRadioItem
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
disabled={option.disabledReason !== undefined}
|
||||
>
|
||||
<span className="flex min-w-0 flex-1 items-center gap-2">
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
{option.icon}
|
||||
{option.label}
|
||||
</span>
|
||||
{option.disabledReason !== undefined ? (
|
||||
<span className="ms-auto text-xs text-muted-foreground">
|
||||
{option.disabledReason || "Unavailable"}
|
||||
</span>
|
||||
) : null}
|
||||
</span>
|
||||
</MenuRadioItem>
|
||||
))}
|
||||
</MenuRadioGroup>
|
||||
|
||||
@@ -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,
|
||||
@@ -94,7 +96,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,
|
||||
@@ -261,12 +262,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 ? (
|
||||
|
||||
@@ -196,12 +196,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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
groupPullRequestTimelineConversations,
|
||||
handoffPrompt,
|
||||
handoffReviewComments,
|
||||
isStackedPullRequestBase,
|
||||
isThreadOwnPullRequest,
|
||||
orderPullRequestComments,
|
||||
pullRequestActionMenuHasGroup,
|
||||
@@ -101,6 +102,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" }];
|
||||
|
||||
@@ -10,6 +10,7 @@ import type {
|
||||
PullRequestReviewThread,
|
||||
PullRequestState,
|
||||
PullRequestUpdateMethod,
|
||||
VcsRef,
|
||||
} from "@t3tools/contracts";
|
||||
|
||||
import { inferReviewCommentFenceLanguage, type ReviewCommentContext } from "~/reviewCommentContext";
|
||||
@@ -73,6 +74,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);
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -13,7 +13,6 @@ import type {
|
||||
} from "@t3tools/contracts";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import {
|
||||
ChevronDownIcon,
|
||||
EyeIcon,
|
||||
MonitorIcon,
|
||||
ServerIcon,
|
||||
@@ -69,14 +68,20 @@ import { PullRequestListGhost } from "../components/pullRequest/PullRequestGhost
|
||||
import { PullRequestRow } from "../components/pullRequest/PullRequestRow";
|
||||
import { PullRequestsUnavailableState } from "../components/pullRequest/PullRequestsUnavailableState";
|
||||
import { RightPanelTabs, type PullRequestTabStatus } from "../components/RightPanelTabs";
|
||||
import { HeaderFilterMenu, type HeaderFilterMenuOption } from "../components/HeaderFilterMenu";
|
||||
import {
|
||||
WorkspaceBreadcrumb,
|
||||
WorkspaceBreadcrumbItem,
|
||||
WorkspaceBreadcrumbSeparator,
|
||||
} from "../components/WorkspaceBreadcrumb";
|
||||
import {
|
||||
WorkspacePageContainer,
|
||||
WorkspacePageHeader,
|
||||
WorkspacePageHeaderEdgeControl,
|
||||
} from "../components/WorkspacePageContainer";
|
||||
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";
|
||||
import { SidebarInset } from "../components/ui/sidebar";
|
||||
import { useLiveRefresh } from "../hooks/useLiveRefresh";
|
||||
import {
|
||||
@@ -99,7 +104,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 +1185,17 @@ function PullRequestsRouteView() {
|
||||
: null,
|
||||
[search.number, search.repository, selectedProject],
|
||||
);
|
||||
const linkedSelectionMatchesSurface =
|
||||
linkedSelection !== null &&
|
||||
selectedPullRequestSurface !== null &&
|
||||
linkedSelection.environmentId === selectedPullRequestSurface.environmentId &&
|
||||
linkedSelection.projectId === selectedPullRequestSurface.projectId &&
|
||||
linkedSelection.repository === selectedPullRequestSurface.repository &&
|
||||
linkedSelection.number === selectedPullRequestSurface.number;
|
||||
// A closed panel keeps its tabs so reopening does not discard work. Those retained tabs are
|
||||
// history, though, not a current selection: without this check they leave the toggle looking
|
||||
// available after the selected pull request has been cleared.
|
||||
const rightPanelAvailable = activePullRequestSurface !== null || linkedSelectionMatchesSurface;
|
||||
useEffect(() => {
|
||||
if (!pullRequestsSupported || rightPanelRef === null || linkedSelection === null) return;
|
||||
useRightPanelStore.getState().openPullRequest(rightPanelRef, linkedSelection);
|
||||
@@ -1294,9 +1309,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 +1619,6 @@ function PullRequestsRouteView() {
|
||||
reviewingQuery.refresh();
|
||||
}}
|
||||
onStateChange={handlePullRequestTabStatusChange}
|
||||
chromeVariant="collapse"
|
||||
/>
|
||||
</RightPanelTabs>
|
||||
) : null}
|
||||
@@ -1612,10 +1627,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.
|
||||
*/
|
||||
/** Adapts pull-request filter metadata to the shared header menu. */
|
||||
function CompactFilterMenu<Value extends string>({
|
||||
label,
|
||||
value,
|
||||
@@ -1627,37 +1639,18 @@ function CompactFilterMenu<Value extends string>({
|
||||
options: ReadonlyArray<PullRequestFilterOption<Value>>;
|
||||
onChange: (value: Value) => void;
|
||||
}) {
|
||||
const current = options.find((option) => option.value === value) ?? options[0]!;
|
||||
const headerOptions = useMemo<ReadonlyArray<HeaderFilterMenuOption<Value>>>(
|
||||
() =>
|
||||
options.map((option) => ({
|
||||
value: option.value,
|
||||
label: option.label,
|
||||
icon: <option.Icon aria-hidden className="size-3.5" />,
|
||||
...(option.unavailable !== undefined ? { disabledReason: option.unavailable } : {}),
|
||||
})),
|
||||
[options],
|
||||
);
|
||||
return (
|
||||
<Menu>
|
||||
<MenuTrigger
|
||||
aria-label={label}
|
||||
className="inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
{current.label}
|
||||
<ChevronDownIcon aria-hidden className="size-3 text-muted-foreground/70" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" side="bottom" className="min-w-40">
|
||||
<MenuRadioGroup value={value} onValueChange={(next) => onChange(next as Value)}>
|
||||
{options.map((option) => (
|
||||
<MenuRadioItem
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
// 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.
|
||||
disabled={option.unavailable !== undefined}
|
||||
title={option.unavailable}
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<option.Icon aria-hidden className="size-3.5" />
|
||||
{option.label}
|
||||
</span>
|
||||
</MenuRadioItem>
|
||||
))}
|
||||
</MenuRadioGroup>
|
||||
</MenuPopup>
|
||||
</Menu>
|
||||
<HeaderFilterMenu label={label} value={value} options={headerOptions} onChange={onChange} />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1827,18 +1820,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
|
||||
@@ -1880,27 +1865,24 @@ 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>
|
||||
{rightPanelControl ? (
|
||||
<WorkspacePageHeaderEdgeControl>{rightPanelControl}</WorkspacePageHeaderEdgeControl>
|
||||
) : null}
|
||||
</WorkspacePageHeader>
|
||||
|
||||
<div
|
||||
ref={scrollRef}
|
||||
@@ -1909,19 +1891,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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user