Skip to content

Commit 8a289d9

Browse files
committed
Corrected location of the browser session indicator in the task header.
1 parent ff44f0b commit 8a289d9

File tree

1 file changed

+85
-80
lines changed

1 file changed

+85
-80
lines changed

webview-ui/src/components/chat/TaskHeader.tsx

Lines changed: 85 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -196,53 +196,93 @@ const TaskHeader = ({
196196
</div>
197197
{!isTaskExpanded && contextWindow > 0 && (
198198
<div
199-
className="flex items-center gap-2 text-sm text-muted-foreground/70"
199+
className="flex items-center justify-between text-sm text-muted-foreground/70"
200200
onClick={(e) => e.stopPropagation()}>
201-
<Coins className="size-3 shrink-0" />
202-
<StandardTooltip
203-
content={
204-
<div className="space-y-1">
205-
<div>
206-
{t("chat:tokenProgress.tokensUsed", {
207-
used: formatLargeNumber(contextTokens || 0),
208-
total: formatLargeNumber(contextWindow),
209-
})}
210-
</div>
211-
{(() => {
212-
const maxTokens = model
213-
? getModelMaxOutputTokens({ modelId, model, settings: apiConfiguration })
214-
: 0
215-
const reservedForOutput = maxTokens || 0
216-
const availableSpace = contextWindow - (contextTokens || 0) - reservedForOutput
201+
<div className="flex items-center gap-2">
202+
<Coins className="size-3 shrink-0" />
203+
<StandardTooltip
204+
content={
205+
<div className="space-y-1">
206+
<div>
207+
{t("chat:tokenProgress.tokensUsed", {
208+
used: formatLargeNumber(contextTokens || 0),
209+
total: formatLargeNumber(contextWindow),
210+
})}
211+
</div>
212+
{(() => {
213+
const maxTokens = model
214+
? getModelMaxOutputTokens({
215+
modelId,
216+
model,
217+
settings: apiConfiguration,
218+
})
219+
: 0
220+
const reservedForOutput = maxTokens || 0
221+
const availableSpace =
222+
contextWindow - (contextTokens || 0) - reservedForOutput
217223

218-
return (
219-
<>
220-
{reservedForOutput > 0 && (
221-
<div>
222-
{t("chat:tokenProgress.reservedForResponse", {
223-
amount: formatLargeNumber(reservedForOutput),
224-
})}
225-
</div>
226-
)}
227-
{availableSpace > 0 && (
228-
<div>
229-
{t("chat:tokenProgress.availableSpace", {
230-
amount: formatLargeNumber(availableSpace),
231-
})}
232-
</div>
233-
)}
234-
</>
235-
)
236-
})()}
237-
</div>
238-
}
239-
side="top"
240-
sideOffset={8}>
241-
<span className="mr-1">
242-
{formatLargeNumber(contextTokens || 0)} / {formatLargeNumber(contextWindow)}
243-
</span>
244-
</StandardTooltip>
245-
{!!totalCost && <span>${totalCost.toFixed(2)}</span>}
224+
return (
225+
<>
226+
{reservedForOutput > 0 && (
227+
<div>
228+
{t("chat:tokenProgress.reservedForResponse", {
229+
amount: formatLargeNumber(reservedForOutput),
230+
})}
231+
</div>
232+
)}
233+
{availableSpace > 0 && (
234+
<div>
235+
{t("chat:tokenProgress.availableSpace", {
236+
amount: formatLargeNumber(availableSpace),
237+
})}
238+
</div>
239+
)}
240+
</>
241+
)
242+
})()}
243+
</div>
244+
}
245+
side="top"
246+
sideOffset={8}>
247+
<span className="mr-1">
248+
{formatLargeNumber(contextTokens || 0)} / {formatLargeNumber(contextWindow)}
249+
</span>
250+
</StandardTooltip>
251+
{!!totalCost && <span>${totalCost.toFixed(2)}</span>}
252+
</div>
253+
{showBrowserGlobe && (
254+
<div className="flex items-center gap-1" onClick={(e) => e.stopPropagation()}>
255+
<StandardTooltip content={t("chat:browser.session")}>
256+
<Button
257+
variant="ghost"
258+
size="sm"
259+
aria-label={t("chat:browser.session")}
260+
onClick={() => vscode.postMessage({ type: "openBrowserSessionPanel" } as any)}
261+
className={cn(
262+
"relative h-5 w-5 p-0",
263+
"text-vscode-foreground opacity-85",
264+
"hover:opacity-100 hover:bg-[rgba(255,255,255,0.03)]",
265+
"focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder",
266+
)}>
267+
<Globe
268+
className="w-4 h-4"
269+
style={{
270+
color: isBrowserSessionActive
271+
? "#4ade80"
272+
: "var(--vscode-descriptionForeground)",
273+
}}
274+
/>
275+
</Button>
276+
</StandardTooltip>
277+
{isBrowserSessionActive && (
278+
<span
279+
className="text-sm font-medium"
280+
style={{ color: "var(--vscode-testing-iconPassed)" }}>
281+
Active
282+
</span>
283+
)}
284+
</div>
285+
)}
246286
</div>
247287
)}
248288
{/* Expanded state: Show task text and images */}
@@ -369,41 +409,6 @@ const TaskHeader = ({
369409
)}
370410
{/* Todo list - always shown at bottom when todos exist */}
371411
{hasTodos && <TodoListDisplay todos={todos ?? (task as any)?.tool?.todos ?? []} />}
372-
373-
{/* Browser session status moved from bottom bar to header (bottom-right) */}
374-
{showBrowserGlobe && (
375-
<div
376-
className="absolute bottom-2 right-3 flex items-center gap-1"
377-
onClick={(e) => e.stopPropagation()}>
378-
<StandardTooltip content={t("chat:browser.session")}>
379-
<Button
380-
variant="ghost"
381-
size="sm"
382-
aria-label={t("chat:browser.session")}
383-
onClick={() => vscode.postMessage({ type: "openBrowserSessionPanel" } as any)}
384-
className={cn(
385-
"relative h-5 w-5 p-0",
386-
"text-vscode-foreground opacity-85",
387-
"hover:opacity-100 hover:bg-[rgba(255,255,255,0.03)]",
388-
"focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder",
389-
)}>
390-
<Globe
391-
className="w-4 h-4"
392-
style={{
393-
color: isBrowserSessionActive
394-
? "#4ade80"
395-
: "var(--vscode-descriptionForeground)",
396-
}}
397-
/>
398-
</Button>
399-
</StandardTooltip>
400-
{isBrowserSessionActive && (
401-
<span className="text-sm font-medium" style={{ color: "var(--vscode-testing-iconPassed)" }}>
402-
Active
403-
</span>
404-
)}
405-
</div>
406-
)}
407412
</div>
408413
<CloudUpsellDialog open={isOpen} onOpenChange={closeUpsell} onConnect={handleConnect} />
409414
</div>

0 commit comments

Comments
 (0)