Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🎛️ fix: Polish the Pull Request Chip and Card Header (#16860)
Marco Beretta35e29ee67842
diff --git a/client/src/components/Chat/PullRequest/Card.tsx b/client/src/components/Chat/PullRequest/Card.tsxindex dcb5e1d9fa..08f2d3e799 100644--- a/client/src/components/Chat/PullRequest/Card.tsx+++ b/client/src/components/Chat/PullRequest/Card.tsx@@ -55,7 +55,7 @@ function PullRequestCard({rel="noopener noreferrer"aria-label={openLabel}data-testid="pull-request-github-link"- className="text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:ring-text-primary flex size-7 shrink-0 items-center justify-center rounded-md outline-hidden focus-visible:ring-2"+ className="text-text-secondary hover:text-text-primary focus-visible:ring-text-primary flex size-7 shrink-0 items-center justify-center rounded-md outline-hidden focus-visible:ring-2 [&_svg]:size-4"><GithubIcon /></a>diff --git a/client/src/components/Chat/PullRequest/Chip.tsx b/client/src/components/Chat/PullRequest/Chip.tsxindex fbd5763748..ca0de7ebf7 100644--- a/client/src/components/Chat/PullRequest/Chip.tsx+++ b/client/src/components/Chat/PullRequest/Chip.tsx@@ -1,52 +1,25 @@import { memo } from 'react';import * as Ariakit from '@ariakit/react';import { useConversationPullRequestQuery } from '~/data-provider';-import { useAgentsMapContext, useChatContext } from '~/Providers';import { TONE_DOT_CLASS, presentPullRequest } from './status';-import { URLIcon } from '~/components/Endpoints/URLIcon';+import PullRequestPanel, { panelBelowClass } from './Panel';import { summarizePullRequest } from './summary';-import PullRequestPanel from './Panel';import { useLocalize } from '~/hooks';import PullRequestIcon from './Icon';import CiDot from './CiDot';-/** The agent's picture with the CI dot on its corner. */-function AgentAvatar({- avatar,- name,- dotClass,-}: {- avatar: string;- name?: string | null;- dotClass: string | null;-}) {- return (- <span className="relative flex size-6 shrink-0 items-center justify-center" aria-hidden="true">- <URLIcon- iconURL={avatar}- altName={name}- className="size-6 overflow-hidden rounded-md"- containerStyle={{ width: 24, height: 24 }}- />- {dotClass != null && <CiDot dotClass={dotClass} />}- </span>- );-}-/*** Desktop header control for the pull request a code conversation opened. It renders nothing* until a pull request is known: a conversation without one, a disabled feature and a failed* first lookup all leave the header exactly as it was, so the row never shifts. The details- * open to the right of the chip on hover or keyboard focus and slide in from the left. The card+ * open below the chip on hover or keyboard focus and slide down. The card* holds a link, so it is an Ariakit hovercard: it stays open while the pointer or focus is* inside it, and Tab moves from the chip into it.*/function PullRequestChip({ conversationId }: { conversationId: string }) {const localize = useLocalize();- const { conversation } = useChatContext();- const agentsMap = useAgentsMapContext();const hovercard = Ariakit.useHovercardStore({- placement: 'right-start',+ placement: 'bottom-start',showTimeout: 100,hideTimeout: 150,});@@ -59,12 +32,6 @@ function PullRequestChip({ conversationId }: { conversationId: string }) {const view = presentPullRequest(pullRequest);const label = summarizePullRequest(pullRequest, localize);const dotClass = view.dotTone == null ? null : TONE_DOT_CLASS[view.dotTone];- /** The chat state can lag the route by a render; only its own conversation's agent applies. */- const agentId =- conversation?.conversationId === conversationId ? conversation.agent_id : undefined;- const agent = agentId == null ? undefined : agentsMap?.[agentId];- const avatar = agent?.avatar?.filepath ?? '';- const hasAvatar = avatar !== '';return (<Ariakit.HovercardProvider store={hovercard}>@@ -77,10 +44,9 @@ function PullRequestChip({ conversationId }: { conversationId: string }) {onFocus={() => hovercard.show()}className="border-border-light bg-presentation text-text-primary hover:bg-surface-tertiary aria-expanded:bg-surface-tertiary inline-flex h-9 max-w-[14rem] min-w-0 flex-shrink items-center gap-1.5 rounded-xl border px-2 text-sm transition-all ease-in-out">- {hasAvatar && <AgentAvatar avatar={avatar} name={agent?.name} dotClass={dotClass} />}<span className="relative flex shrink-0 items-center"><PullRequestIcon icon={view.icon} tone={view.iconTone} className="size-4 shrink-0" />- {!hasAvatar && dotClass != null && <CiDot dotClass={dotClass} />}+ {dotClass != null && <CiDot dotClass={dotClass} />}</span><span className="truncate">{pullRequest.title}</span></Ariakit.Button>@@ -88,6 +54,7 @@ function PullRequestChip({ conversationId }: { conversationId: string }) {/><PullRequestPanelstore={hovercard}+ className={panelBelowClass}pullRequest={pullRequest}refreshFailed={isError}onRetry={() => void refetch()}diff --git a/client/src/components/Chat/PullRequest/Panel.tsx b/client/src/components/Chat/PullRequest/Panel.tsxindex b9881e9407..fb8ffb3587 100644--- a/client/src/components/Chat/PullRequest/Panel.tsx+++ b/client/src/components/Chat/PullRequest/Panel.tsx@@ -13,6 +13,15 @@ export const panelClass = cn('motion-reduce:translate-x-0 motion-reduce:transition-opacity',);+/** Slides down from an anchor above it and fades; reduced motion only fades. */+export const panelBelowClass = cn(+ 'border-border-light bg-surface-secondary text-text-primary z-[200] w-80 max-w-[calc(100vw-2rem)] rounded-xl border shadow-lg focus:outline-none',+ 'origin-top -translate-y-2 opacity-0 transition duration-200 ease-out',+ 'data-[enter]:translate-y-0 data-[enter]:opacity-100',+ 'data-[leave]:-translate-y-2 data-[leave]:opacity-0',+ 'motion-reduce:translate-y-0 motion-reduce:transition-opacity',+);+/*** The card as a hovercard beside its anchor. It is portaled, and a portal's events still bubble* to the React tree that rendered it, so anything that sits inside a clickable row stops them@@ -23,7 +32,9 @@ export default function PullRequestPanel({pullRequest,refreshFailed,onRetry,+ className = panelClass,}: {+ className?: string;store: Ariakit.HovercardStore;pullRequest: TConversationPullRequest;refreshFailed: boolean;@@ -41,7 +52,7 @@ export default function PullRequestPanel({unmountOnHideautoFocusOnShow={false}aria-label={localize('com_ui_pull_request')}- className={panelClass}+ className={className}onClick={stop}onDoubleClick={stop}onContextMenu={stop}diff --git a/client/src/components/Chat/PullRequest/__tests__/Card.test.tsx b/client/src/components/Chat/PullRequest/__tests__/Card.test.tsxindex 84b90506f0..d8391eca49 100644--- a/client/src/components/Chat/PullRequest/__tests__/Card.test.tsx+++ b/client/src/components/Chat/PullRequest/__tests__/Card.test.tsx@@ -41,6 +41,19 @@ describe('PullRequestCard', () => {}});+ it('gives the GitHub mark a viewBox, so shrinking the icon scales it instead of clipping it', () => {+ render(<PullRequestCard pullRequest={pr} />);+ const svg = screen.getByTestId('pull-request-github-link').querySelector('svg');+ expect(svg).toHaveAttribute('viewBox', '0 0 25 25');+ });++ it('dims only the GitHub icon on hover, never the background behind it', () => {+ render(<PullRequestCard pullRequest={pr} />);+ const link = screen.getByTestId('pull-request-github-link');+ expect(link).toHaveClass('hover:text-text-primary');+ expect(link.className).not.toMatch(/hover:bg-/);+ });+it('puts the GitHub tooltip in the layer the card lives in, not behind it', async () => {const layer = document.createElement('div');document.body.appendChild(layer);diff --git a/client/src/components/Chat/PullRequest/__tests__/Chip.test.tsx b/client/src/components/Chat/PullRequest/__tests__/Chip.test.tsxindex dc3db2d59a..52a176e33d 100644--- a/client/src/components/Chat/PullRequest/__tests__/Chip.test.tsx+++ b/client/src/components/Chat/PullRequest/__tests__/Chip.test.tsx@@ -27,16 +27,6 @@ jest.mock('~/hooks', () => ({useLocalize: () => (key: string, values?: Record<string, string | number>) =>values == null ? key : `${key}:${Object.values(values).join(',')}`,}));-const mockAgents: { current: Record<string, { name: string; avatar?: { filepath: string } }> } = {- current: { 'agent-1': { name: 'Coder' } },-};-const mockChat: { current: { conversationId?: string; agent_id?: string } } = {- current: { conversationId: 'convo-1', agent_id: 'agent-1' },-};-jest.mock('~/Providers', () => ({- useAgentsMapContext: () => mockAgents.current,- useChatContext: () => ({ conversation: mockChat.current }),-}));/*** Ariakit opens a hovercard only for a pointer that is really moving, and only accepts a bare@@ -82,8 +72,6 @@ const renderChip = () => {describe('PullRequestChip', () => {beforeEach(() => {mockGet.mockReset();- mockAgents.current = { 'agent-1': { name: 'Coder' } };- mockChat.current = { conversationId: 'convo-1', agent_id: 'agent-1' };});it('renders nothing while loading, so the header does not shift', () => {@@ -127,30 +115,16 @@ describe('PullRequestChip', () => {expect(await screen.findByTestId('pull-request-ci-dot')).toHaveClass(dotClass);});- it('puts the dot on the agent picture when the agent has one, and not on the icon', async () => {- mockAgents.current = {- 'agent-1': { name: 'Coder', avatar: { filepath: '/images/coder.png' } },- };+ it('never shows the agent picture, even when the agent has one', async () => {mockGet.mockResolvedValue({ pullRequest: pr });renderChip();const dot = await screen.findByTestId('pull-request-ci-dot');expect(screen.getAllByTestId('pull-request-ci-dot')).toHaveLength(1);- expect(dot.parentElement?.querySelector('img')).not.toBeNull();- });-- it('does not borrow the agent of the previous conversation while the chat state catches up', async () => {- mockAgents.current = {- 'agent-1': { name: 'Coder', avatar: { filepath: '/images/coder.png' } },- };- mockChat.current = { conversationId: 'previous-convo', agent_id: 'agent-1' };- mockGet.mockResolvedValue({ pullRequest: pr });- renderChip();- const dot = await screen.findByTestId('pull-request-ci-dot');- expect(dot.parentElement?.querySelector('img')).toBeNull();+ expect(screen.getByTestId('header-pull-request-button').querySelector('img')).toBeNull();expect(dot.parentElement?.querySelector('svg')).not.toBeNull();});- it('keeps the dot on the pull request icon when the agent has no picture', async () => {+ it('keeps the dot on the pull request icon', async () => {mockGet.mockResolvedValue({ pullRequest: pr });renderChip();const dot = await screen.findByTestId('pull-request-ci-dot');diff --git a/packages/client/src/svgs/GithubIcon.tsx b/packages/client/src/svgs/GithubIcon.tsxindex e637d3ad3c..e120f8a92c 100644--- a/packages/client/src/svgs/GithubIcon.tsx+++ b/packages/client/src/svgs/GithubIcon.tsx@@ -3,7 +3,14 @@ import { JSX } from 'react/jsx-runtime';export default function GithubIcon(): JSX.Element {return (- <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="none" aria-hidden="true">+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="25"+ height="25"+ viewBox="0 0 25 25"+ fill="none"+ aria-hidden="true"+ ><pathfill="currentColor"d="M12 0a12 12 0 0 0-3.84 23.399c.608.112.832-.256.832-.576v-2.015c-3.395.736-4.115-1.632-4.115-1.632a3.241 3.241 0 0 0-1.359-1.792c-1.104-.736.064-.736.064-.736a2.566 2.566 0 0 1 1.824 1.216a2.638 2.638 0 0 0 3.616 1.024a2.607 2.607 0 0 1 .768-1.6c-2.688-.32-5.504-1.344-5.504-5.984a4.677 4.677 0 0 1 1.216-3.168a4.383 4.383 0 0 1 .128-3.136s1.024-.32 3.36 1.216a11.66 11.66 0 0 1 6.112 0c2.336-1.536 3.36-1.216 3.36-1.216a4.354 4.354 0 0 1 .128 3.136a4.628 4.628 0 0 1 1.216 3.168c0 4.672-2.848 5.664-5.536 5.952a2.881 2.881 0 0 1 .832 2.24v3.36c0 .32.224.672.832.576A12 12 0 0 0 12 0z"