Skip to content

Commit 8a54f56

Browse files
committed
feat(web): add a default shortcut to maximize the right panel
Bind rightPanel.toggleMaximized to mod+alt+shift+b by default and show the active binding in the Maximize panel tooltip, matching the other panel controls.
1 parent 05696c6 commit 8a54f56

6 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8078,6 +8078,7 @@ export default function ChatView(props: ChatViewProps) {
80788078
>
80798079
<RightPanelMaximizeControl
80808080
maximized={rightPanelMaximized}
8081+
shortcutLabel={shortcutLabelForCommand(keybindings, "rightPanel.toggleMaximized")}
80818082
onToggle={toggleRightPanelMaximizedStable}
80828083
/>
80838084
</span>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
134134

135135
export const RightPanelMaximizeControl = memo(function RightPanelMaximizeControl({
136136
maximized,
137+
shortcutLabel,
137138
onToggle,
138139
}: {
139140
maximized: boolean;
141+
shortcutLabel: string | null;
140142
onToggle: () => void;
141143
}) {
142144
const label = maximized ? "Restore panel size" : "Maximize panel";
@@ -156,7 +158,10 @@ export const RightPanelMaximizeControl = memo(function RightPanelMaximizeControl
156158
</Toggle>
157159
}
158160
/>
159-
<TooltipPopup side="bottom">{label}</TooltipPopup>
161+
<TooltipPopup side="bottom">
162+
{label}
163+
{shortcutLabel ? ` (${shortcutLabel})` : ""}
164+
</TooltipPopup>
160165
</Tooltip>
161166
);
162167
});

‎apps/web/src/keybindings.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,17 @@ describe("resolveShortcutCommand", () => {
684684
);
685685
});
686686

687+
it("maximizes the right panel with mod+alt+shift+b by default", () => {
688+
assert.strictEqual(
689+
resolveShortcutCommand(
690+
event({ key: "B", code: "KeyB", metaKey: true, altKey: true, shiftKey: true }),
691+
DEFAULT_RESOLVED_KEYBINDINGS,
692+
{ platform: "MacIntel", context: { terminalFocus: false } },
693+
),
694+
"rightPanel.toggleMaximized",
695+
);
696+
});
697+
687698
it("navigates history with mod+[ and mod+] outside the terminal", () => {
688699
const back = event({ key: "[", code: "BracketLeft", metaKey: true });
689700
const forward = event({ key: "]", code: "BracketRight", ctrlKey: true });

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ function PullRequestsRouteView() {
12981298
{rightPanelState.isOpen ? (
12991299
<RightPanelMaximizeControl
13001300
maximized={rightPanelMaximized}
1301+
shortcutLabel={shortcutLabelForCommand(keybindings, "rightPanel.toggleMaximized")}
13011302
onToggle={toggleRightPanelMaximized}
13021303
/>
13031304
) : null}

‎docs/user/keybindings.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ terminals so native undo keeps working there.
156156
`navigation.back` (`mod+[` by default) and `navigation.forward` (`mod+]`) move
157157
through the pages you have visited, like a browser's back and forward buttons.
158158

159+
`rightPanel.toggleMaximized` (`mod+alt+shift+b` by default) expands the open right
160+
panel over the chat, and restores it when pressed again.
161+
159162
`chat.new` may ask you to choose a project when there is more than one.
160163
`chat.newLocal` skips that chooser. Both use your
161164
[new-thread defaults](./thread-sidebar.md#start-a-thread). `chat.newWithoutProject`

‎packages/shared/src/keybindings.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
150150
{ key: "mod+]", command: "navigation.forward", when: "!terminalFocus" },
151151
{ key: "mod+j", command: "terminal.toggle" },
152152
{ key: "mod+alt+b", command: "rightPanel.toggle" },
153+
{ key: "mod+alt+shift+b", command: "rightPanel.toggleMaximized" },
153154
{ key: "mod+shift+b", command: "threadPanel.toggle", when: "!terminalFocus" },
154155
{ key: "mod+t", command: "rightPanel.new", when: "rightPanelOpen && !terminalFocus" },
155156
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },

0 commit comments

Comments
 (0)