Merge branch 'dev' of ssh://git.science.uu.nl/ics/sp/2025/n25b/pepperplus-ui into fix/deep-clone-data
This commit is contained in:
@@ -32,23 +32,22 @@ export type GoalNode = Node<GoalNodeData>
|
||||
* @param props NodeProps, like id, label, children
|
||||
* @returns React.JSX.Element
|
||||
*/
|
||||
export default function GoalNode(props: NodeProps<GoalNode>) {
|
||||
const data = props.data
|
||||
export default function GoalNode({id, data}: NodeProps<GoalNode>) {
|
||||
const {updateNodeData} = useFlowStore();
|
||||
|
||||
const text_input_id = `goal_${props.id}_text_input`;
|
||||
const checkbox_id = `goal_${props.id}_checkbox`;
|
||||
const text_input_id = `goal_${id}_text_input`;
|
||||
const checkbox_id = `goal_${id}_checkbox`;
|
||||
|
||||
const setDescription = (value: string) => {
|
||||
updateNodeData(props.id, {...data, description: value});
|
||||
updateNodeData(id, {...data, description: value});
|
||||
}
|
||||
|
||||
const setAchieved = (value: boolean) => {
|
||||
updateNodeData(props.id, {...data, achieved: value});
|
||||
updateNodeData(id, {...data, achieved: value});
|
||||
}
|
||||
|
||||
return <>
|
||||
<Toolbar nodeId={props.id} allowDelete={true}/>
|
||||
<Toolbar nodeId={id} allowDelete={true}/>
|
||||
<div className={`${styles.defaultNode} ${styles.nodeGoal} flex-col gap-sm`}>
|
||||
<div className={"flex-row gap-md"}>
|
||||
<label htmlFor={text_input_id}>Goal:</label>
|
||||
@@ -64,7 +63,7 @@ export default function GoalNode(props: NodeProps<GoalNode>) {
|
||||
<input
|
||||
id={checkbox_id}
|
||||
type={"checkbox"}
|
||||
value={data.achieved ? "checked" : ""}
|
||||
checked={data.achieved || false}
|
||||
onChange={(e) => setAchieved(e.target.checked)}
|
||||
/>
|
||||
</div>
|
||||
@@ -89,6 +88,12 @@ export function GoalReduce(node: Node, _nodes: Node[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a connection is made with this node type (Goal)
|
||||
* @param _thisNode the node of this node type which function is called
|
||||
* @param _otherNode the other node which was part of the connection
|
||||
* @param _isThisSource whether this instance of the node was the source in the connection, true = yes.
|
||||
*/
|
||||
export function GoalConnects(_thisNode: Node, _otherNode: Node, _isThisSource: boolean) {
|
||||
// Replace this for connection logic
|
||||
}
|
||||
@@ -78,16 +78,12 @@ export default function TriggerNode(props: NodeProps<TriggerNode>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces each Trigger, including its children down into its relevant data.
|
||||
* @param node: The Node Properties of this node.
|
||||
* @param _nodes: all the nodes in the graph.
|
||||
* @returns A simplified object containing the node label and its list of triggers.
|
||||
* Reduces each Trigger, including its children down into its core data.
|
||||
* @param node - The Trigger node to reduce.
|
||||
* @param _nodes - The list of all nodes in the current flow graph.
|
||||
* @returns A simplified object containing the node label and its list of triggers.
|
||||
*/
|
||||
export function TriggerReduce(node: Node, nodes: Node[]) {
|
||||
// Replace this for nodes functionality
|
||||
if (nodes.length <= -1) {
|
||||
console.warn("Impossible nodes length in TriggerReduce")
|
||||
}
|
||||
export function TriggerReduce(node: Node, _nodes: Node[]) {
|
||||
const data = node.data;
|
||||
switch (data.triggerType) {
|
||||
case "keywords":
|
||||
|
||||
Reference in New Issue
Block a user