import { Button } from "@/components/ui/button";
import { X, SkipBack, SkipForward } from "lucide-react";
import { Project } from "@/lib/api";
import { getToolIcon } from "@/components/thread/utils";
import React from "react";
// Simple input interface
export interface ToolCallInput {
assistantCall: {
content?: string;
name?: string;
timestamp?: string;
};
toolResult?: {
content?: string;
isSuccess?: boolean;
timestamp?: string;
};
}
// Helper function to format timestamp
function formatTimestamp(isoString?: string): string {
if (!isoString) return 'No timestamp';
try {
return new Date(isoString).toLocaleString();
} catch (e) {
return 'Invalid date';
}
}
// Simplified generic tool view
function GenericToolView({
name,
assistantContent,
toolContent,
isSuccess = true,
assistantTimestamp,
toolTimestamp
}: {
name?: string;
assistantContent?: string;
toolContent?: string;
isSuccess?: boolean;
assistantTimestamp?: string;
toolTimestamp?: string;
}) {
const toolName = name || 'Unknown Tool';
return (
{React.createElement(getToolIcon(toolName), { className: "h-4 w-4" })}
{toolName}
{toolContent && (
{isSuccess ? 'Success' : 'Failed'}
)}
{/* Assistant Message */}
Assistant Message
{assistantTimestamp && (
{formatTimestamp(assistantTimestamp)}
)}
{/* Tool Result */}
{toolContent && (
Tool Result
{toolTimestamp && (
{formatTimestamp(toolTimestamp)}
)}
)}
);
}
interface ToolCallSidePanelProps {
isOpen: boolean;
onClose: () => void;
toolCalls: ToolCallInput[];
currentIndex: number;
onNavigate: (newIndex: number) => void;
project?: Project;
}
export function ToolCallSidePanel({
isOpen,
onClose,
toolCalls,
currentIndex,
onNavigate,
project
}: ToolCallSidePanelProps) {
if (!isOpen) return null;
const currentToolCall = toolCalls[currentIndex];
const totalCalls = toolCalls.length;
const renderContent = () => {
if (!currentToolCall) {
return (
);
}
return (
);
};
return (
Tool Details
{renderContent()}
{totalCalls > 1 && (
{currentIndex + 1} of {totalCalls}
)}
);
}