Skip to content

Commit e942ef8

Browse files
committed
feat(web): refresh pull request details
1 parent 095cd9e commit e942ef8

12 files changed

Lines changed: 709 additions & 556 deletions

apps/web/src/components/ChatView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6160,7 +6160,6 @@ function ChatViewContent(props: ChatViewProps) {
61606160
? "thread"
61616161
: "page"
61626162
}
6163-
chromeVariant="collapse"
61646163
composerDraftTarget={composerDraftTarget}
61656164
onStateChange={handlePullRequestTabStatusChange}
61666165
/>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { renderToStaticMarkup } from "react-dom/server";
2+
import { describe, expect, it } from "vite-plus/test";
3+
4+
import { PanelLayoutControls } from "./PanelLayoutControls";
5+
6+
describe("PanelLayoutControls", () => {
7+
it("keeps unavailable panel tooltip triggers interactive", () => {
8+
const markup = renderToStaticMarkup(
9+
<PanelLayoutControls
10+
showTerminalControl
11+
terminalAvailable={false}
12+
terminalOpen={false}
13+
terminalShortcutLabel={null}
14+
rightPanelAvailable={false}
15+
rightPanelOpen={false}
16+
rightPanelShortcutLabel={null}
17+
liveAgentCount={0}
18+
onToggleTerminal={() => {}}
19+
onToggleRightPanel={() => {}}
20+
/>,
21+
);
22+
23+
expect(markup.match(/data-slot="tooltip-trigger"/g)).toHaveLength(2);
24+
expect(markup.match(/data-slot="tooltip-trigger"[^>]*><button[^>]*disabled=""/g)).toHaveLength(
25+
2,
26+
);
27+
});
28+
});

apps/web/src/components/chat/PanelLayoutControls.tsx

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface PanelLayoutControlsProps {
1212
rightPanelAvailable: boolean;
1313
rightPanelOpen: boolean;
1414
rightPanelShortcutLabel: string | null;
15+
rightPanelUnavailableLabel?: string;
1516
/** Running + waiting subagents in this thread; badges the right panel toggle. */
1617
liveAgentCount: number;
1718
onToggleTerminal: () => void;
@@ -26,6 +27,7 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
2627
rightPanelAvailable,
2728
rightPanelOpen,
2829
rightPanelShortcutLabel,
30+
rightPanelUnavailableLabel = "Right panel is unavailable",
2931
liveAgentCount,
3032
onToggleTerminal,
3133
onToggleRightPanel,
@@ -37,21 +39,19 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
3739
>
3840
{showTerminalControl ? (
3941
<Tooltip>
40-
<TooltipTrigger
41-
render={
42-
<Toggle
43-
className="shrink-0 [-webkit-app-region:no-drag]"
44-
pressed={terminalOpen}
45-
onPressedChange={onToggleTerminal}
46-
aria-label="Toggle terminal drawer"
47-
variant="ghost"
48-
size="sm"
49-
disabled={!terminalAvailable}
50-
>
51-
<PanelBottomIcon className="size-4" />
52-
</Toggle>
53-
}
54-
/>
42+
<TooltipTrigger render={<span className="flex shrink-0" />}>
43+
<Toggle
44+
className="shrink-0 [-webkit-app-region:no-drag]"
45+
pressed={terminalOpen}
46+
onPressedChange={onToggleTerminal}
47+
aria-label="Toggle terminal drawer"
48+
variant="ghost"
49+
size="sm"
50+
disabled={!terminalAvailable}
51+
>
52+
<PanelBottomIcon className="size-4" />
53+
</Toggle>
54+
</TooltipTrigger>
5555
<TooltipPopup side="bottom">
5656
{terminalAvailable
5757
? `Toggle terminal drawer${terminalShortcutLabel ? ` (${terminalShortcutLabel})` : ""}`
@@ -60,41 +60,39 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
6060
</Tooltip>
6161
) : null}
6262
<Tooltip>
63-
<TooltipTrigger
64-
render={
65-
<Toggle
66-
className="shrink-0 [-webkit-app-region:no-drag]"
67-
pressed={rightPanelOpen}
68-
onPressedChange={onToggleRightPanel}
69-
aria-label={
70-
liveAgentCount > 0
71-
? `Toggle right panel, ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
72-
: "Toggle right panel"
73-
}
74-
variant="ghost"
75-
size="sm"
76-
disabled={!rightPanelAvailable}
77-
>
78-
<PanelRightIcon className="size-4" />
79-
{liveAgentCount > 0 ? (
80-
<span
81-
aria-hidden
82-
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"
83-
>
84-
{liveAgentCount}
85-
</span>
86-
) : null}
87-
</Toggle>
88-
}
89-
/>
63+
<TooltipTrigger render={<span className="flex shrink-0" />}>
64+
<Toggle
65+
className="shrink-0 [-webkit-app-region:no-drag]"
66+
pressed={rightPanelOpen}
67+
onPressedChange={onToggleRightPanel}
68+
aria-label={
69+
liveAgentCount > 0
70+
? `Toggle right panel, ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
71+
: "Toggle right panel"
72+
}
73+
variant="ghost"
74+
size="sm"
75+
disabled={!rightPanelAvailable}
76+
>
77+
<PanelRightIcon className="size-4" />
78+
{liveAgentCount > 0 ? (
79+
<span
80+
aria-hidden
81+
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"
82+
>
83+
{liveAgentCount}
84+
</span>
85+
) : null}
86+
</Toggle>
87+
</TooltipTrigger>
9088
<TooltipPopup side="bottom">
9189
{rightPanelAvailable
9290
? `Toggle right panel${rightPanelShortcutLabel ? ` (${rightPanelShortcutLabel})` : ""}${
9391
liveAgentCount > 0
9492
? ` · ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
9593
: ""
9694
}`
97-
: "Right panel is unavailable"}
95+
: rightPanelUnavailableLabel}
9896
</TooltipPopup>
9997
</Tooltip>
10098
</div>

0 commit comments

Comments
 (0)