From 04c6d04b6dee84ee31f72a6501212d10a78023fd Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 21 Sep 2017 03:19:16 +0200 Subject: [PATCH] visualizations: move all buttons to the right side --- src/containers/visualization.js | 82 +++++++++++++++------------------ 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/src/containers/visualization.js b/src/containers/visualization.js index e355a1e..60f85f4 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -425,56 +425,46 @@ class Visualization extends React.Component { render() { const current_widgets = this.state.visualization.widgets; + let boxClasses = classNames('section', 'box', { 'fullscreen-padding': this.props.isFullscreen }); + + let buttons = [] + let editingControls = []; + + if (this.state.editing) { + editingControls.push( +
+ Grid: {this.state.visualization.grid > 1 ? this.state.visualization.grid : 'Disabled'} + this.setGrid(value)} /> +
+ ) + + buttons.push({ click: () => this.stopEditing(), glyph: 'floppy-disk', text: 'Save' }); + buttons.push({ click: () => this.discardChanges(), glyph: 'remove', text: 'Cancel' }); + } + + if (!this.props.isFullscreen) { + buttons.push({ click: this.props.toggleFullscreen, glyph: 'resize-full', text: 'Fullscreen' }); + buttons.push({ click: this.state.paused ? this.unpauseData : this.pauseData, glyph: this.state.paused ? 'play' : 'pause', text: this.state.paused ? 'Live' : 'Pause' }); + + if (!this.state.editing) + buttons.push({ click: () => this.setState({ editing: true }), glyph: 'pencil', text: 'Edit' }); + } + + const buttonList = buttons.map((btn, idx) => + + ); + return ( -
+
- - {this.state.visualization.name} - + {this.state.visualization.name}
- {this.state.editing ? ( -
-
- - -
-
- ) : ( -
- {this.state.fullscreen === false ? ( - - - - - ) : ( - - )} -
- )}
- {this.state.editing ? ( -
- Grid: {this.state.visualization.grid > 1 ? this.state.visualization.grid : 'Disabled'} - - this.setGrid(value)} /> -
- ) : (this.state.paused ? ( - - ): ( - - ))} + { buttonList }
@@ -494,6 +484,10 @@ class Visualization extends React.Component { + +
+ { editingControls } +
}