51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import {
|
|
Handle,
|
|
type NodeProps,
|
|
Position,
|
|
type Node,
|
|
} from '@xyflow/react';
|
|
import { Toolbar } from '../components/NodeComponents';
|
|
import styles from '../../VisProg.module.css';
|
|
|
|
|
|
export type StartNodeData = {
|
|
label: string;
|
|
droppable: boolean;
|
|
hasReduce: boolean;
|
|
};
|
|
|
|
|
|
export type StartNode = Node<StartNodeData>
|
|
|
|
export default function StartNode(props: NodeProps<Node>) {
|
|
return (
|
|
<>
|
|
<Toolbar nodeId={props.id} allowDelete={false}/>
|
|
<div className={`${styles.defaultNode} ${styles.nodeStart}`}>
|
|
<div className={"flex-row gap-sm"}>
|
|
Start
|
|
</div>
|
|
<Handle type="target" position={Position.Left} id="target"/>
|
|
<Handle type="target" position={Position.Bottom} id="norms"/>
|
|
<Handle type="source" position={Position.Right} id="source"/>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function StartReduce(node: Node, nodes: Node[]) {
|
|
// Replace this for nodes functionality
|
|
if (nodes.length <= -1) {
|
|
console.warn("Impossible nodes length in StartReduce")
|
|
}
|
|
return {
|
|
id: node.id
|
|
}
|
|
}
|
|
|
|
export function StartConnects(thisNode: Node, otherNode: Node, isThisSource: boolean) {
|
|
// Replace this for connection logic
|
|
if (thisNode == undefined && otherNode == undefined && isThisSource == false) {
|
|
console.warn("Impossible node connection called in EndConnects")
|
|
}
|
|
} |