diff options
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx | 28 |
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); |