import type { LoopNodeType } from './types' import type { OnSelectBlock } from '@/app/components/workflow/types' import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiAddLine } from '@remixicon/react' import { memo, useCallback } from 'react' import { useTranslation } from 'react-i18next' import BlockSelector from '@/app/components/workflow/block-selector' import { BlockEnum } from '@/app/components/workflow/types' import { useAvailableBlocks, useNodesInteractions, useNodesReadOnly } from '../../hooks' type AddBlockProps = { loopNodeId: string loopNodeData: LoopNodeType } const AddBlock = ({ loopNodeData }: AddBlockProps) => { const { t } = useTranslation() const { nodesReadOnly } = useNodesReadOnly() const { handleNodeAdd } = useNodesInteractions() const { availableNextBlocks } = useAvailableBlocks(BlockEnum.Start, true) const handleSelect = useCallback( (type, pluginDefaultValue) => { handleNodeAdd( { nodeType: type, pluginDefaultValue, }, { prevNodeId: loopNodeData.start_node_id, prevNodeSourceHandle: 'source', }, ) }, [handleNodeAdd, loopNodeData.start_node_id], ) const renderTriggerElement = useCallback( (open: boolean) => { return ( ) }, [nodesReadOnly, t], ) return (
) } export default memo(AddBlock)