Skip to content

Commit fa58fd3

Browse files
committed
fix(web): honor the right panel shortcut on the PR page
1 parent 7bd7f99 commit fa58fd3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/web/src/routes/_chat.pull-requests.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ import { WorkspacePageContainer } from "../components/WorkspacePageContainer";
114114
import { WorkspacePageHeader } from "../components/WorkspacePageHeader";
115115
import { isCommandPaletteOpen } from "../commandPaletteBus";
116116
import { isElectron } from "../env";
117-
import { resolveShortcutCommand } from "../keybindings";
117+
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
118118
import { isTerminalFocused } from "../lib/terminalFocus";
119119
import { PanelLayoutControls } from "../components/chat/PanelLayoutControls";
120120
import { Button } from "../components/ui/button";
@@ -1577,7 +1577,7 @@ function PullRequestsRouteView() {
15771577
terminalShortcutLabel={null}
15781578
rightPanelAvailable={rightPanelAvailable}
15791579
rightPanelOpen={rightPanelState.isOpen}
1580-
rightPanelShortcutLabel={null}
1580+
rightPanelShortcutLabel={shortcutLabelForCommand(keybindings, "rightPanel.toggle")}
15811581
rightPanelUnavailableLabel="Select a pull request first"
15821582
liveAgentCount={0}
15831583
onToggleTerminal={() => undefined}
@@ -1914,13 +1914,20 @@ function PullRequestsRouteView() {
19141914
event.stopPropagation();
19151915
if (!event.repeat) closeSurface(activePullRequestSurface);
19161916
});
1917+
const toggleRightPanelFromShortcut = useEffectEvent((event: KeyboardEvent) => {
1918+
if (!rightPanelAvailable) return;
1919+
event.preventDefault();
1920+
event.stopPropagation();
1921+
toggleRightPanel();
1922+
});
19171923
useEffect(() => {
19181924
const onKeyDown = (event: KeyboardEvent) => {
19191925
if (event.defaultPrevented || isCommandPaletteOpen()) return;
19201926
const command = resolveShortcutCommand(event, keybindings, {
19211927
context: { terminalFocus: isTerminalFocused() },
19221928
});
19231929
if (command === "rightPanel.close") closeActiveSurfaceFromShortcut(event);
1930+
if (command === "rightPanel.toggle") toggleRightPanelFromShortcut(event);
19241931
if (command === "thread.copyReference") copyPullRequestFromShortcut(event);
19251932
};
19261933
window.addEventListener("keydown", onKeyDown);

0 commit comments

Comments
 (0)