Interactive interface for browsing global, full-resolution satellite imagery
various minor tweaks
Jason Kentde48754555ee
diff --git a/web/js/components/sidebar/events-filter.js b/web/js/components/sidebar/events-filter.jsindex 4f1700f40..d230b83e3 100644--- a/web/js/components/sidebar/events-filter.js+++ b/web/js/components/sidebar/events-filter.js@@ -75,6 +75,7 @@ function EventsFilter (props) {value={dateRange}minDate={new Date('01-01-1975')}maxDate={new Date()}+ disableCalendarrequired/>diff --git a/web/js/map/natural-events/natural-events.js b/web/js/map/natural-events/natural-events.jsindex e6c8c137a..8889dd70b 100644--- a/web/js/map/natural-events/natural-events.js+++ b/web/js/map/natural-events/natural-events.js@@ -86,7 +86,7 @@ class NaturalEvents extends React.Component {selectEvent(id, date, isInitialLoad) {const { prevSelectedEvent } = this.state;const {- mapUi, selectDate, selectEventFinished, eventsData,+ mapUi, selectDate, selectEventFinished, eventsData, activateLayersForEventCategory,} = this.props;const isIdChange = !prevSelectedEvent || prevSelectedEvent.id !== id;@@ -120,7 +120,7 @@ class NaturalEvents extends React.Component {selectDate(util.parseDateUTC(date));}if (isIdChange && !isSameCategory && !isInitialLoad) {- this.activateLayersForCategory(event.categories[0].title);+ activateLayersForEventCategory(event.categories[0].title);}// hack to update layersif (isIdChange) {@@ -154,16 +154,6 @@ class NaturalEvents extends React.Component {return mapUi.animate.fly(coordinates, zoom, null);};- /**- * Add the relevant layers for event based on projection and category- * @param {*} category- */- activateLayersForCategory(category = 'Default') {- const { config, proj, activateLayersForEventCategory } = this.props;- const { layers } = config.naturalEvents;- activateLayersForEventCategory(layers[proj.id][category]);- }-render() {const { eventsData } = this.props;return !eventsData ? null : (@@ -177,13 +167,12 @@ class NaturalEvents extends React.Component {const mapStateToProps = (state) => {const {- events, config, map, proj, requestedEvents,+ events, map, proj, requestedEvents,} = state;const selectedMap = map.ui.selected;return {map: selectedMap,mapUi: map.ui,- config,proj,eventsDataIsLoading: requestedEvents.isLoading,eventsData: requestedEvents.response,@@ -192,8 +181,8 @@ const mapStateToProps = (state) => {};const mapDispatchToProps = (dispatch) => ({- activateLayersForEventCategory: (layers) => {- dispatch(activateLayersForEventCategoryAction(layers));+ activateLayersForEventCategory: (category = 'Default') => {+ dispatch(activateLayersForEventCategoryAction(category));},selectDate: (date) => {dispatch(selectDateAction(date));@@ -205,7 +194,6 @@ const mapDispatchToProps = (dispatch) => ({NaturalEvents.propTypes = {activateLayersForEventCategory: PropTypes.func,- config: PropTypes.object,eventsData: PropTypes.array,eventsDataIsLoading: PropTypes.bool,selectedEvent: PropTypes.object,diff --git a/web/js/map/natural-events/util.js b/web/js/map/natural-events/util.jsindex 255d501fe..7722442f0 100644--- a/web/js/map/natural-events/util.js+++ b/web/js/map/natural-events/util.js@@ -10,7 +10,7 @@ import util from '../../util/util';export function getEventsRequestURL (baseUrl, startDate, endDate, categories = []) {const params = {status: 'all',- limit: 50,+ limit: 100,};if (startDate && endDate) {params.start = moment.utc(startDate).format('YYYY-MM-DD');diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.jsindex d5d869e6b..f400f726d 100644--- a/web/js/modules/layers/actions.js+++ b/web/js/modules/layers/actions.js@@ -48,13 +48,10 @@ export function initSecondLayerGroup() {};}-export function activateLayersForEventCategory(activeLayers) {+export function activateLayersForEventCategory(category) {return (dispatch, getState) => {const state = getState();- const newLayers = activateLayersForEventCategorySelector(- activeLayers,- state,- );+ const newLayers = activateLayersForEventCategorySelector(state, category);const overlayGroups = getOverlayGroups(newLayers);overlayGroups.forEach((group) => { group.collapsed = true; });dispatch({diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.jsindex 8b20aa455..f2d3b179d 100644--- a/web/js/modules/layers/selectors.js+++ b/web/js/modules/layers/selectors.js@@ -487,21 +487,27 @@ export function isRenderable(id, layers, date, state) {return !obscured;}-export function activateLayersForEventCategory(activeLayers, state) {+export function activateLayersForEventCategory(state, category) {+ const projection = state.proj.id;+ const { layers } = state.config.naturalEvents;const { layerConfig } = state.layers;+ const categoryLayers = layers[projection][category];+// Turn off all layers in list firstlet newLayers = getActiveLayers(state);- lodashEach(newLayers, (layer, index) => {+ newLayers.forEach((layer, index) => {newLayers = update(newLayers, {[index]: { visible: { $set: false } },});});if (state.embed.isEmbedModeActive) {- activeLayers = activeLayers.filter((layer) => layer[1]);+ newLayers = categoryLayers.filter((layer) => layer[1]);}// Turn on or add new layers- lodashEach(activeLayers, (layer) => {+ categoryLayers.forEach((layer) => {const [id, visible] = layer;+ // const isAvailable = available(state, id);+ // console.log(isAvailable);const index = lodashFindIndex(newLayers, { id });if (index >= 0) {newLayers = update(newLayers, {