diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-11-08 00:25:18 -0500 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-11-08 00:25:18 -0500 |
commit | ce3e290c66629aa85d6ddeb9aab93165a8d636aa (patch) | |
tree | 801ad968eeb2b38f52f9e75212c0f3408a7c2917 /src | |
parent | 74e0744cfd3be6d375ff47f0d32588996074f956 (diff) |
loading indicator in layout preview works properly
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.scss | 6 | ||||
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx | 31 |
2 files changed, 12 insertions, 25 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.scss b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.scss index c2e59b4a4..57f4a1e94 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.scss +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.scss @@ -704,6 +704,12 @@ margin-left: 20px; margin-right: 20px; + &.loading { + width: 100px; + height: 100px; + border: none; + } + &:hover .docCreatorMenu-zoom-button-container { display: block; } 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: |