@@ -7,7 +7,8 @@ import { RetryBarrier } from "./Messages/ChatBarrier/RetryBarrier";
77import { PinnedTodoList } from "./PinnedTodoList" ;
88import { getAutoRetryKey } from "@/constants/storage" ;
99import { ChatInput , type ChatInputAPI } from "./ChatInput" ;
10- import { ChatMetaSidebar } from "./ChatMetaSidebar" ;
10+ import { RightSidebar , type TabType } from "./RightSidebar" ;
11+ import { useResizableSidebar } from "@/hooks/useResizableSidebar" ;
1112import {
1213 shouldShowInterruptedBarrier ,
1314 mergeConsecutiveStreamErrors ,
@@ -44,7 +45,7 @@ const ViewContainer = styled.div`
4445
4546const ChatArea = styled . div `
4647 flex: 1;
47- min-width: 750px;
48+ min-width: 400px; /* Reduced from 750px to allow narrower layout when Review panel is wide */
4849 display: flex;
4950 flex-direction: column;
5051` ;
@@ -64,13 +65,26 @@ const WorkspaceTitle = styled.div`
6465 display: flex;
6566 align-items: center;
6667 gap: 8px;
68+ min-width: 0; /* Allow flex children to shrink */
69+ overflow: hidden;
6770` ;
6871
6972const WorkspacePath = styled . span `
7073 font-family: var(--font-monospace);
7174 color: #888;
7275 font-weight: 400;
7376 font-size: 11px;
77+ white-space: nowrap;
78+ overflow: hidden;
79+ text-overflow: ellipsis;
80+ min-width: 0;
81+ ` ;
82+
83+ const WorkspaceName = styled . span `
84+ white-space: nowrap;
85+ overflow: hidden;
86+ text-overflow: ellipsis;
87+ min-width: 0;
7488` ;
7589
7690const TerminalIconButton = styled . button `
@@ -197,12 +211,33 @@ const AIViewInner: React.FC<AIViewProps> = ({
197211} ) => {
198212 const chatAreaRef = useRef < HTMLDivElement > ( null ) ;
199213
200- // NEW: Get workspace state from store (only re-renders when THIS workspace changes)
214+ // Track active tab to conditionally enable resize functionality
215+ // RightSidebar notifies us of tab changes via onTabChange callback
216+ const [ activeTab , setActiveTab ] = useState < TabType > ( "costs" ) ;
217+ const isReviewTabActive = activeTab === "review" ;
218+
219+ // Resizable sidebar for Review tab only
220+ // Hook encapsulates all drag logic, persistence, and constraints
221+ // Returns width to apply to RightSidebar and startResize for handle's onMouseDown
222+ const {
223+ width : sidebarWidth ,
224+ isResizing,
225+ startResize,
226+ } = useResizableSidebar ( {
227+ enabled : isReviewTabActive , // Only active on Review tab
228+ defaultWidth : 600 , // Initial width or fallback
229+ minWidth : 300 , // Can't shrink smaller
230+ maxWidth : 1200 , // Can't grow larger
231+ storageKey : "review-sidebar-width" , // Persists across sessions
232+ } ) ;
233+
234+ // Get workspace state from store (only re-renders when THIS workspace changes)
201235 const workspaceState = useWorkspaceState ( workspaceId ) ;
202236 const aggregator = useWorkspaceAggregator ( workspaceId ) ;
203237
204238 // Get git status for this workspace
205239 const gitStatus = useGitStatus ( workspaceId ) ;
240+
206241 const [ editingMessage , setEditingMessage ] = useState < { id : string ; content : string } | undefined > (
207242 undefined
208243 ) ;
@@ -239,6 +274,11 @@ const AIViewInner: React.FC<AIViewProps> = ({
239274 chatInputAPI . current = api ;
240275 } , [ ] ) ;
241276
277+ // Handler for review notes from Code Review tab
278+ const handleReviewNote = useCallback ( ( note : string ) => {
279+ chatInputAPI . current ?. appendText ( note ) ;
280+ } , [ ] ) ;
281+
242282 // Thinking level state from context
243283 const { thinkingLevel : currentWorkspaceThinking , setThinkingLevel } = useThinking ( ) ;
244284
@@ -431,7 +471,9 @@ const AIViewInner: React.FC<AIViewProps> = ({
431471 workspaceId = { workspaceId }
432472 tooltipPosition = "bottom"
433473 />
434- { projectName } / { branch }
474+ < WorkspaceName >
475+ { projectName } / { branch }
476+ </ WorkspaceName >
435477 < WorkspacePath > { namedWorkspacePath } </ WorkspacePath >
436478 < TooltipWrapper inline >
437479 < TerminalIconButton onClick = { handleOpenTerminal } >
@@ -555,7 +597,17 @@ const AIViewInner: React.FC<AIViewProps> = ({
555597 />
556598 </ ChatArea >
557599
558- < ChatMetaSidebar key = { workspaceId } workspaceId = { workspaceId } chatAreaRef = { chatAreaRef } />
600+ < RightSidebar
601+ key = { workspaceId }
602+ workspaceId = { workspaceId }
603+ workspacePath = { namedWorkspacePath }
604+ chatAreaRef = { chatAreaRef }
605+ onTabChange = { setActiveTab } // Notifies us when tab changes
606+ width = { isReviewTabActive ? sidebarWidth : undefined } // Custom width only on Review tab
607+ onStartResize = { isReviewTabActive ? startResize : undefined } // Pass resize handler when Review active
608+ isResizing = { isResizing } // Pass resizing state
609+ onReviewNote = { handleReviewNote } // Pass review note handler to append to chat
610+ />
559611 </ ViewContainer >
560612 ) ;
561613} ;
0 commit comments