diff --git a/src/components/AuthoringComponent.tsx b/src/components/AuthoringComponent.tsx index f6bfb72..415674b 100644 --- a/src/components/AuthoringComponent.tsx +++ b/src/components/AuthoringComponent.tsx @@ -24,6 +24,7 @@ const nodeTypes = authoringNodeSpecs.reduce((nodes, node) => { enum AuthoringComponentModelType { NODE_PICKER, JSON_VIEW, + NODE_LIST, UPLOAD_GRAPH, ADD_CUSTOM_EVENT, SHOW_CUSTOM_EVENTS, @@ -151,6 +152,11 @@ export const AuthoringComponent = (props: {behaveGraphRef: any, behaveGraphFromG setEdges(result[1]); setEvents(result[2]); setVariables(result[3]); + + // Log all node types + const allNodeTypes = result[0].map(node => node.type); + const uniqueNodeTypes = new Set(allNodeTypes); + console.log(JSON.stringify(Array.from(uniqueNodeTypes))); } // handle clicking on the react flow pane @@ -203,6 +209,9 @@ export const AuthoringComponent = (props: {behaveGraphRef: any, behaveGraphFromG setAuthoringComponentModal(AuthoringComponentModelType.NONE)} getBehaviorGraph={getBehaveGraph}/> + + setAuthoringComponentModal(AuthoringComponentModelType.NONE)} getBehaviorGraph={getBehaveGraph}/> + setAuthoringComponentModal(AuthoringComponentModelType.NONE)} pushCustomEvent={pushEvent}/> @@ -232,6 +241,8 @@ export const AuthoringComponent = (props: {behaveGraphRef: any, behaveGraphFromG
+ + @@ -332,6 +343,50 @@ const JSONViewComponent = (props: {closeModal: any, getBehaviorGraph: any}) => { ) } + +const NodeListComponent = (props: {closeModal: any, getBehaviorGraph: any}) => { + const [copied, setCopied] = useState(false); + + const getData = () => { + const graph = props.getBehaviorGraph(); + const nodes = graph.nodes; + const nodeTypeSet = new Set(nodes.map((node: any) => node.type)); + const nodeTypes = Array.from(nodeTypeSet); + return nodeTypes; + } + + const copyToClipboard = async () => { + const jsonString = JSON.stringify(getData()); + await navigator.clipboard.writeText(jsonString); + + setCopied(true) + setTimeout(() => { + setCopied(false); + }, 2000); // Reset the copied state after 2 seconds + }; + + return ( + + +

Nde List

+
{JSON.stringify(getData())}
+ + + + + + + + +
+
+ ) +} + const AddVariableComponent = (props: {closeModal: any, pushVariable: any}) => { const idRef = useRef(null); const initialValueRef = useRef(null);