diff --git a/ui/src/components/agents/AgentGitPanel.tsx b/ui/src/components/agents/AgentGitPanel.tsx index ce8a1841..daa3c784 100644 --- a/ui/src/components/agents/AgentGitPanel.tsx +++ b/ui/src/components/agents/AgentGitPanel.tsx @@ -10,11 +10,9 @@ import { useFileTreeSelection, } from "@pierre/trees/react" import { - ArrowSquareOutIcon, ArrowsInIcon, ArrowsOutIcon, CaretDownIcon, - GitPullRequestIcon, SidebarSimpleIcon, } from "@phosphor-icons/react" import type { FileContents } from "@pierre/diffs/react" @@ -26,6 +24,7 @@ import type { ChangedFileSummaryItem } from "@/components/agents/messages" import { agentsApi } from "@/lib/agents/api" import { useAgentThreadPrDiff } from "@/lib/agents/queries" import { ReviewTab } from "@/components/agents/ReviewTab" +import { PrHeader } from "@/components/agents/PrHeader" import { buttonVariants } from "@/components/ui/button" import { DIFF_VIRTUALIZER_CONFIG, @@ -518,38 +517,16 @@ export function AgentGitPanel({ ) : ( <> {pr && ( -
-
-
-
- {pr.title} #{pr.number} -
-
- - - {pr.state} - - - {pr.headRef} → {pr.baseRef} - -
-
- {pr.url && ( - - - View PR - - )} -
-
+ )}
diff --git a/ui/src/components/agents/PrHeader.tsx b/ui/src/components/agents/PrHeader.tsx new file mode 100644 index 00000000..347231c0 --- /dev/null +++ b/ui/src/components/agents/PrHeader.tsx @@ -0,0 +1,88 @@ +import { GitPullRequestIcon } from "@phosphor-icons/react" + +import { cn } from "@/lib/utils" + +const STATE_STYLES: Record = { + open: "border-emerald-600/40 text-emerald-500", + draft: "border-border text-muted-foreground", + merged: "border-purple-600/40 text-purple-500", + closed: "border-red-600/40 text-red-500", +} + +export interface PrHeaderProps { + url: string + title: string + state: string + headRef: string + baseRef: string + number?: number | null + author?: string | null + stats?: { + changedFiles: number + additions: number + deletions: number + } | null + className?: string + titleClassName?: string +} + +export function PrHeader({ + url, + title, + state, + headRef, + baseRef, + number, + author, + stats, + className, + titleClassName, +}: PrHeaderProps) { + return ( +
+ + + {state} + +

+ + {title} + {number != null && ( + #{number} + )} + +

+
+ {author && ( + {author} + )} + + {baseRef} + + ← + + {headRef} + + {stats && ( + <> + + {stats.changedFiles} file{stats.changedFiles === 1 ? "" : "s"} + + +{stats.additions} + -{stats.deletions} + + )} +
+
+ ) +} diff --git a/ui/src/components/agents/ReviewMainBody.tsx b/ui/src/components/agents/ReviewMainBody.tsx index 9fa30a78..a58fe86a 100644 --- a/ui/src/components/agents/ReviewMainBody.tsx +++ b/ui/src/components/agents/ReviewMainBody.tsx @@ -22,7 +22,6 @@ import { CodeIcon, CopyIcon, FlagIcon, - GitPullRequestIcon, InfoIcon, LinkIcon, ListBulletsIcon, @@ -68,6 +67,7 @@ import type { import type { ChatAttachment } from "@/components/agents/ReviewChat" import type { DiffStyle } from "@/components/agents/utils/diffUtils" import { Markdown } from "@/components/agents/ported" +import { PrHeader } from "@/components/agents/PrHeader" import { ReviewChat, ReviewChatComposerProvider, @@ -1120,7 +1120,19 @@ function ReviewBodyInner({ config={DIFF_VIRTUALIZER_CONFIG} >
- +
{detail.pr.body ? ( = { - open: "border-emerald-600/40 text-emerald-500", - draft: "border-border text-muted-foreground", - merged: "border-purple-600/40 text-purple-500", - closed: "border-red-600/40 text-red-500", - } - return ( -
- - - {pr.state} - -

- - {pr.title} - -

-
- {pr.author && ( - {pr.author.login} - )} - - {pr.base_ref} - - ← - - {pr.head_ref} - - - {pr.changed_files} file{pr.changed_files === 1 ? "" : "s"} - - +{pr.additions} - -{pr.deletions} -
-
- ) -} - function GroupHeader({ group }: { group: ResolvedGroup }) { return (