import React from 'react'; import { TextInput } from '@mantine/core'; import { useTranslation } from 'react-i18next'; import { useRainbowThemeContext } from '../shared/RainbowThemeProvider'; import { useToolPanelState, useToolSelection, useWorkbenchState } from '../../contexts/ToolWorkflowContext'; import ToolPicker from './ToolPicker'; import ToolRenderer from './ToolRenderer'; import { useSidebarContext } from "../../contexts/SidebarContext"; import rainbowStyles from '../../styles/rainbow.module.css'; // No props needed - component uses context export default function ToolPanel() { const { t } = useTranslation(); const { isRainbowMode } = useRainbowThemeContext(); const { sidebarRefs } = useSidebarContext(); const { toolPanelRef } = sidebarRefs; // Use context-based hooks to eliminate prop drilling const { leftPanelView, isPanelVisible, searchQuery, filteredTools, setSearchQuery, handleBackToTools } = useToolPanelState(); const { selectedToolKey, handleToolSelect } = useToolSelection(); const { setPreviewFile } = useWorkbenchState(); return (
{/* Search Bar - Always visible at the top */}
setSearchQuery(e.currentTarget.value)} autoComplete="off" size="sm" />
{leftPanelView === 'toolPicker' ? ( // Tool Picker View
) : ( // Selected Tool Content View
{/* Tool content */}
)}
); }