MCPcopy Create free account
hub / github.com/continuedev/continue / SimpleToolCallUI

Function SimpleToolCallUI

gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx:20–90  ·  view source on GitHub ↗
({
  icon: Icon,
  toolCallState,
  tool,
  historyIndex,
}: SimpleToolCallUIProps)

Source from the content-addressed store, hash-verified

18}
19
20export function SimpleToolCallUI({
21 icon: Icon,
22 toolCallState,
23 tool,
24 historyIndex,
25}: SimpleToolCallUIProps) {
26 const ideMessenger = useContext(IdeMessengerContext);
27 const shownContextItems = useMemo(() => {
28 const contextItems = toolCallStateToContextItems(toolCallState);
29 return contextItems.filter((item) => !item.hidden);
30 }, [toolCallState]);
31
32 const [open, setOpen] = useState(false);
33
34 const isToggleable = shownContextItems.length > 1;
35 const isSingleItem = shownContextItems.length === 1;
36 const shouldShowContent = isToggleable ? open : false;
37 const isClickable = isToggleable || isSingleItem;
38
39 function handleClick() {
40 if (isToggleable) {
41 setOpen((prev) => !prev);
42 } else if (isSingleItem) {
43 openContextItem(shownContextItems[0], ideMessenger);
44 }
45 }
46
47 return (
48 <div className="mt-1 flex flex-col px-4">
49 <div className="flex min-w-0 flex-row items-center justify-between gap-2">
50 <div
51 className={`text-description flex min-w-0 flex-row items-center justify-between gap-1.5 text-xs transition-colors duration-200 ease-in-out ${
52 isClickable ? "cursor-pointer hover:brightness-125" : ""
53 }`}
54 onClick={isClickable ? handleClick : undefined}
55 data-testid="context-items-peek"
56 >
57 <ToggleWithIcon
58 icon={Icon}
59 isToggleable={isToggleable}
60 open={shouldShowContent}
61 isClickable={isSingleItem}
62 />
63 <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
64 </div>
65
66 {!!toolCallState.output?.length && (
67 <ToolTruncateHistoryIcon historyIndex={historyIndex} />
68 )}
69 </div>
70
71 {isToggleable && (
72 <div
73 className={`mt-2 overflow-y-auto transition-all duration-300 ease-in-out ${
74 shouldShowContent ? "max-h-[50vh] opacity-100" : "max-h-0 opacity-0"
75 }`}
76 >
77 {shownContextItems.length > 0 ? (

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected