From 28e5a7195358e2cdc04b76fc9e458186dced1942 Mon Sep 17 00:00:00 2001 From: Chris Scott <> Date: Mon, 27 Apr 2026 15:09:33 +0000 Subject: [PATCH] refactor(frontend): streamline session tool cards --- .../src/components/message/FileToolRender.tsx | 73 ++++++++----- .../src/components/message/MessagePart.tsx | 16 ++- .../components/message/MessageThread.test.tsx | 53 +++++++-- .../src/components/message/MessageThread.tsx | 34 +++--- .../src/components/message/ToolCallPart.tsx | 102 +++++++++++------- 5 files changed, 184 insertions(+), 94 deletions(-) diff --git a/frontend/src/components/message/FileToolRender.tsx b/frontend/src/components/message/FileToolRender.tsx index ea684803..1b381ff4 100644 --- a/frontend/src/components/message/FileToolRender.tsx +++ b/frontend/src/components/message/FileToolRender.tsx @@ -53,6 +53,11 @@ export function getRelativePath(filePath: string): string { return filePath } +function getFileName(filePath: string): string { + const normalizedPath = filePath.replace(/\/+$/, '') + return normalizedPath.split('/').pop() || filePath +} + interface FileToolRenderProps { part: ToolPart filediff?: FileDiffData @@ -60,14 +65,17 @@ interface FileToolRenderProps { content?: string toolName: string onFileClick?: (filePath: string, lineNumber?: number) => void + messageMeta?: { + model: string + time?: number + } } -export function FileToolRender({ part, filediff, filePath, content, toolName, onFileClick }: FileToolRenderProps) { +export function FileToolRender({ part, filediff, filePath, content, toolName, onFileClick, messageMeta }: FileToolRenderProps) { const { preferences } = useSettings() - const isReadTool = toolName === 'Read' const isEditTool = toolName === 'Edit' const isWriteTool = toolName === 'Write' - const hasExpandableContent = !isReadTool && (filediff || content) + const hasExpandableContent = Boolean(filediff || content) const isFileMutatingTool = isEditTool || isWriteTool const defaultExpanded = isFileMutatingTool @@ -90,29 +98,38 @@ export function FileToolRender({ part, filediff, filePath, content, toolName, on } return ( -