Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-condense-button-to-collapsed-task-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"zoo-code": patch
---

Surface the manual context compaction button and linear context window progress bar on the right side of the collapsed task header.
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webview-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"i18next": "^25.0.0",
"katex": "^0.16.11",
"lru-cache": "^11.1.0",
"lucide-react": "^0.518.0",
"lucide-react": "^1.18.0",
"mermaid": "^11.4.1",
"posthog-js": "^1.227.2",
"pretty-bytes": "^7.0.0",
Expand Down
12 changes: 10 additions & 2 deletions webview-ui/src/components/chat/TaskHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo, useRef, useState, useMemo } from "react"
import { useTranslation } from "react-i18next"
import { ChevronUp, ChevronDown, HardDriveDownload, HardDriveUpload, FoldVertical, ArrowLeft } from "lucide-react"
import { ChevronUp, ChevronDown, HardDriveDownload, HardDriveUpload, ListChevronsDownUp, ArrowLeft } from "lucide-react"
import prettyBytes from "pretty-bytes"

import type { ClineMessage } from "@roo-code/types"
Expand Down Expand Up @@ -81,7 +81,7 @@ const TaskHeader = ({
const condenseButton = (
<LucideIconButton
title={t("chat:task.condenseContext")}
icon={FoldVertical}
icon={ListChevronsDownUp}
disabled={buttonsDisabled}
onClick={() => currentTaskItem && handleCondenseContext(currentTaskItem.id)}
/>
Expand Down Expand Up @@ -274,6 +274,14 @@ const TaskHeader = ({
</>
)}
</div>
<div className="flex items-center gap-1 ml-8 w-60 min-w-[120px] shrink">
<ContextWindowProgress
contextWindow={contextWindow}
contextTokens={contextTokens || 0}
maxTokens={maxTokens || undefined}
/>
{condenseButton}
</div>
</div>
)}
{/* Expanded state: Show task text and images */}
Expand Down
29 changes: 14 additions & 15 deletions webview-ui/src/components/chat/__tests__/TaskHeader.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,22 @@ describe("TaskHeader", () => {
expect(screen.queryByText(/\$/)).not.toBeInTheDocument()
})

it("should render the condense context button in the collapsed state", () => {
renderTaskHeader()
// Button is visible without expanding the task header
const buttons = screen.getAllByRole("button")
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-list-chevrons-down-up"))
expect(condenseButton).toBeDefined()
expect(condenseButton?.querySelector("svg")).toBeInTheDocument()
})
Comment thread
coderabbitai[bot] marked this conversation as resolved.

it("should render the condense context button when expanded", () => {
renderTaskHeader()
// First click to expand the task header
const taskHeader = screen.getByText("Test task")
fireEvent.click(taskHeader)

// Now find the condense button in the expanded state
const buttons = screen.getAllByRole("button")
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-fold-vertical"))
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-list-chevrons-down-up"))
expect(condenseButton).toBeDefined()
expect(condenseButton?.querySelector("svg")).toBeInTheDocument()
})
Expand All @@ -150,13 +157,9 @@ describe("TaskHeader", () => {
const handleCondenseContext = vi.fn()
renderTaskHeader({ handleCondenseContext })

// First click to expand the task header
const taskHeader = screen.getByText("Test task")
fireEvent.click(taskHeader)

// Find the button that contains the FoldVertical icon
// Button is clickable in collapsed state without expanding first
const buttons = screen.getAllByRole("button")
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-fold-vertical"))
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-list-chevrons-down-up"))
expect(condenseButton).toBeDefined()
fireEvent.click(condenseButton!)
expect(handleCondenseContext).toHaveBeenCalledWith("test-task-id")
Expand All @@ -166,13 +169,9 @@ describe("TaskHeader", () => {
const handleCondenseContext = vi.fn()
renderTaskHeader({ buttonsDisabled: true, handleCondenseContext })

// First click to expand the task header
const taskHeader = screen.getByText("Test task")
fireEvent.click(taskHeader)

// Find the button that contains the FoldVertical icon
// Button is disabled in collapsed state without expanding first
const buttons = screen.getAllByRole("button")
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-fold-vertical"))
const condenseButton = buttons.find((button) => button.querySelector("svg.lucide-list-chevrons-down-up"))
expect(condenseButton).toBeDefined()
expect(condenseButton).toBeDisabled()
fireEvent.click(condenseButton!)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react"
import { useTranslation } from "react-i18next"
import { VSCodeBadge } from "@vscode/webview-ui-toolkit/react"
import { FoldVertical } from "lucide-react"
import { ListChevronsDownUp } from "lucide-react"

import type { ContextCondense } from "@roo-code/types"

Expand Down Expand Up @@ -32,7 +32,7 @@ export function CondensationResultRow({ data }: CondensationResultRowProps) {
className="flex items-center justify-between cursor-pointer select-none"
onClick={() => setIsExpanded(!isExpanded)}>
<div className="flex items-center gap-2 flex-grow">
<FoldVertical size={16} className="text-vscode-foreground" />
<ListChevronsDownUp size={16} className="text-vscode-foreground" />
<span className="font-bold text-vscode-foreground">
{t("chat:contextManagement.condensation.title")}
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react"
import { useTranslation } from "react-i18next"
import { FoldVertical } from "lucide-react"
import { ScissorsLineDashed } from "lucide-react"

import type { ContextTruncation } from "@roo-code/types"

Expand Down Expand Up @@ -33,7 +33,7 @@ export function TruncationResultRow({ data }: TruncationResultRowProps) {
className="flex items-center justify-between cursor-pointer select-none"
onClick={() => setIsExpanded(!isExpanded)}>
<div className="flex items-center gap-2 flex-grow">
<FoldVertical size={16} className="text-vscode-foreground" />
<ScissorsLineDashed size={16} className="text-vscode-foreground" />
<span className="font-bold text-vscode-foreground">
{t("chat:contextManagement.truncation.title")}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HTMLAttributes } from "react"
import React from "react"
import { useAppTranslation } from "@/i18n/TranslationContext"
import { VSCodeCheckbox, VSCodeTextArea } from "@vscode/webview-ui-toolkit/react"
import { FoldVertical } from "lucide-react"
import { ListChevronsDownUp } from "lucide-react"

import { supportPrompt } from "@roo/support-prompt"

Expand Down Expand Up @@ -487,7 +487,7 @@ export const ContextManagementSettings = ({
{autoCondenseContext && (
<div className="flex flex-col gap-3 pl-3 border-l-2 border-vscode-button-background">
<div className="flex items-center gap-4 font-bold">
<FoldVertical size={16} />
<ListChevronsDownUp size={16} />
<div>{t("settings:contextManagement.condensingThreshold.label")}</div>
</div>
<div>
Expand Down
Loading