Skip to content

Commit 634ef13

Browse files
authored
fix: Rafa nits (#1225)
1. Fix split panel not collapsing when moving a tab back by deferring drag state cleanup to next frame 2. Move bash mode indicator into ModeAndBranchRow with a blue ring on the editor 3. Add drag-and-drop hint text to command center empty cells 4. Offset sidebar section tooltip to avoid blocking the + button 5. Improve keyboard shortcuts visual hierarchy with larger category headers 6. Fix focused panel tracking when moving tabs between panels
1 parent e322639 commit 634ef13

7 files changed

Lines changed: 71 additions & 43 deletions

File tree

apps/code/src/renderer/components/HeaderRow.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,11 @@ export function HeaderRow() {
106106
{showRightSidebarSection && view.type === "task-detail" && view.data && (
107107
<Flex
108108
align="center"
109-
justify="between"
110-
pr="4"
111-
pl="3"
109+
justify={rightSidebarOpen ? "between" : "end"}
110+
px="3"
112111
style={{
113-
width: rightSidebarOpen
114-
? `${rightSidebarWidth}px`
115-
: `${COLLAPSED_WIDTH}px`,
116-
minWidth: `${COLLAPSED_WIDTH}px`,
112+
width: rightSidebarOpen ? `${rightSidebarWidth}px` : undefined,
113+
minWidth: rightSidebarOpen ? `${COLLAPSED_WIDTH}px` : undefined,
117114
height: "100%",
118115
borderLeft: "1px solid var(--gray-6)",
119116
transition: rightSidebarIsResizing

apps/code/src/renderer/components/KeyboardShortcutsSheet.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function KeyboardShortcutsList() {
9494

9595
return (
9696
<Flex key={category} direction="column" gap="2">
97-
<Text size="2" weight="bold" color="gray">
97+
<Text size="3" weight="bold" color="gray">
9898
{CATEGORY_LABELS[category]}
9999
</Text>
100100
<Box
@@ -110,8 +110,9 @@ export function KeyboardShortcutsList() {
110110
align="center"
111111
justify="between"
112112
px="3"
113-
py="2"
114113
style={{
114+
paddingTop: "6px",
115+
paddingBottom: "6px",
115116
borderBottom:
116117
index < uniqueShortcuts.length - 1
117118
? "1px solid var(--gray-4)"

apps/code/src/renderer/features/command-center/components/CommandCenterPanel.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,25 @@ function EmptyCell({ cellIndex }: { cellIndex: number }) {
1818

1919
return (
2020
<Flex align="center" justify="center" height="100%">
21-
<TaskSelector
22-
cellIndex={cellIndex}
23-
open={selectorOpen}
24-
onOpenChange={setSelectorOpen}
25-
>
26-
<button
27-
type="button"
28-
onClick={() => setSelectorOpen(true)}
29-
className="flex items-center gap-1.5 rounded-md border border-gray-7 border-dashed px-3 py-1.5 font-mono text-[11px] text-gray-10 transition-colors hover:border-gray-9 hover:text-gray-12"
21+
<Flex direction="column" align="center" gap="2">
22+
<TaskSelector
23+
cellIndex={cellIndex}
24+
open={selectorOpen}
25+
onOpenChange={setSelectorOpen}
3026
>
31-
<Plus size={12} />
32-
Add task
33-
</button>
34-
</TaskSelector>
27+
<button
28+
type="button"
29+
onClick={() => setSelectorOpen(true)}
30+
className="flex items-center gap-1.5 rounded-md border border-gray-7 border-dashed px-3 py-1.5 font-mono text-[11px] text-gray-10 transition-colors hover:border-gray-9 hover:text-gray-12"
31+
>
32+
<Plus size={12} />
33+
Add task
34+
</button>
35+
</TaskSelector>
36+
<Text size="1" className="font-mono text-[10px] text-gray-9">
37+
or drag a task from the sidebar
38+
</Text>
39+
</Flex>
3540
</Flex>
3641
);
3742
}

apps/code/src/renderer/features/message-editor/components/MessageEditor.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface ModeAndBranchRowProps {
3030
linesRemoved: number;
3131
} | null;
3232
disabled?: boolean;
33+
isBashMode?: boolean;
3334
}
3435

3536
function ModeAndBranchRow({
@@ -39,6 +40,7 @@ function ModeAndBranchRow({
3940
cloudBranch,
4041
cloudDiffStats,
4142
disabled,
43+
isBashMode,
4244
}: ModeAndBranchRowProps) {
4345
const { currentBranch: gitBranch, diffStats } = useGitQueries(
4446
repoPath ?? undefined,
@@ -54,7 +56,7 @@ function ModeAndBranchRow({
5456
effectiveDiffStats.linesAdded > 0 ||
5557
effectiveDiffStats.linesRemoved > 0);
5658

57-
if (!showModeIndicator && !showBranchSelector) {
59+
if (!showModeIndicator && !showBranchSelector && !isBashMode) {
5860
return null;
5961
}
6062

@@ -66,16 +68,27 @@ function ModeAndBranchRow({
6668
style={{ overflow: "hidden" }}
6769
>
6870
<Flex align="center" gap="2" flexShrink="0">
69-
{showModeIndicator && modeOption && (
70-
<ModeIndicatorInput modeOption={modeOption} />
71-
)}
72-
{showModeIndicator && !modeOption && (
71+
{isBashMode ? (
7372
<Text
7473
size="1"
75-
style={{ color: "var(--gray-8)", fontFamily: "monospace" }}
74+
style={{ color: "var(--blue-9)", fontFamily: "monospace" }}
7675
>
77-
Loading...
76+
! bash mode
7877
</Text>
78+
) : (
79+
<>
80+
{showModeIndicator && modeOption && (
81+
<ModeIndicatorInput modeOption={modeOption} />
82+
)}
83+
{showModeIndicator && !modeOption && (
84+
<Text
85+
size="1"
86+
style={{ color: "var(--gray-8)", fontFamily: "monospace" }}
87+
>
88+
Loading...
89+
</Text>
90+
)}
91+
</>
7992
)}
8093
</Flex>
8194
<Flex align="center" gap="2" style={{ minWidth: 0, overflow: "hidden" }}>
@@ -247,6 +260,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
247260
direction="column"
248261
gap="2"
249262
onClick={handleContainerClick}
263+
className={`rounded-md p-2 ${isBashMode ? "ring-1 ring-blue-9" : ""}`}
250264
style={{ cursor: "text" }}
251265
>
252266
<AttachmentsBar attachments={attachments} onRemove={removeAttachment} />
@@ -266,11 +280,6 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
266280
onAddAttachment={addAttachment}
267281
onAttachFiles={onAttachFiles}
268282
/>
269-
{isBashMode && (
270-
<Text size="1" className="ml-2 font-mono text-accent-11">
271-
bash mode
272-
</Text>
273-
)}
274283
</Flex>
275284
<Flex gap="2" align="center">
276285
{isLoading && onCancel ? (
@@ -328,6 +337,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
328337
cloudBranch={cloudBranch}
329338
cloudDiffStats={cloudDiffStats}
330339
disabled={disabled}
340+
isBashMode={isBashMode}
331341
/>
332342
</Flex>
333343
);

apps/code/src/renderer/features/panels/hooks/useDragDropHandlers.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ export const useDragDropHandlers = (taskId: string) => {
6060
};
6161

6262
const handleDragEnd: DragDropEvents["dragend"] = (event) => {
63-
usePanelLayoutStore.getState().clearDraggingTab(taskId);
64-
65-
if (event.canceled) return;
63+
if (event.canceled) {
64+
usePanelLayoutStore.getState().clearDraggingTab(taskId);
65+
return;
66+
}
6667

6768
const sourceData = event.operation.source?.data;
6869
const targetData = event.operation.target?.data;
@@ -72,15 +73,21 @@ export const useDragDropHandlers = (taskId: string) => {
7273
!sourceData.tabId ||
7374
!sourceData.panelId
7475
) {
76+
usePanelLayoutStore.getState().clearDraggingTab(taskId);
7577
return;
7678
}
7779

7880
const { tabId, panelId: sourcePanelId } = sourceData;
7981

80-
// Defer structural tree changes to the next frame so @dnd-kit can finish
81-
// its DOM cleanup first. Without this, React tries to removeChild on nodes
82-
// that @dnd-kit has already repositioned, causing a DOM exception.
83-
const applyMove = (fn: () => void) => requestAnimationFrame(fn);
82+
// Defer structural tree changes AND drag state cleanup to the next frame
83+
// so @dnd-kit can finish its DOM cleanup first. Clearing drag state
84+
// synchronously unmounts drop zones while @dnd-kit still holds references
85+
// to them, which can corrupt its internal state and prevent the move.
86+
const applyMove = (fn: () => void) =>
87+
requestAnimationFrame(() => {
88+
fn();
89+
usePanelLayoutStore.getState().clearDraggingTab(taskId);
90+
});
8491

8592
// Handle drop on tab bar or on a tab in a different panel -> move tab
8693
if (
@@ -101,6 +108,7 @@ export const useDragDropHandlers = (taskId: string) => {
101108
!targetData.panelId ||
102109
!targetData.zone
103110
) {
111+
usePanelLayoutStore.getState().clearDraggingTab(taskId);
104112
return;
105113
}
106114

@@ -116,6 +124,8 @@ export const useDragDropHandlers = (taskId: string) => {
116124
splitPanel(taskId, tabId, sourcePanelId, targetPanelId, zone);
117125
setFocusedPanel(taskId, targetPanelId);
118126
});
127+
} else {
128+
usePanelLayoutStore.getState().clearDraggingTab(taskId);
119129
}
120130
};
121131

apps/code/src/renderer/features/panels/store/panelLayoutStore.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,12 @@ export const usePanelLayoutStore = createWithEqualityFn<PanelLayoutStore>()(
723723
layout.panelTree,
724724
);
725725

726-
return { panelTree: cleanedTree };
726+
const focusedPanelId =
727+
layout.focusedPanelId === sourcePanelId
728+
? targetPanelId
729+
: layout.focusedPanelId;
730+
731+
return { panelTree: cleanedTree, focusedPanelId };
727732
}),
728733
);
729734
},

apps/code/src/renderer/features/sidebar/components/SidebarSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function SidebarSection({
6666
</span>
6767
)}
6868
{tooltipContent ? (
69-
<Tooltip content={tooltipContent} side="right">
69+
<Tooltip content={tooltipContent} side="right" align="start">
7070
<span className="overflow-hidden text-ellipsis whitespace-nowrap font-medium">
7171
{label}
7272
</span>

0 commit comments

Comments
 (0)