Interactive interface for browsing global, full-resolution satellite imagery
add props and location resets if exiting subdaily while still having hour or min zoom levels active, make dragger slim, remove extra date redux
Edward Plato117bb79b5d2b
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex d48a5cfe0..0adb1a3ad 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -1401,10 +1401,10 @@ class TimelineAxis extends React.Component {// TODO: componentize with smart update/calc - ex: dont update hover if only dragger updated// dragger and hover offsets, displays, and tooltipslet draggerTimeLeftOffest = draggerSelected === 'selected'- ? draggerPosition - (hasSubdailyLayers ? 90 : 35)- : draggerPositionB - (hasSubdailyLayers ? 90 : 35);+ ? draggerPosition - (hasSubdailyLayers ? 87 : 35)+ : draggerPositionB - (hasSubdailyLayers ? 87 : 35);- let hoverTimeLeftOffset = hasSubdailyLayers ? leftOffset - 139 : leftOffset - 84;+ let hoverTimeLeftOffset = hasSubdailyLayers ? leftOffset - 136 : leftOffset - 84;let draggerToolTip = showDraggerTime && draggerTimeState? draggerSelected === 'selected'diff --git a/web/js/components/timeline/timeline-axis/timeline-dragger.js b/web/js/components/timeline/timeline-axis/timeline-dragger.jsindex 9b2b4d4c3..980f4b232 100644--- a/web/js/components/timeline/timeline-axis/timeline-dragger.js+++ b/web/js/components/timeline/timeline-axis/timeline-dragger.js@@ -61,7 +61,7 @@ class Dragger extends PureComponent {fill={disabled ? '#7a7a7a' : '#ccc'}stroke='#333'strokeWidth='1px'- points='60,20, 95,65, 25,65'>+ points='60,20, 90,65, 30,65'></polygon>{compareModeActive? <textdiff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.jsindex 12a5552d9..bc029ef2b 100644--- a/web/js/containers/timeline/timeline.js+++ b/web/js/containers/timeline/timeline.js@@ -77,21 +77,20 @@ class Timeline extends React.Component {const {endTime,startDate,- selectedDate,hasSubdailyLayers,changeDate} = this.props;let animate = () => {- var nextTime = getNextTimeSelection(delta, increment, selectedDate);+ var nextTime = getNextTimeSelection(delta, increment, this.props.selectedDate);if (hasSubdailyLayers) {// can we remove this logic?if (new Date(startDate) <= nextTime && nextTime <= endTime) {- changeDate(util.dateAdd(selectedDate, increment, delta));+ changeDate(util.dateAdd(this.props.selectedDate, increment, delta));}} else {if (new Date(startDate) <= nextTime && nextTime <= endTime) {- changeDate(util.dateAdd(selectedDate, increment, delta));+ changeDate(util.dateAdd(this.props.selectedDate, increment, delta));}}if (this.state.animationInProcess) {@@ -354,20 +353,18 @@ function mapStateToProps(state) {let hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);customSelected = Boolean(customSelected);- // handle changing timescale and intervals if in subdaily state- // when removing all subdaily layers- // TODO: how to dynamically update store based on remove layer?- // if (!hasSubdailyLayers) {- // if (selectedZoom > 3) {- // selectedZoom = 3;- // }- // if (interval > 3) {- // interval = 3;- // }- // if (customInterval > 3) {- // customInterval = 3;- // }- // }+ // handle reset of timescale and intervals if not subdaily+ if (!hasSubdailyLayers) {+ if (selectedZoom > 3) {+ selectedZoom = 3;+ }+ if (interval > 3) {+ interval = 3;+ }+ if (customInterval > 3) {+ customInterval = 3;+ }+ }let endTime;if (compareModeActive) {diff --git a/web/js/location.js b/web/js/location.jsindex c9059e853..3221c2d3b 100644--- a/web/js/location.js+++ b/web/js/location.js@@ -13,7 +13,7 @@ import {serializeLayers,mapLocationToLayerState} from './modules/layers/util';-import { resetLayers } from './modules/layers/selectors';+import { resetLayers, hasSubDaily } from './modules/layers/selectors';import { eventsReducerState } from './modules/natural-events/reducers';import { mapLocationToPaletteState } from './modules/palettes/util';import util from './util/util';@@ -134,11 +134,21 @@ const getParameters = function(config, parameters) {stateKey: 'date.selectedZoom',initialState: 3,options: {+ serializeNeedsGlobalState: true,+ serialize: (currentItemState, state) => {+ let zoom = currentItemState;+ // check if subdaily timescale zoom to determine if reset is needed+ if (zoom > 3) {+ let { layers, compare } = state;+ let hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);+ if (!hasSubdailyLayers) {+ zoom = 3; // reset to day+ }+ }+ return zoom === 3 ? undefined : zoom.toString();+ },parse: str => {return str ? Number(str) : 3;- },- serialize: val => {- return val.toString();}}},@@ -168,7 +178,16 @@ const getParameters = function(config, parameters) {serialize: (currentItemState, state) => {const isCustomSelected = get(state, 'date.customSelected');if (!isCustomSelected) return undefined;- return currentItemState.toString();+ let customInterval = currentItemState;+ // check if subdaily customInterval to determine if reset is needed+ if (customInterval > 3) {+ let { layers, compare } = state;+ let hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);+ if (!hasSubdailyLayers) {+ customInterval = 3; // reset to day+ }+ }+ return customInterval.toString();},parse: val => {return val.toString();diff --git a/web/js/modules/date/actions.js b/web/js/modules/date/actions.jsindex 79655d3fe..ac189adb7 100644--- a/web/js/modules/date/actions.js+++ b/web/js/modules/date/actions.js@@ -2,7 +2,6 @@ import {CHANGE_TIME_SCALE,CHANGE_CUSTOM_INTERVAL,CHANGE_INTERVAL,- // CHANGE_DELTA,SELECT_DATE} from './constants';@@ -39,9 +38,3 @@ export function selectInterval(delta, interval, customSelected) {customSelected: Boolean(customSelected)};}-// export function selectDelta(delta) {-// return {-// type: CHANGE_DELTA,-// value: delta-// };-// }diff --git a/web/js/modules/date/constants.js b/web/js/modules/date/constants.jsindex a9f4a7dd9..2ac93ceab 100644--- a/web/js/modules/date/constants.js+++ b/web/js/modules/date/constants.js@@ -1,6 +1,5 @@export const CHANGE_CUSTOM_INTERVAL = 'DATE/CHANGE_CUSTOM_INTERVAL';export const CHANGE_INTERVAL = 'DATE/CHANGE_INTERVAL';-// export const CHANGE_DELTA = 'DATE/CHANGE_DELTA';export const CHANGE_TIME_SCALE = 'DATE/CHANGE_TIME_SCALE';export const SELECT_DATE = 'DATE/SELECT_DATE';diff --git a/web/js/modules/date/reducers.js b/web/js/modules/date/reducers.jsindex 8588c01ba..df960663a 100644--- a/web/js/modules/date/reducers.js+++ b/web/js/modules/date/reducers.js@@ -2,7 +2,6 @@ import {CHANGE_TIME_SCALE,CHANGE_CUSTOM_INTERVAL,CHANGE_INTERVAL,- // CHANGE_DELTA,SELECT_DATE} from './constants';import util from '../../util/util';@@ -42,10 +41,6 @@ export function dateReducer(state = defaultState, action) {delta: action.delta,customSelected: action.customSelected});- // case CHANGE_DELTA:- // return lodashAssign({}, state, {- // delta: action.value- // });case SELECT_DATE:return lodashAssign({}, state, {[action.activeString]: action.value