From 5b064132e5d94d71589a9dd68d6966734f0a8a5c Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Wed, 6 Nov 2024 22:59:19 -0500
Subject: changes

---
 .../DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx   | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx')

diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index f0f6cafcc..def4a3354 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -62,7 +62,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
     @observable _userCreatedColumns: Col[] = [];
     @observable _selectedCols: { title: string; type: string; desc: string }[] | undefined = [];
 
-    @observable _layout: { type: LayoutType; yMargin: number; xMargin: number; columns?: number; repeat: number } = { type: LayoutType.FREEFORM, yMargin: 0, xMargin: 0, repeat: 0 };
+    @observable _layout: { type: LayoutType; yMargin: number; xMargin: number; columns?: number; repeat: number } = { type: LayoutType.FREEFORM, yMargin: 10, xMargin: 10, columns: 3, repeat: 0 };
     @observable _layoutPreviewScale: number = 1;
     @observable _savedLayouts: DataVizTemplateLayout[] = [];
     @observable _expandedPreview: Doc | undefined = undefined;
@@ -684,8 +684,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
     createDocsFromTemplate = (template: Template) => {
         const dv = this._dataViz;
         if (!dv) return;
-        const fields: string[] = Array.from(Object.keys(dv.records[0]));
-        console.log('columns: ', fields)    
+        const fields: string[] = Array.from(Object.keys(dv.records[0]));  
         const selectedRows = NumListCast(dv.layoutDoc.dataViz_selectedRows);
 
         const fieldContents: {[title: string]: string}[] = selectedRows.map(row => {
@@ -697,7 +696,6 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
             return values;
         });
 
-        console.log("fieldcontents: ", fieldContents)
 
         const renderedDocs: Doc[] = [];
 
@@ -707,17 +705,19 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                 if (field === undefined){
                     return;
                 }
-                console.log('title: ', title, 'field: ', field)
                 field.setContent(content[title]);
             });
 
             renderedDocs.push(template.mainField.renderedDoc());
         });
 
-        console.log("rendered ", renderedDocs);
         return renderedDocs;
     }
 
+    addRenderedCollectionToMainview = () => {
+        
+    }
+
     @action setExpandedView = (doc: Doc | undefined) => {
         if (doc) {
             this._expandedPreview = doc; //Docs.Create.FreeformDocument([doc], { _height: NumListCast(doc._height)[0], _width: NumListCast(doc._width)[0], title: ''});
@@ -820,12 +820,12 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                                                 </button>
                                                 <DocumentView
                                                     Document={doc}
-                                                    isContentActive={emptyFunction}
+                                                    isContentActive={emptyFunction} // !!! should be return false
                                                     addDocument={returnFalse}
                                                     moveDocument={returnFalse}
                                                     removeDocument={returnFalse}
-                                                    PanelWidth={() => 111}
-                                                    PanelHeight={() => 111}
+                                                    PanelWidth={() => this._selectedTemplate === template ? 104 : 111}
+                                                    PanelHeight={() => this._selectedTemplate === template ? 104 : 111}
                                                     ScreenToLocalTransform={() => new Transform(-this._pageX - 5,-this._pageY - 35, 1)}
                                                     renderDepth={1}
                                                     whenChildContentsActiveChanged={emptyFunction}
@@ -1217,8 +1217,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                                 undoable(clickEv => {
                                     clickEv.stopPropagation();
                                     if (!this._selectedTemplate) return;
-                                    const templateInfo: DataVizTemplateInfo = { doc: this._selectedTemplate.mainField.renderedDoc(), layout: this._layout, referencePos: { x: this._pageX + 450, y: this._pageY }, columns: this.columnsCount };
-                                    this._dataViz?.createDocsFromTemplate(templateInfo);
+                                    
                                 }, 'make docs')
                             )
                         }>
@@ -1234,7 +1233,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
 
         const fieldPanel = (field: Col) => {
             return (
-                <div className="field-panel">
+                <div className="field-panel" key={field.title}>
                     <div className="top-bar">
                         <span className="field-title">{`${field.title} Field`}</span>
                         <button className="docCreatorMenu-menu-button section-reveal-options no-margin" onPointerDown={e => this.setUpButtonClick(e, () => this.removeField(field))} style={{ position: 'absolute', right: '0px' }}>
@@ -1244,7 +1243,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                     <div className="opts-bar">
                         <div className="opt-box">
                             <div className="top-bar"> Title </div>
-                            <textarea className="content" style={{ width: '100%', height: 'calc(100% - 20px)' }} defaultValue={field.title} placeholder={'Enter title'} onChange={e => this.setColTitle(field, e.target.value)} />
+                            <textarea className="content" style={{ width: '100%', height: 'calc(100% - 20px)' }} value={field.title} placeholder={'Enter title'} onChange={e => this.setColTitle(field, e.target.value)} />
                         </div>
                         <div className="opt-box">
                             <div className="top-bar"> Type </div>
-- 
cgit v1.2.3-70-g09d2

