From 28bc01267a0325f42fe75bb60b3fafcab30e27e3 Mon Sep 17 00:00:00 2001 From: Joe Thomas Date: Tue, 28 Jun 2016 23:38:03 -0700 Subject: [PATCH 1/2] Move clinical/research space toggling from navigation bar to message box button. --- js/NavBarNew.js | 15 --------------- js/index.js | 41 ++++++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/js/NavBarNew.js b/js/NavBarNew.js index d3798cb..98e1fba 100644 --- a/js/NavBarNew.js +++ b/js/NavBarNew.js @@ -88,21 +88,6 @@ var NavBarNew = React.createClass({ Variants Help - - {this.props.mode === 'research_mode' && - Switch to {this.getModeName(other_mode)} - } - {this.props.mode === 'default' && - this.setState({showModal: true})} to='/variants'> - Switch to {this.getModeName(other_mode)} - } - {this.props.mode === 'default' && this.state.showModal && - this.setState({ showModal: false })}> - - - - } - Community diff --git a/js/index.js b/js/index.js index 119b433..a452443 100644 --- a/js/index.js +++ b/js/index.js @@ -30,7 +30,7 @@ var Community = require('./Community'); var databaseKey = require('../databaseKey'); -var {Grid, Col, Row, Table} = require('react-bootstrap'); +var {Grid, Col, Row, Table, Button, Modal} = require('react-bootstrap'); var {VariantTable, ResearchVariantTable, research_mode_columns, columns} = require('./VariantTable'); var {Signup} = require('./Signup'); @@ -235,15 +235,20 @@ var Database = React.createClass({ // Note this is not a pure component because of the calls to // getQuery(). mixins: [Navigation, State], - showVariant: function (row) { - row.Genomic_Coordinate_hg38 = backend.trimSearchTerm(row.Genomic_Coordinate_hg38); - var d3TipDiv = document.getElementsByClassName('d3-tip-selection'); - if (d3TipDiv.length != 0 && d3TipDiv[0].style.opacity != '0') { - d3TipDiv[0].style.opacity='0'; - d3TipDiv[0].style.pointerEvents='none'; + getInitialState: function () { + return { + showModal: false, } - this.transitionTo(`/variant/${variantPathJoin(row)}`); - }, + }, + showVariant: function (row) { + row.Genomic_Coordinate_hg38 = backend.trimSearchTerm(row.Genomic_Coordinate_hg38); + var d3TipDiv = document.getElementsByClassName('d3-tip-selection'); + if (d3TipDiv.length != 0 && d3TipDiv[0].style.opacity != '0') { + d3TipDiv[0].style.opacity='0'; + d3TipDiv[0].style.pointerEvents='none'; + } + this.transitionTo(`/variant/${variantPathJoin(row)}`); + }, showHelp: function (title) { var d3TipDiv = document.getElementsByClassName('d3-tip-selection'); if (d3TipDiv.length != 0 && d3TipDiv[0].style.opacity != '0') { @@ -278,6 +283,10 @@ var Database = React.createClass({ this.transitionTo('/variants', {}, urlFromDatabase(state)); } }, + toggleMode: function () { + this.props.toggleMode(); + this.setState({ showModal: false }); + }, render: function () { var {show} = this.props, params = databaseParams(this.getQuery()); @@ -323,6 +332,19 @@ var Database = React.createClass({ return + {this.props.mode === 'research_mode' && } + {this.props.mode === 'default' && + } + {this.props.mode === 'default' && this.state.showModal && + this.setState({ showModal: false })}> + + + + } } @@ -454,6 +476,7 @@ var Application = React.createClass({