### What problem does this PR solve? feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { Flex } from 'antd';
|
|
import classNames from 'classnames';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { Handle, NodeProps, Position } from 'reactflow';
|
|
import { Operator, operatorMap } from '../../constant';
|
|
import { NodeData } from '../../interface';
|
|
import OperatorIcon from '../../operator-icon';
|
|
import { RightHandleStyle } from './handle-icon';
|
|
import styles from './index.less';
|
|
|
|
// TODO: do not allow other nodes to connect to this node
|
|
export function BeginNode({ selected, data }: NodeProps<NodeData>) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<section
|
|
className={classNames(styles.ragNode, {
|
|
[styles.selectedNode]: selected,
|
|
})}
|
|
style={{
|
|
width: 100,
|
|
}}
|
|
>
|
|
<Handle
|
|
type="source"
|
|
position={Position.Right}
|
|
isConnectable
|
|
className={styles.handle}
|
|
style={RightHandleStyle}
|
|
></Handle>
|
|
|
|
<Flex align="center" justify={'space-around'}>
|
|
<OperatorIcon
|
|
name={data.label as Operator}
|
|
fontSize={24}
|
|
color={operatorMap[data.label as Operator].color}
|
|
></OperatorIcon>
|
|
<div className={styles.nodeTitle}>{t(`flow.begin`)}</div>
|
|
</Flex>
|
|
</section>
|
|
);
|
|
}
|