diff --git a/.changeset/new-goats-hang.md b/.changeset/new-goats-hang.md new file mode 100644 index 00000000..80a8b1cd --- /dev/null +++ b/.changeset/new-goats-hang.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Logic to move the position of the focus chain edit button when a scrollbar is present. Also made the pencil icon bigger and better centered. diff --git a/webview-ui/src/components/chat/task-header/TaskHeader.tsx b/webview-ui/src/components/chat/task-header/TaskHeader.tsx index 8c59b2c3..c9dd8b75 100644 --- a/webview-ui/src/components/chat/task-header/TaskHeader.tsx +++ b/webview-ui/src/components/chat/task-header/TaskHeader.tsx @@ -6,7 +6,7 @@ import { FileServiceClient, TaskServiceClient, UiServiceClient } from "@/service import { formatLargeNumber, formatSize } from "@/utils/format" import { validateSlashCommand } from "@/utils/slash-commands" import { mentionRegexGlobal } from "@shared/context-mentions" -import { isFocusChainItem, isCompletedFocusChainItem } from "@shared/focus-chain-utils" +import { isFocusChainItem, isCompletedFocusChainItem, FOCUS_CHAIN_ITEM_REGEX } from "@shared/focus-chain-utils" import { ClineMessage } from "@shared/ExtensionMessage" import { StringArrayRequest, StringRequest } from "@shared/proto/cline/common" import { VSCodeButton } from "@vscode/webview-ui-toolkit/react" @@ -694,39 +694,53 @@ const TaskHeader: React.FC = ({ }}> {/* Edit button for focus chain list */} - {parseCurrentTodoInfo(lastProgressMessageText)?.hasItems && ( - { - try { - await FileServiceClient.openFocusChainFile( - StringRequest.create({ value: currentTaskItem?.id || "" }), - ) - } catch (error) { - console.error("Error opening todo file:", error) - } - }} - style={{ - position: "absolute", - top: "4px", - right: "4px", - width: "20px", - height: "20px", - minWidth: "20px", - padding: "0", - backgroundColor: - "color-mix(in srgb, var(--vscode-badge-foreground) 10%, transparent)", - border: "1px solid color-mix(in srgb, var(--vscode-badge-foreground) 20%, transparent)", - }} - title="Edit focus chain list in markdown file"> - - - )} + {parseCurrentTodoInfo(lastProgressMessageText)?.hasItems && + (() => { + // Used to adjust the position of the focus chain edit button as needed + const lines = lastProgressMessageText.split("\n").filter((line) => line.trim()) + const items = lines.filter((line) => { + const trimmedLine = line.trim() + return trimmedLine.match(FOCUS_CHAIN_ITEM_REGEX) + }) + const hasScrollbar = items.length >= 10 + + return ( + { + try { + await FileServiceClient.openFocusChainFile( + StringRequest.create({ value: currentTaskItem?.id || "" }), + ) + } catch (error) { + console.error("Error opening todo file:", error) + } + }} + style={{ + position: "absolute", + top: "3px", + right: hasScrollbar ? "22px" : "4px", + width: "20px", + height: "20px", + minWidth: "20px", + padding: "0", + backgroundColor: + "color-mix(in srgb, var(--vscode-badge-foreground) 10%, transparent)", + border: "1px solid color-mix(in srgb, var(--vscode-badge-foreground) 20%, transparent)", + }} + title="Edit focus chain list in markdown file"> + + + ) + })()} )}