From 81e57afe293f621dd21a4b50f763bf4be736de08 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Wed, 18 Sep 2019 19:22:51 -0400 Subject: [PATCH] Anno fixes (easy) (#925) * change wording from value to label * tooltip position * Padding for text & code whitespace --- client/src/components/autosave/index.js | 126 +++++++++--------- client/src/components/categorical/category.js | 2 +- client/src/components/categorical/value.js | 2 +- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/client/src/components/autosave/index.js b/client/src/components/autosave/index.js index 78038ecc..3c27e4e3 100644 --- a/client/src/components/autosave/index.js +++ b/client/src/components/autosave/index.js @@ -4,78 +4,78 @@ import { connect } from "react-redux"; import actions from "../../actions"; @connect(state => ({ - universe: state.universe, - obsAnnotations: state.universe.obsAnnotations, - saveInProgress: state.autosave?.saveInProgress ?? false, - lastSavedObsAnnotations: state.autosave?.lastSavedObsAnnotations, - error: state.autosave?.error, - writableCategoriesEnabled: state.config?.parameters?.["label_file"] ?? false + universe: state.universe, + obsAnnotations: state.universe.obsAnnotations, + saveInProgress: state.autosave?.saveInProgress ?? false, + lastSavedObsAnnotations: state.autosave?.lastSavedObsAnnotations, + error: state.autosave?.error, + writableCategoriesEnabled: state.config?.parameters?.["label_file"] ?? false })) class Autosave extends React.Component { - constructor(props) { - super(props); - this.state = { - timer: null - }; - } + constructor(props) { + super(props); + this.state = { + timer: null + }; + } - componentDidMount() { - const { writableCategoriesEnabled } = this.props; + componentDidMount() { + const { writableCategoriesEnabled } = this.props; - let { timer } = this.state; - if (timer) clearInterval(timer); - if (writableCategoriesEnabled) { - timer = setInterval(this.tick, 2500); - } else { - timer = null; - } - this.setState({ timer }); - } + let { timer } = this.state; + if (timer) clearInterval(timer); + if (writableCategoriesEnabled) { + timer = setInterval(this.tick, 2500); + } else { + timer = null; + } + this.setState({ timer }); + } - componentWillUnmount() { - const { timer } = this.state; - if (timer) this.clearInterval(timer); - } + componentWillUnmount() { + const { timer } = this.state; + if (timer) this.clearInterval(timer); + } - tick = () => { - const { dispatch, saveInProgress } = this.props; - if (this.needToSave() && !saveInProgress) { - dispatch(actions.saveObsAnnotations()); - } - }; + tick = () => { + const { dispatch, saveInProgress } = this.props; + if (this.needToSave() && !saveInProgress) { + dispatch(actions.saveObsAnnotations()); + } + }; - needToSave = () => { - /* return true if we need to save, false if we don't */ - const { obsAnnotations, lastSavedObsAnnotations } = this.props; - return ( - lastSavedObsAnnotations && obsAnnotations !== lastSavedObsAnnotations - ); - }; + needToSave = () => { + /* return true if we need to save, false if we don't */ + const { obsAnnotations, lastSavedObsAnnotations } = this.props; + return ( + lastSavedObsAnnotations && obsAnnotations !== lastSavedObsAnnotations + ); + }; - statusMessage() { - const { error } = this.props; - if (error) { - return `Autosave error: ${error}`; - } - return this.needToSave() ? "Unsaved" : "All saved"; - } + statusMessage() { + const { error } = this.props; + if (error) { + return `Autosave error: ${error}`; + } + return this.needToSave() ? "Unsaved" : "All saved"; + } - render() { - const { writableCategoriesEnabled } = this.props; - return writableCategoriesEnabled ? ( -
- {this.statusMessage()} -
- ) : null; - } + render() { + const { writableCategoriesEnabled } = this.props; + return writableCategoriesEnabled ? ( +
+ {this.statusMessage()} +
+ ) : null; + } } export default Autosave; diff --git a/client/src/components/categorical/category.js b/client/src/components/categorical/category.js index 34cfbb37..28521d23 100644 --- a/client/src/components/categorical/category.js +++ b/client/src/components/categorical/category.js @@ -349,7 +349,7 @@ class Category extends React.Component { ) : null}