File size: 1,252 Bytes
68ed806 f43283a 457b4e6 38eebf9 457b4e6 f43283a 457b4e6 38eebf9 457b4e6 f43283a 457b4e6 f43283a 38eebf9 457b4e6 2653e84 457b4e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import { useTranslate } from '@/hooks/common-hooks';
import { Flex } from 'antd';
import classNames from 'classnames';
import lowerFirst from 'lodash/lowerFirst';
import { Handle, NodeProps, Position } from 'reactflow';
import { Operator, operatorMap } from '../../constant';
import { NodeData } from '../../interface';
import styles from './index.less';
// TODO: do not allow other nodes to connect to this node
export function BeginNode({ id, data, selected }: NodeProps<NodeData>) {
const { t } = useTranslate('flow');
return (
<section
className={classNames(styles.ragNode, {
[styles.selectedNode]: selected,
})}
style={{
backgroundColor: operatorMap[data.label as Operator].backgroundColor,
color: 'white',
width: 50,
height: 50,
}}
>
<Handle
type="source"
position={Position.Right}
isConnectable
className={styles.handle}
></Handle>
<Flex vertical align="center" justify="center" gap={6}>
<span className={styles.type}>{t(lowerFirst(data.label))}</span>
</Flex>
<section className={styles.bottomBox}>
<div className={styles.nodeName}>{data.name}</div>
</section>
</section>
);
}
|