mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-10-30 01:10:14 +00:00
### What problem does this PR solve? feat: add icon to graph nodes #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import classNames from 'classnames';
|
|
import { Handle, NodeProps, Position } from 'reactflow';
|
|
|
|
import { Space } from 'antd';
|
|
import { Operator } from '../../constant';
|
|
import OperatorIcon from '../../operator-icon';
|
|
import styles from './index.less';
|
|
|
|
export function TextUpdaterNode({
|
|
data,
|
|
isConnectable = true,
|
|
selected,
|
|
}: NodeProps<{ label: string }>) {
|
|
return (
|
|
<section
|
|
className={classNames(styles.textUpdaterNode, {
|
|
[styles.selectedNode]: selected,
|
|
})}
|
|
>
|
|
<Handle
|
|
type="target"
|
|
position={Position.Left}
|
|
isConnectable={isConnectable}
|
|
className={styles.handle}
|
|
>
|
|
{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}
|
|
</Handle>
|
|
<Handle
|
|
type="source"
|
|
position={Position.Right}
|
|
isConnectable={isConnectable}
|
|
className={styles.handle}
|
|
>
|
|
{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}
|
|
</Handle>
|
|
<div>
|
|
<Space>
|
|
<OperatorIcon
|
|
name={data.label as Operator}
|
|
fontSize={12}
|
|
></OperatorIcon>
|
|
{data.label}
|
|
</Space>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|