From ce3e290c66629aa85d6ddeb9aab93165a8d636aa Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Fri, 8 Nov 2024 00:25:18 -0500
Subject: loading indicator in layout preview works properly

---
 .../DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx   | 31 +++++-----------------
 1 file changed, 6 insertions(+), 25 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 3cdde90d5..257c7fc00 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -968,23 +968,6 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
         );
     }
 
-    get savedLayoutsPreviewContents() {
-        return (
-            <div className="docCreatorMenu-preview-container">
-                {this._savedLayouts.map((layout, index) => (
-                    <div
-                        className="docCreatorMenu-preview-window"
-                        style={{
-                            border: this.isSelectedLayout(layout) ? `solid 3px ${Colors.MEDIUM_BLUE}` : '',
-                            boxShadow: this.isSelectedLayout(layout) ? `0 0 15px rgba(68, 118, 247, .8)` : '',
-                        }}
-                        onPointerDown={e => this.setUpButtonClick(e, () => runInAction(() => this.updateSelectedSavedLayout(layout)))}>
-                        {this.layoutPreviewContents(87, layout, true, index)}
-                    </div>
-                ))}
-            </div>
-        );
-    }
 
     @action updateXMargin = (input: string) => {
         this._layout.xMargin = Number(input);
@@ -1128,14 +1111,14 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
         this._renderedDocCollection = collection;
     }
 
-    layoutPreviewContents = (outerSpan: number, altLayout?: DataVizTemplateLayout, small: boolean = false, id?: number) => {
-        const doc: Doc | undefined = altLayout ? altLayout.template : this._fullyRenderedDocs[0]; //!!! might cause a slow down
-        if (!doc) return;
+    layoutPreviewContents = (id?: number) => {
 
         return this._docsRendering ? (
-            <div className="loading-spinner">
-                <ReactLoading type="spin" color={StrCast(Doc.UserDoc().userVariantColor)} height={30} width={30} />
-            </div> 
+            <div className="docCreatorMenu-layout-preview-window-wrapper loading" id={String(id) ?? undefined}>
+                <div className="loading-spinner">
+                    <ReactLoading type="spin" color={StrCast(Doc.UserDoc().userVariantColor)} height={30} width={30} />
+                </div> 
+            </div>
             ) : !this._renderedDocCollection? null : (
             <div className="docCreatorMenu-layout-preview-window-wrapper" id={String(id) ?? undefined}>
                 <DocumentView
@@ -1380,8 +1363,6 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                 return this.templatesPreviewContents;
             case 'options':
                 return this.optionsMenuContents;
-            case 'saved':
-                return this.savedLayoutsPreviewContents;
             case 'dashboard':
                 return this.dashboardContents;
             default:
-- 
cgit v1.2.3-70-g09d2

