Skip to content

Commit 9ffb05c

Browse files
committed
fix(mobile): correct git pill labels and keep terminal reachable
Default-branch push was labelled Commit because commit_push always mapped that way. Terminal also disappeared whenever a pill showed; nest it under Git instead.
1 parent 2bcd697 commit 9ffb05c

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

‎apps/mobile/src/features/threads/ThreadGitControls.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,13 @@ function shortGitBarLabel(
387387
case "push":
388388
return { label: "Push", disabled: quickAction.disabled };
389389
case "commit":
390-
case "commit_push":
391390
return { label: "Commit", disabled: quickAction.disabled };
391+
case "commit_push":
392+
// Default-branch ahead uses action commit_push with label "Push".
393+
return {
394+
label: quickAction.label === "Push" ? "Push" : "Commit",
395+
disabled: quickAction.disabled,
396+
};
392397
default:
393398
return null;
394399
}
@@ -422,7 +427,8 @@ export function useThreadGitBar(props: ThreadGitMenuProps): {
422427
: null;
423428
return {
424429
primaryAction,
425-
menu: threadGitMenuFromModel(props, model, primaryAction !== null),
430+
// Keep the menu quick-action (and its disabled hint) when the pill is disabled.
431+
menu: threadGitMenuFromModel(props, model, primaryAction !== null && !primaryAction.disabled),
426432
};
427433
}
428434

‎apps/mobile/src/features/threads/ThreadHeader.tsx‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ export function ThreadHeader(props: {
2626
const { panes, toggleAuxiliaryPane, composerKeyboardActive, startNewTask } =
2727
useAdaptiveWorkspaceLayout();
2828
const { primaryAction: gitPrimaryAction, menu: gitMenu } = useThreadGitBar(props.gitControls);
29-
// Keep the bar narrow when Create/View PR is on it — terminal stays in split/inspector flows.
30-
const terminalMenu = gitPrimaryAction === null ? threadTerminalMenu(props.gitControls) : null;
29+
const terminalMenu = threadTerminalMenu(props.gitControls);
30+
// Pill already crowds the bar — nest Terminal under Git instead of a second toolbar control.
31+
const menus: AppBarMenu[] =
32+
gitPrimaryAction !== null && terminalMenu
33+
? [
34+
{
35+
...gitMenu,
36+
items: [
37+
...gitMenu.items,
38+
{
39+
id: "git-terminal",
40+
title: terminalMenu.title,
41+
icon:
42+
typeof terminalMenu.icon === "string" ? terminalMenu.icon : terminalMenu.icon.ios,
43+
items: terminalMenu.items,
44+
},
45+
],
46+
},
47+
]
48+
: [gitMenu, ...(terminalMenu ? [terminalMenu] : [])];
3149
const filesVisible = props.inspectorMode === "files" && panes.auxiliaryPaneVisible;
3250
const inspectorVisible = props.inspectorMode !== null && panes.auxiliaryPaneVisible;
3351
const actions: AppBarAction[] = props.hasThreadCwd
@@ -42,7 +60,6 @@ export function ThreadHeader(props: {
4260
},
4361
]
4462
: [];
45-
const menus = [gitMenu, terminalMenu].filter((menu): menu is AppBarMenu => menu !== null);
4663

4764
return (
4865
<AppBar

0 commit comments

Comments
 (0)