11import React , { memo , useMemo , useRef , useState } from "react"
22import { useWindowSize } from "react-use"
3- import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
43import prettyBytes from "pretty-bytes"
54import { useTranslation } from "react-i18next"
65
76import { vscode } from "@/utils/vscode"
87import { formatLargeNumber } from "@/utils/format"
98import { calculateTokenDistribution , getMaxTokensForModel } from "@/utils/model-utils"
10- import { Button } from "@/components/ui"
9+ import { Button , Badge } from "@/components/ui"
1110
1211import { ClineMessage } from "../../../../src/shared/ExtensionMessage"
1312import { mentionRegexGlobal } from "../../../../src/shared/context-mentions"
@@ -17,6 +16,7 @@ import { useExtensionState } from "../../context/ExtensionStateContext"
1716import Thumbnails from "../common/Thumbnails"
1817import { normalizeApiConfiguration } from "../settings/ApiOptions"
1918import { DeleteTaskDialog } from "../history/DeleteTaskDialog"
19+ import { cn } from "@/lib/utils"
2020
2121interface TaskHeaderProps {
2222 task : ClineMessage
@@ -55,10 +55,15 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
5555 const shouldShowPromptCacheInfo = doesModelSupportPromptCache && apiConfiguration ?. apiProvider !== "openrouter"
5656
5757 return (
58- < div className = "py-[10px] px-[13px] " >
58+ < div className = "py-2 px-3 " >
5959 < div
60- className = { `rounded p-[10px] flex flex-col gap-[6px] relative z-1 outline hover:outline-vscode-badge-foreground hover:text-vscode-badge-foreground transition-color duration-500 ${ ! ! isTaskExpanded ? "outline-vscode-badge-foreground text-vscode-badge-foreground" : "outline-vscode-badge-foreground/80 text-vscode-badge-foreground/80" } ` } >
61- < div className = "flex justify-between items-center" >
60+ className = { cn (
61+ "rounded-xs p-2.5 flex flex-col gap-1.5 relative z-1 border" ,
62+ ! ! isTaskExpanded
63+ ? "border-vscode-panel-border text-vscode-foreground"
64+ : "border-vscode-panel-border/80 text-vscode-foreground/80" ,
65+ ) } >
66+ < div className = "flex justify-between items-center gap-2" >
6267 < div
6368 className = "flex items-center cursor-pointer -ml-0.5 select-none grow min-w-0"
6469 onClick = { ( ) => setIsTaskExpanded ( ! isTaskExpanded ) } >
@@ -73,14 +78,14 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
7378 { ! isTaskExpanded && < span className = "ml-1" > { highlightMentions ( task . text , false ) } </ span > }
7479 </ div >
7580 </ div >
76-
77- < VSCodeButton
78- appearance = "icon"
81+ < Button
82+ variant = "ghost"
83+ size = "icon"
7984 onClick = { onClose }
80- className = "ml-1.5 shrink-0 text-vscode-badge-foreground"
81- title = { t ( "chat:task.closeAndStart" ) } >
82- < span className = "codicon codicon-close" > </ span >
83- </ VSCodeButton >
85+ title = { t ( "chat:task.closeAndStart" ) }
86+ className = "shrink-0 w-5 h-5" >
87+ < span className = "codicon codicon-close" / >
88+ </ Button >
8489 </ div >
8590 { /* Collapsed state: Track context and cost if we have any */ }
8691 { ! isTaskExpanded && contextWindow > 0 && (
@@ -90,11 +95,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
9095 contextTokens = { contextTokens || 0 }
9196 maxTokens = { getMaxTokensForModel ( selectedModelInfo , apiConfiguration ) }
9297 />
93- { ! ! totalCost && (
94- < div className = "ml-2.5 bg-vscode-editor-foreground text-vscode-editor-background py-0.5 px-1 rounded-full text-[11px] font-medium inline-block shrink-0" >
95- ${ totalCost ?. toFixed ( 2 ) }
96- </ div >
97- ) }
98+ { ! ! totalCost && < Badge > ${ totalCost . toFixed ( 2 ) } </ Badge > }
9899 </ div >
99100 ) }
100101 { /* Expanded state: Show task text and images */ }
@@ -271,7 +272,7 @@ const ContextWindowProgress = ({ contextWindow, contextTokens, maxTokens }: Cont
271272 < div className = "flex-1 relative" >
272273 { /* Invisible overlay for hover area */ }
273274 < div
274- className = "absolute w-full cursor-pointer h-4 -top-[7px] z-5"
275+ className = "absolute w-full h-4 -top-[7px] z-5"
275276 title = { t ( "chat:tokenProgress.availableSpace" , { amount : formatLargeNumber ( availableSize ) } ) }
276277 data-testid = "context-available-space"
277278 />
@@ -282,7 +283,7 @@ const ContextWindowProgress = ({ contextWindow, contextTokens, maxTokens }: Cont
282283 < div className = "relative h-full" style = { { width : `${ currentPercent } %` } } >
283284 { /* Invisible overlay for current tokens section */ }
284285 < div
285- className = "absolute cursor-pointer h-4 -top-[7px] w-full z-6"
286+ className = "absolute h-4 -top-[7px] w-full z-6"
286287 title = { t ( "chat:tokenProgress.tokensUsed" , {
287288 used : formatLargeNumber ( safeContextTokens ) ,
288289 total : formatLargeNumber ( safeContextWindow ) ,
@@ -297,7 +298,7 @@ const ContextWindowProgress = ({ contextWindow, contextTokens, maxTokens }: Cont
297298 < div className = "relative h-full" style = { { width : `${ reservedPercent } %` } } >
298299 { /* Invisible overlay for reserved section */ }
299300 < div
300- className = "absolute cursor-pointer h-4 -top-[7px] w-full z-6"
301+ className = "absolute h-4 -top-[7px] w-full z-6"
301302 title = { t ( "chat:tokenProgress.reservedForResponse" , {
302303 amount : formatLargeNumber ( reservedForOutput ) ,
303304 } ) }
@@ -312,7 +313,7 @@ const ContextWindowProgress = ({ contextWindow, contextTokens, maxTokens }: Cont
312313 < div className = "relative h-full" style = { { width : `${ availablePercent } %` } } >
313314 { /* Invisible overlay for available space */ }
314315 < div
315- className = "absolute cursor-pointer h-4 -top-[7px] w-full z-6"
316+ className = "absolute h-4 -top-[7px] w-full z-6"
316317 title = { t ( "chat:tokenProgress.availableSpace" , {
317318 amount : formatLargeNumber ( availableSize ) ,
318319 } ) }
0 commit comments