From cd68ef2a2cde1dae40963c4c25c5452404a12fdd Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:05:09 -0400 Subject: expanded preview option --- src/client/views/MainView.tsx | 1 + .../views/nodes/DataVizBox/DocCreatorMenu.scss | 35 ++++++++++++++++------ .../views/nodes/DataVizBox/DocCreatorMenu.tsx | 29 ++++++++++++++---- src/client/views/nodes/DocumentView.scss | 6 ++++ 4 files changed, 56 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 2a937d403..ac669a864 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -280,6 +280,7 @@ export class MainView extends ObservableReactComponent<{}> { library.add( ...[ + fa.faMinimize, fa.faArrowsRotate, fa.faFloppyDisk, fa.faRepeat, diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss b/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss index 1f81bf960..857d76d4f 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss @@ -288,6 +288,12 @@ height: 100%; } +.docCreatorMenu-expanded-template-preview { + position: relative; + width: 100%; + height: 100%; +} + .docCreatorMenu-preview-window { position: relative; display: flex; @@ -306,15 +312,6 @@ background-color: rgb(72, 72, 73); } - .docCreatorMenu-preview-image{ - background-color: transparent; - height: 100px; - width: 100px; - display: block; - object-fit: contain; - border-radius: 5px; - } - &.empty { font-size: 35px; @@ -358,6 +355,20 @@ } +.docCreatorMenu-preview-image{ + background-color: transparent; + height: 100px; + width: 100px; + display: block; + object-fit: contain; + border-radius: 5px; + + &.expanded { + height: 100%; + width: 100%; + } +} + .docCreatorMenu-section { display: flex; flex-direction: column; @@ -424,6 +435,12 @@ &.float-right { float: right; } + + &.top-right { + position: absolute; + top: 3px; + right: 3px; + } } .docCreatorMenu-section-title { diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx index 64152f577..953037d13 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx @@ -59,6 +59,7 @@ export class DocCreatorMenu extends ObservableReactComponent { @observable _layoutPreview: boolean = true; @observable _layoutPreviewScale: number = 1; @observable _savedLayouts: DataVizTemplateLayout[] = []; + @observable _expandedPreview: {icon: ImageField, doc: Doc} | undefined = undefined; @observable _suggestedTemplates: Doc[] = []; @observable _GPTOpt: boolean = false; @@ -798,6 +799,8 @@ export class DocCreatorMenu extends ObservableReactComponent { }; generatePresetTemplates = async () => { + this._dataViz?.updateColDefaults(); + const cols = this.fieldsInfos; const templates = this.findValidTemplates(cols, TemplateLayouts.allTemplates); @@ -811,7 +814,10 @@ export class DocCreatorMenu extends ObservableReactComponent { setTimeout(() => { this.setGSuggestedTemplates(renderedTemplates) }); }; - + + @action setExpandedView = (info: {icon: ImageField, doc: Doc} | undefined) => { + this._expandedPreview = info; + } get templatesPreviewContents(){ const renderedTemplates: Doc[] = []; @@ -820,8 +826,17 @@ export class DocCreatorMenu extends ObservableReactComponent {
return ( -
-
+
+ {this._expandedPreview ? +
+ + +
+ : +
+
Suggested Templates
@@ -893,8 +908,10 @@ export class DocCreatorMenu extends ObservableReactComponent {
)})} +
+ }
); } diff --git a/src/client/views/nodes/DocumentView.scss b/src/client/views/nodes/DocumentView.scss index 23dada260..7568e3b57 100644 --- a/src/client/views/nodes/DocumentView.scss +++ b/src/client/views/nodes/DocumentView.scss @@ -240,6 +240,12 @@ } } +.contentFittingDocumentView * { + ::-webkit-scrollbar-track { + background: none; + } +} + .contentFittingDocumentView { position: relative; display: flex; -- cgit v1.2.3-70-g09d2