From 5629199d5134850f80a9045458d34d9e6fa38f29 Mon Sep 17 00:00:00 2001 From: "roomote[bot]" <219738659+roomote[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 13:26:32 -0400 Subject: [PATCH] Add jump icon for newly created files (#5738) * feat: add jump icon for newly created files - Add jump icon to newFileCreated tool case in ChatRow.tsx - Matches existing pattern from readFile case for consistent UX - Allows users to quickly open newly created files - Fixes issue #5736 * fix: remove duplicate file path display in newFileCreated case - Removed redundant ToolUseBlock that was showing file path twice - Added onJumpToFile prop to CodeAccordian component to support jump icon - Jump icon now appears in CodeAccordian header for newFileCreated files - Maintains consistent UX with existing file operations while avoiding duplication Fixes feedback from @daniel-lxs about duplicate elements being shown * fix: address PR feedback for jump icon on new files - Fix openFile message to use correct path format with './' prefix - Remove duplicate chevron icon when jump icon is present - Add aria-label for accessibility - Fix styling: use mr-1 to match progressStatus icon - Remove redundant margin style from jump icon --------- Co-authored-by: Roo Code Co-authored-by: Roo Code Co-authored-by: Daniel Riccio --- webview-ui/src/components/chat/ChatRow.tsx | 1 + .../src/components/common/CodeAccordian.tsx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 926bd400f0..4fa921f443 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -533,6 +533,7 @@ export const ChatRowContent = ({ isLoading={message.partial} isExpanded={isExpanded} onToggleExpand={handleToggleExpand} + onJumpToFile={() => vscode.postMessage({ type: "openFile", text: "./" + tool.path })} /> ) diff --git a/webview-ui/src/components/common/CodeAccordian.tsx b/webview-ui/src/components/common/CodeAccordian.tsx index b07461c70e..7dcef11e10 100644 --- a/webview-ui/src/components/common/CodeAccordian.tsx +++ b/webview-ui/src/components/common/CodeAccordian.tsx @@ -17,6 +17,7 @@ interface CodeAccordianProps { isFeedback?: boolean onToggleExpand: () => void header?: string + onJumpToFile?: () => void } const CodeAccordian = ({ @@ -29,6 +30,7 @@ const CodeAccordian = ({ isFeedback, onToggleExpand, header, + onJumpToFile, }: CodeAccordianProps) => { const inferredLanguage = useMemo(() => language ?? (path ? getLanguageFromPath(path) : "txt"), [path, language]) const source = useMemo(() => code.trim(), [code]) @@ -68,7 +70,18 @@ const CodeAccordian = ({ )} - + {onJumpToFile && path && ( + { + e.stopPropagation() + onJumpToFile() + }} + aria-label={`Open file: ${path}`} + /> + )} + {!onJumpToFile && } )} {(!hasHeader || isExpanded) && (