From 88971a7730549e2b906688d21792a23fc2f39e8d Mon Sep 17 00:00:00 2001 From: srichman333 Date: Wed, 29 Nov 2023 22:49:41 -0500 Subject: schema to dataviz through popup --- src/client/views/MainView.tsx | 2 + .../collectionFreeForm/CollectionFreeFormView.tsx | 13 +- .../views/nodes/DataVizBox/SchemaCSVPopUp.scss | 175 +++++++++++++++++++++ .../views/nodes/DataVizBox/SchemaCSVPopUp.tsx | 80 ++++++++++ src/client/views/pdf/GPTPopup/GPTPopup.tsx | 2 +- 5 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 src/client/views/nodes/DataVizBox/SchemaCSVPopUp.scss create mode 100644 src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx (limited to 'src') diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index f40f1f3e8..d69834f34 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -71,6 +71,7 @@ import { PreviewCursor } from './PreviewCursor'; import { PropertiesView } from './PropertiesView'; import { DashboardStyleProvider, DefaultStyleProvider } from './StyleProvider'; import { TopBar } from './topbar/TopBar'; +import { SchemaCSVPopUp } from './nodes/DataVizBox/SchemaCSVPopUp'; const _global = (window /* browser */ || global) /* node */ as any; @observer @@ -1081,6 +1082,7 @@ export class MainView extends React.Component { {this.mapBoxHack} + {/* */} diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 04e5ebb2c..e1ff4fda3 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -51,6 +51,7 @@ import { CollectionFreeFormRemoteCursors } from './CollectionFreeFormRemoteCurso import './CollectionFreeFormView.scss'; import { MarqueeView } from './MarqueeView'; import React = require('react'); +import { SchemaCSVPopUp } from '../../nodes/DataVizBox/SchemaCSVPopUp'; export type collectionFreeformViewProps = { NativeWidth?: () => number; @@ -1984,7 +1985,9 @@ ScriptingGlobals.add(function datavizFromSchema(doc: Doc) { for (let i=0; i < children.length; i++) { let eachRow = []; for (let j=0; j { + static Instance: SchemaCSVPopUp; + + @observable + public dataVizDoc: Doc | undefined = undefined; + @action + public setDataVizDoc = (doc: Doc) => { + this.dataVizDoc = doc; + }; + + @observable + public visible: boolean = false; + @action + public setVisible = (vis: boolean) => { + this.visible = vis; + }; + + public addToCollection: any | undefined; + + /** + * Transfers the doc to the user's canvas + */ + private transferToCanvas = () => { + if (this.dataVizDoc) this.addToCollection?.(this.dataVizDoc); + this.setVisible(false); + }; + + constructor(props: SchemaCSVPopUpProps) { + super(props); + SchemaCSVPopUp.Instance = this; + } + + dataBox = () => { + return ( +
+ {this.heading('Schema Table as Data Visualization Doc')} +
+
+
+ +
+
+
+
+ {/* {this.props.children} */} + +
+
+ ); + }; + + heading = (headingText: string) => ( +
+ +
+ ); + + render() { + return ( +
+ {this.dataBox()} +
+ ); + } +} \ No newline at end of file diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx index 5392ec88e..d830ba8a9 100644 --- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx +++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx @@ -126,7 +126,7 @@ export class GPTPopup extends React.Component { console.log(err); return ''; } - GPTPopup.Instance.setLoading(false); + this.setLoading(false); }; /** -- cgit v1.2.3-70-g09d2