aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx17
-rw-r--r--src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts22
2 files changed, 38 insertions, 1 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index 95f3fbc5d..d85f9d82e 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -495,7 +495,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
doc = DocCast(Docs.Create.WebDocument(data, options));
break;
case 'comparison':
- doc = Docs.Create.ComparisonDocument('', options);
+ doc = this.createComparison(data, options);
break;
case 'diagram':
doc = Docs.Create.DiagramDocument(options);
@@ -631,6 +631,21 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
// return carouselDoc;
};
+ @action
+ createComparison = (doc: any, options: any) => {
+ const comp = Docs.Create.ComparisonDocument(options.title, { _width: options.width, _height: options.height | 300, backgroundColor: options.backgroundColor });
+ const [left, right] = doc;
+ console.log(DocCast(comp.dataDoc));
+ console.log(DocCast(comp[DocData]));
+ console.log(DocCast(comp[DocData].data_back));
+ const docLeft = DocCast(Docs.Create.TextDocument(left.data, { backgroundColor: left.backgroundColor, _width: left.width, _height: left.height }));
+ const docRight = DocCast(Docs.Create.TextDocument(right.data, { backgroundColor: right.backgroundColor, _width: right.width, _height: right.height }));
+ comp[DocData].data_back = docLeft;
+ comp[DocData].data_front = docRight;
+
+ return comp;
+ };
+
/**
* Event handler to manage citations click in the message components.
* @param citation The citation object clicked by the user.
diff --git a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
index ebe0448aa..7b78ed510 100644
--- a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
+++ b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
@@ -68,6 +68,28 @@ const example = [
height: 300,
},
{
+ doc_type: 'comparison',
+ title: 'WWI vs. WWII',
+ data: [
+ {
+ doc_type: 'text',
+ title: 'WWI',
+ data: 'From 1914 to 1918, fighting took place across several continents, at sea and, for the first time, in the air.',
+ width: 300,
+ height: 300,
+ },
+ {
+ doc_type: 'text',
+ title: 'WWII',
+ data: 'A devastating global conflict spanning from 1939 to 1945, saw the Allied powers fight against the Axis powers.',
+ width: 300,
+ height: 300,
+ },
+ ],
+ width: 300,
+ height: 300,
+ },
+ {
doc_type: 'collection',
title: 'Science Collection',
data: [