import React, { Suspense } from "react"; import { useToolManagement } from "../../hooks/useToolManagement"; import { BaseToolProps } from "../../types/tool"; import ToolLoadingFallback from "./ToolLoadingFallback"; interface ToolRendererProps extends BaseToolProps { selectedToolKey: string; } const ToolRenderer = ({ selectedToolKey, onPreviewFile, onComplete, onError, }: ToolRendererProps) => { // Get the tool from registry const { toolRegistry } = useToolManagement(); const selectedTool = toolRegistry[selectedToolKey]; if (!selectedTool || !selectedTool.component) { return
Tool not found: {selectedToolKey}
; } const ToolComponent = selectedTool.component; // Wrap lazy-loaded component with Suspense return ( }> ); }; export default ToolRenderer;