import { memo, useCallback, useRef, } from 'react' import { useTranslation } from 'react-i18next' import BlockIcon from '../block-icon' import { BlockEnum } from '../types' import type { ToolWithProvider } from '../types' import IndexBar, { groupItems } from './index-bar' import type { ToolDefaultValue } from './types' import Tooltip from '@/app/components/base/tooltip' import Empty from '@/app/components/tools/add-tool-modal/empty' import { useGetLanguage } from '@/context/i18n' type ToolsProps = { showWorkflowEmpty: boolean onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void tools: ToolWithProvider[] } const Blocks = ({ showWorkflowEmpty, onSelect, tools, }: ToolsProps) => { const { t } = useTranslation() const language = useGetLanguage() const { letters, groups: groupedTools } = groupItems(tools, tool => tool.label[language][0]) const toolRefs = useRef({}) const renderGroup = useCallback((toolWithProvider: ToolWithProvider) => { const list = toolWithProvider.tools return (