aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DocCreatorMenu
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu')
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx13
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/DynamicField.tsx14
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx4
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx3
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/TemplateBackend.tsx71
5 files changed, 93 insertions, 12 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index ad7aa7cb9..54f109f84 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -411,9 +411,11 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
testTemplate = async () => {
- console.log(this._suggestedTemplates
- ?.map(doc => ({ icon: ImageCast(doc.icon), doc }))
- .filter(info => info.icon && info.doc));
+ console.log(this.templateManager.templates.map(template => {
+ template.mainField.getAllSubfields;
+ })
+
+ )
this.forceUpdate();
@@ -607,7 +609,8 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
compileFieldDescriptions = (templates: Template[]): string => {
let descriptions: string = '';
templates.forEach(template => {
- descriptions += `---------- NEW TEMPLATE TO INCLUDE: Description of template ${template.mainField.getTitle()}'s fields: `;
+ console.log('title: ', template.mainField.getTitle());
+ descriptions += `---------- NEW TEMPLATE TO INCLUDE: The title is: ${template.mainField.getTitle()}. Its fields are: `;
template.allFields.forEach(field => {
descriptions += `{Field #${field.getID}: ${field.getDescription}} `;
});
@@ -685,6 +688,8 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
const cols = this.fieldsInfos;
const templates = this.templateManager.getValidTemplates(cols);
+ console.log('templates: ', templates)
+
const assignments: [Template, { [field: number]: Col }][] = await this.assignColsToFields(templates, cols);
const renderedTemplatePromises: Promise<Template>[] = assignments.map(([template, assignments]) => this.applyGPTContentToTemplate(template, assignments));
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/DynamicField.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/DynamicField.tsx
index 136392c07..cd83472d8 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/DynamicField.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/DynamicField.tsx
@@ -38,10 +38,10 @@ export class DynamicField implements Field {
get getSubfields() { return this.subfields };
get getAllSubfields() {
- const fields: Field[] = [];
+ let fields: Field[] = [];
this.subfields?.forEach(field => {
fields.push(field);
- fields.concat(field.getAllSubfields)
+ fields = fields.concat(field.getAllSubfields)
});
return fields;
};
@@ -62,13 +62,15 @@ export class DynamicField implements Field {
const fields: Field[] = [];
this.settings.subfields?.forEach((fieldSettings, index) => {
let field: Field;
- const dynamicType = fieldSettings.viewType;
+ const type = fieldSettings.viewType;
const id = Number(String(this.id) + String(index));
- if (dynamicType) { field = new DynamicField(fieldSettings, id, this); }
-
- field = new StaticField(fieldSettings, this, id);
+ if (type == ViewType.CAROUSEL3D || type === ViewType.FREEFORM) {
+ field = new DynamicField(fieldSettings, id, this);
+ } else {
+ field = new StaticField(fieldSettings, this, id);
+ }
fields.push(field);
});
return fields;
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx
index a56fa4fd6..795581008 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx
@@ -34,10 +34,10 @@ export class StaticField {
get getSubfields(): Field[] { return this.subfields ?? []; };
get getAllSubfields(): Field[] {
- const fields: Field[] = [];
+ let fields: Field[] = [];
this.subfields?.forEach(field => {
fields.push(field);
- fields.concat(field.getAllSubfields);
+ fields = fields.concat(field.getAllSubfields);
});
return fields;
};
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
index 69f5cfb81..09eb86d20 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
@@ -34,6 +34,7 @@ export class Template {
}
getMatches = (cols: Col[]): number[][] => {
+ console.log(this.mainField.getTitle(), this.allFields)
const numFields = this.contentFields.length;
if (cols.length !== numFields) return [];
@@ -80,6 +81,8 @@ export class Template {
if (mt[i] !== -1) ++count;
}
+ console.log(this.mainField.getTitle(), count)
+
return count;
};
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/TemplateBackend.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/TemplateBackend.tsx
index 166d27228..53b3e7fb6 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/TemplateBackend.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/TemplateBackend.tsx
@@ -338,6 +338,77 @@ export class TemplateLayouts {
],
};
+ public static FourFieldCarousel: FieldSettings = {
+ title: 'title_fourfieldcarousel',
+ viewType: ViewType.FREEFORM,
+ tl:[0,0],
+ br:[500, 600],
+ opts: {
+ backgroundColor: '#DDD3A9',
+ },
+ subfields: [
+ {
+ viewType: ViewType.STATIC,
+ tl: [-0.8, -.9],
+ br: [0.8, -.5],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
+ description: 'A small text field for a title that categorizes the rest of the content.',
+ opts: {
+ borderColor: 'yellow',
+ borderWidth: '8',
+ },
+ },
+ {
+ viewType: ViewType.CAROUSEL3D,
+ tl: [-0.9, -.3],
+ br: [0.9, .9],
+ opts: {
+ borderColor: 'yellow',
+ borderWidth: '8',
+ },
+ subfields: [
+ {
+ viewType: ViewType.STATIC,
+ tl: [0, 0],
+ br: [0, 0],
+ types: [TemplateFieldType.VISUAL],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: 'A medium to large field for visual content that will share central focus with other content in the carousel.',
+ opts: {
+ borderColor: 'black',
+ borderWidth: '8',
+ },
+ },
+ {
+ viewType: ViewType.STATIC,
+ tl: [0, 0],
+ br: [0, 0],
+ types: [TemplateFieldType.VISUAL],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: 'A medium to large field for visual content that will share central focus with other content in the carousel.',
+ opts: {
+ borderColor: 'black',
+ borderWidth: '8',
+ },
+ },
+ {
+ viewType: ViewType.STATIC,
+ tl: [0, 0],
+ br: [0, 0],
+ types: [TemplateFieldType.VISUAL],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: 'A medium to large field for visual content that will share central focus with other content in the carousel.',
+ opts: {
+ borderColor: 'black',
+ borderWidth: '8',
+ },
+ },
+ ]
+ },
+ ]
+ }
+
public static ThreeField001: FieldSettings = {
title: 'threefield001',
viewType: ViewType.FREEFORM,