mirror of https://github.com/ANL-CEEESA/RELOG.git
parent
315c80c03d
commit
6e6a4cc175
@ -1,24 +1,57 @@
|
|||||||
|
// NodesAndEdges.tsx
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Position, NodeProps, Handle } from '@xyflow/react';
|
|
||||||
|
import { Handle, Position, NodeProps } from '@xyflow/react';
|
||||||
|
|
||||||
import styles from './PipelineBlock.module.css';
|
import styles from './PipelineBlock.module.css';
|
||||||
|
|
||||||
export interface CustomNodeData {
|
export interface CustomNodeData {
|
||||||
|
|
||||||
label: string;
|
label: string;
|
||||||
type: 'plant' | 'product';
|
|
||||||
|
type: 'plant' | 'product' | 'center';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function CustomNode({ data }: NodeProps<any>) {
|
|
||||||
const nodeStyle =
|
export default function CustomNode({ data, isConnectable }: NodeProps<Node<CustomNodeData>>) {
|
||||||
data.type === 'plant'
|
const typeClass =
|
||||||
? styles.PlantNode: styles.ProductNode;
|
data.type === 'plant' ? styles.PlantNode :
|
||||||
|
data.type === 'product' ? styles.ProductNode:
|
||||||
|
styles.CenterNode;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.node} ${nodeStyle}`}>
|
<div className={`${styles.node} ${typeClass}`}>
|
||||||
{data.type === 'plant' && (
|
<Handle
|
||||||
<Handle type="target" position={Position.Left} style={{ background: '#555' }} />
|
|
||||||
)}
|
type="target"
|
||||||
|
|
||||||
|
position={Position.Left}
|
||||||
|
|
||||||
|
isConnectable={isConnectable}
|
||||||
|
|
||||||
|
style={{ background: '#555' }}
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
<div>{data.label}</div>
|
<div>{data.label}</div>
|
||||||
<Handle type="source" position={Position.Right} style={{ background: '#555' }} />
|
|
||||||
|
<Handle
|
||||||
|
|
||||||
|
type="source"
|
||||||
|
|
||||||
|
position={Position.Right}
|
||||||
|
|
||||||
|
isConnectable={isConnectable}
|
||||||
|
|
||||||
|
style={{ background: '#555' }}
|
||||||
|
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue