chore: cleanup broken tests, add extra documentation, make sure everything is clean and code style isn't inconsistant

This commit is contained in:
Björn Otgaar
2025-11-19 10:13:08 +01:00
parent 8c2e51114e
commit f37df1c726
12 changed files with 56 additions and 74 deletions

View File

@@ -81,6 +81,12 @@ export function TriggerReduce(node: Node, nodes: Node[]) {
}
}
/**
* This function is called whenever a connection is made with this node type (trigger)
* @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 TriggerConnects(thisNode: Node, otherNode: Node, isThisSource: boolean) {
// Replace this for connection logic
if (thisNode == undefined && otherNode == undefined && isThisSource == false) {
@@ -88,14 +94,13 @@ export function TriggerConnects(thisNode: Node, otherNode: Node, isThisSource: b
}
}
// Definitions for the possible triggers, being keywords and emotions
type Keyword = { id: string, keyword: string };
export type EmotionTriggerNodeProps = {
type: "emotion";
value: string;
}
type Keyword = { id: string, keyword: string };
export type KeywordTriggerNodeProps = {
type: "keywords";
value: Keyword[];
@@ -103,6 +108,11 @@ export type KeywordTriggerNodeProps = {
export type TriggerNodeProps = EmotionTriggerNodeProps | KeywordTriggerNodeProps;
/**
* The JSX element that is responsible for updating the field and showing the text
* @param param0 the function that updates the field
* @returns React.JSX.Element that handles adding keywords
*/
function KeywordAdder({ addKeyword }: { addKeyword: (keyword: string) => void }) {
const [input, setInput] = useState("");