From ee62dd355faec6bd79fc7018639953fc1041aab8 Mon Sep 17 00:00:00 2001 From: Bruce Martin Date: Thu, 21 Nov 2019 14:10:02 -0800 Subject: [PATCH] [WIP] JS lint and dead code removal (#1053) * lint and dead code removal * fix regressions --- .../components/brushableHistogram/index.js | 64 +++++----- .../src/components/categorical/categorical.js | 4 +- client/src/components/categorical/category.js | 10 +- .../src/components/categorical/occupancy.js | 4 +- client/src/components/categorical/value.js | 5 +- .../src/components/continuous/continuous.js | 11 +- .../src/components/framework/custom-icons.js | 16 --- client/src/components/geneExpression/index.js | 113 +++++++++--------- client/src/components/leftSidebar/index.js | 2 - client/src/components/menubar/index.js | 10 +- client/src/components/rightSidebar/index.js | 12 +- client/src/reducers/centroidLabel.js | 11 +- client/src/reducers/colors.js | 2 +- client/src/util/centroid.js | 3 + .../util/stateManager/annotationsHelpers.js | 2 +- .../src/util/typedCrossfilter/crossfilter.js | 4 +- 16 files changed, 118 insertions(+), 155 deletions(-) delete mode 100644 client/src/components/framework/custom-icons.js diff --git a/client/src/components/brushableHistogram/index.js b/client/src/components/brushableHistogram/index.js index 58379b20..8f5755d1 100644 --- a/client/src/components/brushableHistogram/index.js +++ b/client/src/components/brushableHistogram/index.js @@ -44,7 +44,7 @@ class HistogramBrush extends React.PureComponent { return varData.col(field); } - calcHistogramCache = memoize((col, field) => { + calcHistogramCache = memoize(col => { /* recalculate expensive stuff, notably bins, summaries, etc. */ @@ -240,15 +240,23 @@ class HistogramBrush extends React.PureComponent { }; } - drawHistogram(svgRef) { - const { field, world } = this.props; - const col = HistogramBrush.getColumn(world, field); - const histogramCache = this.calcHistogramCache(col, field); - const { x, y, bins } = histogramCache; - this._histogram = { x, y, bins, svgRef }; - } + handleSetGeneAsScatterplotX = () => { + const { dispatch, field } = this.props; + dispatch({ + type: "set scatterplot x", + data: field + }); + }; - handleColorAction() { + handleSetGeneAsScatterplotY = () => { + const { dispatch, field } = this.props; + dispatch({ + type: "set scatterplot y", + data: field + }); + }; + + handleColorAction = () => { const { dispatch, field, world, ranges } = this.props; if (world.obsAnnotations.hasCol(field)) { @@ -260,9 +268,9 @@ class HistogramBrush extends React.PureComponent { } else if (world.varData.hasCol(field)) { dispatch(actions.requestSingleGeneExpressionCountsForColoringPOST(field)); } - } + }; - removeHistogram() { + removeHistogram = () => { const { dispatch, field, @@ -291,26 +299,14 @@ class HistogramBrush extends React.PureComponent { data: null }); } - } + }; - handleSetGeneAsScatterplotX() { - return () => { - const { dispatch, field } = this.props; - dispatch({ - type: "set scatterplot x", - data: field - }); - }; - } - - handleSetGeneAsScatterplotY() { - return () => { - const { dispatch, field } = this.props; - dispatch({ - type: "set scatterplot y", - data: field - }); - }; + drawHistogram(svgRef) { + const { field, world } = this.props; + const col = HistogramBrush.getColumn(world, field); + const histogramCache = this.calcHistogramCache(col); + const { x, y, bins } = histogramCache; + this._histogram = { x, y, bins, svgRef }; } renderAxesBrushBins(x, y, bins, svgRef, field) { @@ -439,7 +435,7 @@ class HistogramBrush extends React.PureComponent {