@@ -38,6 +38,7 @@ import ChatTextArea from "./ChatTextArea"
3838import TaskHeader from "./TaskHeader"
3939import AutoApproveMenu from "./AutoApproveMenu"
4040import SystemPromptWarning from "./SystemPromptWarning"
41+ import { useTaskSearch } from "../history/useTaskSearch"
4142interface ChatViewProps {
4243 isHidden : boolean
4344 showAnnouncement : boolean
@@ -82,8 +83,23 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
8283 customModes,
8384 telemetrySetting,
8485 hasSystemPromptOverride,
86+ historyPreviewCollapsed, // Added historyPreviewCollapsed
8587 } = useExtensionState ( )
8688
89+ const { tasks } = useTaskSearch ( )
90+
91+ // Initialize expanded state based on the persisted setting (default to expanded if undefined)
92+ const [ isExpanded , setIsExpanded ] = useState (
93+ historyPreviewCollapsed === undefined ? true : ! historyPreviewCollapsed ,
94+ )
95+
96+ const toggleExpanded = useCallback ( ( ) => {
97+ const newState = ! isExpanded
98+ setIsExpanded ( newState )
99+ // Send message to extension to persist the new collapsed state
100+ vscode . postMessage ( { type : "setHistoryPreviewCollapsed" , bool : ! newState } )
101+ } , [ isExpanded ] )
102+
87103 //const task = messages.length > 0 ? (messages[0].say === "task" ? messages[0] : undefined) : undefined) : undefined
88104 const task = useMemo ( ( ) => messages . at ( 0 ) , [ messages ] ) // leaving this less safe version here since if the first message is not a task, then the extension is in a bad state and needs to be debugged (see Cline.abort)
89105 const modifiedMessages = useMemo ( ( ) => combineApiRequests ( combineCommandSequences ( messages . slice ( 1 ) ) ) , [ messages ] )
@@ -1227,18 +1243,31 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
12271243 ) }
12281244 </ >
12291245 ) : (
1230- < >
1231- { taskHistory . length > 0 && < HistoryPreview showHistoryView = { showHistoryView } /> }
1232- < div className = "flex-1 min-h-0 overflow-y-auto flex flex-col justify-center p-10 gap-1 pb-[10px]" >
1233- { /* Show the task history if there are any for this workspace. */ }
1234-
1235- { telemetrySetting === "unset" && < TelemetryBanner /> }
1246+ < div className = "flex-1 min-h-0 overflow-y-auto flex flex-col gap-4" >
1247+ { /* Moved Task Bar Header Here */ }
1248+ { tasks . length !== 0 && (
1249+ < div className = "flex items-center justify-end text-vscode-descriptionForeground w-full mx-auto max-w-[600px] px-5 pt-3" >
1250+ < div className = "flex items-center gap-1 cursor-pointer" onClick = { toggleExpanded } >
1251+ { tasks . length < 10 && (
1252+ < span className = { `font-medium text-xs ` } > { t ( "history:recentTasks" ) } </ span >
1253+ ) }
1254+ < span
1255+ className = { `codicon ${ isExpanded ? "codicon-eye" : "codicon-eye-closed" } scale-90` }
1256+ />
1257+ </ div >
1258+ </ div >
1259+ ) }
1260+ < div className = { `m-auto ${ isExpanded ? "mt-0" : "" } p-10 pt-5"` } >
12361261 { showAnnouncement && < Announcement version = { version } hideAnnouncement = { hideAnnouncement } /> }
12371262
1238- { /* Always show the hero. */ }
12391263 < RooHero />
1240- { /* If the user has little task history, we can show the onboarding message */ }
1241- { taskHistory . length < 10 && (
1264+ { /* Always show the hero. */ }
1265+
1266+ { telemetrySetting === "unset" && < TelemetryBanner /> }
1267+ { /* Show the task history preview if expanded and tasks exist */ }
1268+ { taskHistory . length > 0 && isExpanded && < HistoryPreview /> }
1269+ { /* If the user has no task history, we can show the onboarding message */ }
1270+ { taskHistory . length > - 1 && (
12421271 < p className = "ext-vscode-editor-foreground leading-tight font-vscode text-center" >
12431272 < Trans
12441273 i18nKey = "chat:about"
@@ -1255,11 +1284,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
12551284 />
12561285 </ p >
12571286 ) }
1258-
1259- { /* Finally, always show the tips */ }
1260- < RooTips cycle = { false } />
1287+ { /* Finally, if there less than 3 tasks, we can show the tips */ }
1288+ { tasks . length > - 1 && < RooTips cycle = { false } /> }
12611289 </ div >
1262- </ >
1290+ </ div >
12631291 ) }
12641292
12651293 { /*
0 commit comments