Interactive interface for browsing global, full-resolution satellite imagery
handle default listType in each projection
Jason Kent7d7a23a44457
diff --git a/web/js/containers/projection.js b/web/js/containers/projection.jsindex cf2da72d7..6085cffed 100644--- a/web/js/containers/projection.js+++ b/web/js/containers/projection.js@@ -76,7 +76,7 @@ function mapStateToProps(state) {const mapDispatchToProps = (dispatch, ownProps) => ({updateProjection: (id, config) => {dispatch(changeProjection(id));- dispatch(resetProductPickerState());+ dispatch(resetProductPickerState(id));},onCloseModal: () => {dispatch(onToggle());diff --git a/web/js/modules/product-picker/actions.js b/web/js/modules/product-picker/actions.jsindex bdf4af6b1..b6064689a 100644--- a/web/js/modules/product-picker/actions.js+++ b/web/js/modules/product-picker/actions.js@@ -18,8 +18,9 @@ export function updateListScrollTop(value) {};}-export function resetProductPickerState() {+export function resetProductPickerState(value) {return {- type: RESET_STATE+ type: RESET_STATE,+ value};}diff --git a/web/js/modules/product-picker/reducers.js b/web/js/modules/product-picker/reducers.jsindex a21be87cb..f67872613 100644--- a/web/js/modules/product-picker/reducers.js+++ b/web/js/modules/product-picker/reducers.js@@ -4,7 +4,11 @@ import {RESET_STATE} from './constants';-import { assign as lodashAssign } from 'lodash';+const projToListType = {+ arctic: 'measurements',+ antarctic: 'measurements',+ geographic: 'category'+};export const productPickerState = {listType: 'category',@@ -21,7 +25,7 @@ export const productPickerState = {};export function getInitialState(config) {- return lodashAssign({}, productPickerState, {+ return Object.assign({}, productPickerState, {categoryType: Object.keys(config.categories)[1]});};@@ -29,13 +33,15 @@ export function getInitialState(config) {export function productPickerReducer(state = productPickerState, action) {switch (action.type) {case UPDATE_PRODUCT_PICKER:- return lodashAssign({}, state, action.value);+ return Object.assign({}, state, action.value);case UPDATE_LIST_SCROLL_TOP:- return lodashAssign({}, state, {+ return Object.assign({}, state, {listScrollTop: action.value});case RESET_STATE:- return lodashAssign({}, state, productPickerState);+ var listType = projToListType[action.value];+ var newState = Object.assign({}, productPickerState, { listType });+ return Object.assign({}, state, newState);default:return state;}