From c28390cedfc909ff8e96e4527b75699e1529410c Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:22:41 -0400 Subject: work on fields dashboard --- src/client/views/nodes/DataVizBox/DataVizBox.tsx | 3 +- .../views/nodes/DataVizBox/DocCreatorMenu.scss | 44 ++++++++++++++++++++++ .../views/nodes/DataVizBox/DocCreatorMenu.tsx | 44 ++++++++++++++++++---- 3 files changed, 83 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index 6a5103af9..c0b05b082 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -129,7 +129,8 @@ export class DataVizBox extends ViewBoxAnnotatableComponent() { } selectAxes = (axes: string[]) => { this.layoutDoc._dataViz_axes = new List(axes); - DocCreatorMenu.Instance.generateTemplates(''); + //axes.forEach(axis => console.log(axis)) + //DocCreatorMenu.Instance.generateTemplates(''); }; @computed.struct get titleCol() { return StrCast(this.layoutDoc._dataViz_titleCol); diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss b/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss index 763de0eba..baed9009b 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.scss @@ -774,6 +774,50 @@ align-items: center; color: whitesmoke; } + + .field-type-selection-container { + display: flex; + flex-direction: row; + align-items: center; + background-color: rgb(40, 40, 40); + border: 1px solid rgb(100, 100, 100); + border-radius: 3px; + width: 30%; + height: 25px; + padding-left: 3px; + color: whitesmoke; + + .bubbles { + display: none; + } + + .text { + margin-top: 5px; + margin-bottom: 5px; + } + + &:hover { + width: 30% + 8; + } + + &:hover .bubbles { + display: flex; + flex-direction: row; + align-items: flex-start; + } + + &:hover .type-display { + display: none; + } + + .bubble { + margin: 5px; + } + + &:hover .bubble { + margin-top: 7px; + } + } } .field-description-container { diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx index 19881f4d2..d3117da22 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx @@ -763,6 +763,29 @@ export class DocCreatorMenu extends ObservableReactComponent { + if (this._dataViz?.axes.includes(field.title)) { + this._dataViz.selectAxes(this._dataViz.axes.filter(col => col !== field.title)); + } else { + const toRemove = this._fields.filter(f => f.id === field.id); + if (!toRemove) return; + + if (toRemove.length > 1) { + while (toRemove.length > 1) { + toRemove.pop(); + } + } + + if (this._fields.length === 1) { + this._fields = [] + } else { + console.log(this._fields) + this._fields.splice(this._fields.indexOf(toRemove[0]), 1); + console.log(this._fields) + } + } + } + get dashboardContents(){ return (
@@ -771,16 +794,23 @@ export class DocCreatorMenu extends ObservableReactComponent
- {this.fieldsInfos.map(field => -
+ {this.fieldsInfos.map((field, index) => +
- - - {field.type === 'Text' ? - : null} + +
+ Type:  + {field.type ? field.type === 'text' ? 'Text' : 'File' : ''} +
+ {field.type = 'text'; this.forceUpdate()}}/> +
Text
+ {field.type = 'visual'; this.forceUpdate()}}/> +
File
+
+