aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2025-03-05 02:19:04 -0500
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2025-03-05 02:19:04 -0500
commit2c7462f38a086f156a7d2e20dc15b822b7d7b1fb (patch)
tree4c556a966fb105cd55e912b98c2789f01fc3d976 /src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
parentc6845961d5938ced763c29026c06d6fcb7051501 (diff)
working on template cloning
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index cc161e688..099d082d3 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -632,7 +632,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
const renderedTemplates: (Template | undefined)[] = await Promise.all(renderedTemplatePromises);
}
- // templates.forEach(template => template.mainField.initRenderedDoc())
+ templates.forEach(template => template.mainField.initializeDocument())
setTimeout(() => {
this.setSuggestedTemplates(templates);
@@ -695,7 +695,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
const res = await gptAPICall(`${++this._callCount}: ${prompt}`, GPTCallType.FILL);
- console.log('prompt: ', prompt, ' response: ', res);
+ // console.log('prompt: ', prompt, ' response: ', res);
if (res) {
const assignments: { [title: string]: { number: string; content: string } } = JSON.parse(res);
@@ -740,6 +740,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
fields.filter(title => title).forEach(title => {
const field = templateCopy.getFieldByTitle(title);
if (field === undefined) return;
+ console.log('setting content to: ', content[title]);
field.setContent(content[title], field.viewType);
});
@@ -769,17 +770,19 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
};
const rows = [1, 2, 3, 4];
-
- //const promises = rowContents.map(content => processContent(content));
-
- const promises = rows.map(row => processContent({}));
+
+ let docs: Promise<Doc>[];
+ if (this.DEBUG_MODE) {
+ docs = rows.map(() => processContent({}));
+ } else {
+ docs = rowContents.map(content => processContent(content));
+ }
- const renderedDocs = await Promise.all(promises);
+ const renderedDocs = await Promise.all(docs);
- this._docsRendering = false; // removes loading indicator
+ //renderedDocs.forEach(doc => {console.log(doc._height, doc._width); doc._height = 400; doc._width = 400});
- console.log('docs: ', renderedDocs);
- console.log('first doc height: ', renderedDocs[0]._height);
+ this._docsRendering = false; // removes loading indicator
return renderedDocs;
}
@@ -1032,6 +1035,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
applyLayout = (collection: Doc, docs: Doc[]) => {
const { horizontalSpan, verticalSpan } = this.previewInfo;
+ console.log(this.previewInfo)
collection._height = verticalSpan;
collection._width = horizontalSpan;
@@ -1111,7 +1115,9 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
title: 'title',
backgroundColor: 'gray',
x: 200,
- y: 200
+ y: 200,
+ _width: 4000,
+ _height: 4000,
});
this.applyLayout(collection, this._fullyRenderedDocs);