Interactive interface for browsing global, full-resolution satellite imagery
Rename layer arrays to mimic old code #1623
Benjamin King51bef2704594
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.jsindex 7c20322d0..93d7f162d 100644--- a/web/js/components/layer/product-picker/product-picker.js+++ b/web/js/components/layer/product-picker/product-picker.js@@ -276,7 +276,7 @@ function mapStateToProps(state, ownProps) {const height = screenHeight - 100;const width = getModalWidth(screenWidth);const allLayers = getLayersForProjection(config, proj.id);- const activeLayers = layers['layers' + activeString];+ const activeLayers = layers[activeString];return {categoryConfig: config.categories,diff --git a/web/js/components/sidebar/data/data.js b/web/js/components/sidebar/data/data.jsindex 914589c75..7b1c502e5 100644--- a/web/js/components/sidebar/data/data.js+++ b/web/js/components/sidebar/data/data.js@@ -73,7 +73,7 @@ function mapStateToProps(state, ownProps) {const { layers, proj, data, config } = state;const { selectedProduct, selectedGranules } = data;const { activeString } = layers;- const activeLayers = layers['layers' + activeString];+ const activeLayers = layers[activeString];const counts = getSelectionCounts(activeLayers, selectedGranules);const products = getDataProductsFromActiveLayers(activeLayers,diff --git a/web/js/components/sidebar/footer-content.js b/web/js/components/sidebar/footer-content.jsindex bc605edbd..791b5f759 100644--- a/web/js/components/sidebar/footer-content.js+++ b/web/js/components/sidebar/footer-content.js@@ -155,7 +155,7 @@ function mapStateToProps(state, ownProps) {const events = lodashGet(requestedEvents, 'response');const { activeString } = layers;const { selectedGranules } = data;- const activeLayers = layers['layers' + activeString];+ const activeLayers = layers[activeString];const counts = getSelectionCounts(activeLayers, selectedGranules);const dataSelectionSize = getDataSelectionSize(selectedGranules);diff --git a/web/js/components/sidebar/products/products.js b/web/js/components/sidebar/products/products.jsindex c396295ee..792059470 100644--- a/web/js/components/sidebar/products/products.js+++ b/web/js/components/sidebar/products/products.js@@ -46,8 +46,8 @@ function mapStateToProps(state, ownProps) {const { layers, proj } = state;const { activeString } = layers;const { isActive, layerGroupName, height, checkerBoardPattern } = ownProps;- const group = 'layers' + layerGroupName;- const componentLayers = layers[group] || layers['layers' + activeString];+ const group = layerGroupName;+ const componentLayers = layers[group] || layers[activeString];const layerObj = getLayers(componentLayers, { proj: proj.id, group: 'all' });return {diff --git a/web/js/containers/sidebar.js b/web/js/containers/sidebar.jsindex a0f8d04df..24ffe181b 100644--- a/web/js/containers/sidebar.js+++ b/web/js/containers/sidebar.js@@ -115,7 +115,7 @@ class Sidebar extends React.Component {<Productsheight={subComponentHeight}isActive={activeTab === 'layers'}- layerGroupName="A"+ layerGroupName="active"checkerBoardPattern={this.checkerBoardPattern}/>);@@ -198,8 +198,7 @@ function mapStateToProps(state) {const { screenHeight } = browser;const { activeTab, isCollapsed } = sidebar;const { activeString } = layers;- const numberOfLayers = getLayers(layers['layers' + activeString], {}, state)- .length;+ const numberOfLayers = getLayers(layers[activeString], {}, state).length;const tabTypes = getActiveTabs(config);return {diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.jsindex 7afa0b2db..b219879fa 100644--- a/web/js/modules/layers/actions.js+++ b/web/js/modules/layers/actions.js@@ -18,7 +18,7 @@ export function addLayer(layerId) {export function resetLayers(stateStr) {return {type: RESET_LAYERS,- stateStr: stateStr || 'A'+ stateStr: stateStr || 'active'};}export function initSecondLayerGroup() {diff --git a/web/js/modules/layers/reducers.js b/web/js/modules/layers/reducers.jsindex 75d321fa3..bb9a007e9 100644--- a/web/js/modules/layers/reducers.js+++ b/web/js/modules/layers/reducers.js@@ -13,10 +13,10 @@ import { toggleVisibility, removeLayer } from './util';import { cloneDeep as lodashCloneDeep, assign as lodashAssign } from 'lodash';export const initialState = {- layersA: [],- layersB: [],+ active: [],+ activeB: [],layersConfig: {},- activeString: 'A',+ activeString: 'active',hoveredLayer: '',layerConfig: {},startingLayers: []@@ -24,19 +24,19 @@ export const initialState = {export function getInitialState(config) {console.log(resetLayers(config.defaults.startingLayers, config.layers));return lodashAssign({}, initialState, {- layersA: resetLayers(config.defaults.startingLayers, config.layers),+ active: resetLayers(config.defaults.startingLayers, config.layers),layerConfig: config.layers,startingLayers: config.defaults.startingLayers});}export function layerReducer(state = initialState, action) {- const layerGroupStr = 'layers' + state.activeString;+ const layerGroupStr = state.activeString;switch (action.type) {case RESET_LAYERS:if (- (action.stateStr && action.stateStr === 'B') ||- state.activeString === 'B'+ (action.stateStr && action.stateStr === 'activeB') ||+ state.activeString === 'activeB') {return lodashAssign({}, state, {layersB: resetLayers()@@ -68,7 +68,7 @@ export function layerReducer(state = initialState, action) {});case TOGGLE_ACTIVE_STATE:return lodashAssign({}, state, {- activeString: state.activeString === 'A' ? 'B' : 'A'+ activeString: state.activeString === 'active' ? 'activeB' : 'active'});case ON_LAYER_HOVER:return lodashAssign({}, state, {