Skip to content

Commit 5761d53

Browse files
committed
🤖 Create shared ToolIcon component for consistent emoji + tooltip pattern
- Add ToolIcon component in shared/ToolIcon.tsx - Update all tool components to use ToolIcon (except GenericToolCall) - BashToolCall: 🔧 bash - FileReadToolCall: 📖 file_read - FileListToolCall: 📖 file_list (changed from 📋) - FileEditToolCall: ✏️ file_edit_* - TodoToolCall: 📋 todo_write - ProposePlanToolCall: 📋 propose_plan (added tooltip) - GenericToolCall remains unchanged (text-only fallback) - Consistent tooltip pattern: hover over emoji shows full tool name This abstracts the emoji+tooltip pattern into a single reusable component, ensures consistency across all specialized tool displays, and unifies the file_read and file_list emojis to 📖.
1 parent 6fdb7dc commit 5761d53

File tree

7 files changed

+33
-22
lines changed

7 files changed

+33
-22
lines changed

src/components/tools/BashToolCall.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
LoadingDots,
1515
} from "./shared/ToolPrimitives";
1616
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
17-
import { TooltipWrapper, Tooltip } from "../Tooltip";
17+
import { ToolIcon } from "./shared/ToolIcon";
1818

1919
// Bash-specific styled components
2020

@@ -123,10 +123,7 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
123123
<ToolContainer expanded={expanded}>
124124
<ToolHeader onClick={toggleExpanded}>
125125
<ExpandIcon expanded={expanded}></ExpandIcon>
126-
<TooltipWrapper inline>
127-
<span>🔧</span>
128-
<Tooltip>bash</Tooltip>
129-
</TooltipWrapper>
126+
<ToolIcon emoji="🔧" toolName="bash" />
130127
<ScriptPreview>{args.script}</ScriptPreview>
131128
<TimeoutInfo status={isPending ? status : undefined}>
132129
timeout: {args.timeout_secs ?? BASH_DEFAULT_TIMEOUT_SECS}s

src/components/tools/FileEditToolCall.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
HeaderButton,
2222
} from "./shared/ToolPrimitives";
2323
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
24-
import { TooltipWrapper, Tooltip } from "../Tooltip";
24+
import { ToolIcon } from "./shared/ToolIcon";
2525

2626
// File edit specific styled components
2727

@@ -290,10 +290,7 @@ export const FileEditToolCall: React.FC<FileEditToolCallProps> = ({
290290
<StyledToolHeader>
291291
<LeftContent onClick={toggleExpanded}>
292292
<ExpandIcon expanded={expanded}></ExpandIcon>
293-
<TooltipWrapper inline>
294-
<span>✏️</span>
295-
<Tooltip>{toolName}</Tooltip>
296-
</TooltipWrapper>
293+
<ToolIcon emoji="✏️" toolName={toolName} />
297294
<FilePath>{filePath}</FilePath>
298295
</LeftContent>
299296
{!(result && result.success && result.diff) && (

src/components/tools/FileListToolCall.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
LoadingDots,
1313
} from "./shared/ToolPrimitives";
1414
import { useToolExpansion, getStatusDisplay, ToolStatus } from "./shared/toolUtils";
15+
import { ToolIcon } from "./shared/ToolIcon";
1516

1617
// FileList-specific styled components
1718

@@ -107,7 +108,7 @@ export const FileListToolCall: React.FC<FileListToolCallProps> = ({ args, result
107108
<ToolContainer expanded={expanded}>
108109
<ToolHeader onClick={toggleExpanded}>
109110
<ExpandIcon expanded={expanded}></ExpandIcon>
110-
<span>📋 file_list</span>
111+
<ToolIcon emoji="📖" toolName="file_list" />
111112
<PathText>{args.path}</PathText>
112113
{paramStr && <ParamsText>{paramStr}</ParamsText>}
113114
{isComplete && result && result.success && (

src/components/tools/FileReadToolCall.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
LoadingDots,
1414
} from "./shared/ToolPrimitives";
1515
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
16-
import { TooltipWrapper, Tooltip } from "../Tooltip";
16+
import { ToolIcon } from "./shared/ToolIcon";
1717

1818
// FileRead-specific styled components
1919

@@ -165,10 +165,7 @@ export const FileReadToolCall: React.FC<FileReadToolCallProps> = ({
165165
<ToolContainer expanded={expanded}>
166166
<ToolHeader onClick={toggleExpanded}>
167167
<ExpandIcon expanded={expanded}></ExpandIcon>
168-
<TooltipWrapper inline>
169-
<span>📖</span>
170-
<Tooltip>file_read</Tooltip>
171-
</TooltipWrapper>
168+
<ToolIcon emoji="📖" toolName="file_read" />
172169
<FilePathText>{filePath}</FilePathText>
173170
{result && result.success && parsedContent && (
174171
<MetadataText>

src/components/tools/ProposePlanToolCall.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ToolDetails,
1111
} from "./shared/ToolPrimitives";
1212
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
13+
import { ToolIcon } from "./shared/ToolIcon";
1314
import { MarkdownRenderer } from "../Messages/MarkdownRenderer";
1415
import { formatKeybind, KEYBINDS } from "@/utils/ui/keybinds";
1516
import { useStartHere } from "@/hooks/useStartHere";
@@ -285,7 +286,7 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
285286
<ToolContainer expanded={expanded}>
286287
<ToolHeader onClick={toggleExpanded}>
287288
<ExpandIcon expanded={expanded}></ExpandIcon>
288-
<ToolName>propose_plan</ToolName>
289+
<ToolIcon emoji="📋" toolName="propose_plan" />
289290
<StatusIndicator status={status}>{statusDisplay}</StatusIndicator>
290291
</ToolHeader>
291292

src/components/tools/TodoToolCall.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
ToolDetails,
99
} from "./shared/ToolPrimitives";
1010
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
11-
import { TooltipWrapper, Tooltip } from "../Tooltip";
11+
import { ToolIcon } from "./shared/ToolIcon";
1212
import { TodoList } from "../TodoList";
1313

1414
interface TodoToolCallProps {
@@ -29,10 +29,7 @@ export const TodoToolCall: React.FC<TodoToolCallProps> = ({
2929
<ToolContainer expanded={expanded}>
3030
<ToolHeader onClick={toggleExpanded}>
3131
<ExpandIcon expanded={expanded}></ExpandIcon>
32-
<TooltipWrapper inline>
33-
<span>📋</span>
34-
<Tooltip>todo_write</Tooltip>
35-
</TooltipWrapper>
32+
<ToolIcon emoji="📋" toolName="todo_write" />
3633
<StatusIndicator status={status}>{statusDisplay}</StatusIndicator>
3734
</ToolHeader>
3835

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
import { TooltipWrapper, Tooltip } from "../../Tooltip";
3+
4+
interface ToolIconProps {
5+
emoji: string;
6+
toolName: string;
7+
}
8+
9+
/**
10+
* Shared component for displaying tool emoji with tooltip showing the full tool name.
11+
* Used consistently across all tool components in ToolHeader.
12+
*/
13+
export const ToolIcon: React.FC<ToolIconProps> = ({ emoji, toolName }) => {
14+
return (
15+
<TooltipWrapper inline>
16+
<span>{emoji}</span>
17+
<Tooltip>{toolName}</Tooltip>
18+
</TooltipWrapper>
19+
);
20+
};
21+

0 commit comments

Comments
 (0)