import { useRainbowThemeContext } from '../shared/RainbowThemeProvider'; import { useToolWorkflow } from '../../contexts/ToolWorkflowContext'; import ToolPicker from './ToolPicker'; import SearchResults from './SearchResults'; import ToolRenderer from './ToolRenderer'; import ToolSearch from './toolPicker/ToolSearch'; import { useSidebarContext } from "../../contexts/SidebarContext"; import rainbowStyles from '../../styles/rainbow.module.css'; import { ScrollArea } from '@mantine/core'; // No props needed - component uses context export default function ToolPanel() { const { isRainbowMode } = useRainbowThemeContext(); const { sidebarRefs } = useSidebarContext(); const { toolPanelRef } = sidebarRefs; // Use context-based hooks to eliminate prop drilling const { leftPanelView, isPanelVisible, searchQuery, filteredTools, toolRegistry, setSearchQuery, } = useToolWorkflow(); const { selectedToolKey, handleToolSelect } = useToolWorkflow(); const { setPreviewFile } = useToolWorkflow(); return (
{/* Search Bar - Always visible at the top */}
{searchQuery.trim().length > 0 ? ( // Searching view (replaces both picker and content)
) : leftPanelView === 'toolPicker' ? ( // Tool Picker View
0)} />
) : ( // Selected Tool Content View
{/* Tool content */}
{selectedToolKey && ( )}
)}
); }