aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
diff options
context:
space:
mode:
authoralyssaf16 <alyssa_feinberg@brown.edu>2024-10-30 22:17:57 -0400
committeralyssaf16 <alyssa_feinberg@brown.edu>2024-10-30 22:17:57 -0400
commitcd54cba6269dbc4e10b457fe7eddd5114a9d301e (patch)
tree91c0406991193b6f8667db09f4eec4e9afcb689b /src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
parentf37c99bb332bba274dc93b7509696c6d61c3dd21 (diff)
version 5 working
Diffstat (limited to 'src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx')
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index 0939247b7..4a39ee388 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -428,22 +428,22 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
// });
// };
@action
- private createCollectionWithChildren = async (data: string[]): Promise<Doc[]> => {
+ private createCollectionWithChildren = async (data: any): Promise<Doc[]> => {
console.log('Creating collection with nested documents');
// Create an array of promises for each document
const childDocPromises = data.map(async doc => {
- const parsedDoc = JSON.parse(doc);
+ const parsedDoc = doc;
console.log('Parse #3: ' + parsedDoc);
if (parsedDoc.doc_type !== 'collection') {
// Handle non-collection documents
- return await this.whichDoc(parsedDoc.doc_type, parsedDoc.data, parsedDoc.options, parsedDoc.id);
+ return await this.whichDoc(parsedDoc.doc_type, parsedDoc.data, { backgroundColor: parsedDoc.backgroundColor, _width: parsedDoc.width, _height: parsedDoc.height }, parsedDoc.id);
} else {
// Recursively process collections
- const nestedDocs = await this.createCollectionWithChildren(JSON.parse(parsedDoc.data) as string[]);
+ const nestedDocs = await this.createCollectionWithChildren(parsedDoc.data);
const collectionOptions: DocumentOptions = {
title: parsedDoc.title,
- backgroundColor: parsedDoc.background_color,
+ backgroundColor: parsedDoc.backgroundColor,
_width: parsedDoc.width,
_height: parsedDoc.height,
_layout_fitWidth: true,
@@ -491,13 +491,14 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
doc = DocCast(Docs.Create.SimulationDocument(options));
break;
case 'collection': {
- const par = JSON.parse(data);
- console.log('Parse #2: ' + par);
- const arr = await this.createCollectionWithChildren(par);
+ // const par = JSON.parse(data);
+ // console.log('Parse #2: ' + par);
+ const arr = await this.createCollectionWithChildren(data);
options._layout_fitWidth = true;
options._freeform_backgroundGrid = true;
- const opts = { _width: 500, _height: 800, _layout_fitWidth: true, _freeform_backgroundGrid: true };
- doc = DocCast(Docs.Create.FreeformDocument(arr, opts));
+
+ // const opts = { _width: 500, _height: 800, _layout_fitWidth: true, _freeform_backgroundGrid: true };
+ doc = DocCast(Docs.Create.FreeformDocument(arr, options));
break;
}
case 'web':