Adjust position of focus chain edit button (#5609)
* Adjust position of focus chain edit button * Update webview-ui/src/components/chat/task-header/TaskHeader.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
2 files changed
+53
-34
No files matched your search
@@ -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.
|
||||
@@ -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<TaskHeaderProps> = ({
|
||||
}}>
|
||||
<ChecklistRenderer text={lastProgressMessageText} />
|
||||
{/* Edit button for focus chain list */}
|
||||
{parseCurrentTodoInfo(lastProgressMessageText)?.hasItems && (
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
onClick={async () => {
|
||||
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">
|
||||
<span
|
||||
className="codicon codicon-edit"
|
||||
style={{
|
||||
fontSize: "12px",
|
||||
color: "var(--vscode-badge-foreground)",
|
||||
}}></span>
|
||||
</VSCodeButton>
|
||||
)}
|
||||
{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 (
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
onClick={async () => {
|
||||
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">
|
||||
<span
|
||||
className="codicon codicon-edit"
|
||||
style={{
|
||||
fontSize: "14px",
|
||||
color: "var(--vscode-badge-foreground)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}></span>
|
||||
</VSCodeButton>
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user