| | |
| | | import type { OffsetOptions } from '@floating-ui/react' |
| | | import { |
| | | generateNewNode, |
| | | getNodeCustomTypeByNodeDataType, |
| | | } from '../utils' |
| | | import { |
| | | useAvailableBlocks, |
| | |
| | | const nodes = getNodes() |
| | | const nodesWithSameType = nodes.filter(node => node.data.type === type) |
| | | const { newNode } = generateNewNode({ |
| | | type: getNodeCustomTypeByNodeDataType(type), |
| | | data: { |
| | | ...NODES_INITIAL_DATA[type], |
| | | title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${type}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${type}`), |
| | |
| | | title={t('workflow.common.addBlock')} |
| | | > |
| | | <div className={cn( |
| | | 'flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary', |
| | | 'flex items-center justify-center w-8 h-8 rounded-lg text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary cursor-pointer', |
| | | `${nodesReadOnly && 'cursor-not-allowed text-text-disabled hover:bg-transparent hover:text-text-disabled'}`, |
| | | open && 'bg-state-accent-active text-text-accent', |
| | | )}> |
| | | <RiAddCircleFill className='h-4 w-4' /> |
| | | <RiAddCircleFill className='w-4 h-4' /> |
| | | </div> |
| | | </TipPopup> |
| | | ) |