Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

plug buttons and scale from map into ui action, add unique toggle button in info list and conditional toolbar for distraction free mode

Edward Plato7ce52d936f71
diff --git a/web/js/containers/info.js b/web/js/containers/info.js
index c2c572738..7222d1aa1 100644
--- a/web/js/containers/info.js
+++ b/web/js/containers/info.js
@@ -7,6 +7,7 @@ import {
renderTemplate,
openCustomContent
} from '../modules/modal/actions';
+import { toggleDistractionFreeMode } from '../modules/ui/actions';
import { ABOUT_PAGE_REQUEST } from '../modules/modal/constants';
import IconList from '../components/util/list';
import { onClickFeedback } from '../modules/feedback/util';
@@ -84,6 +85,14 @@ class InfoList extends Component {
onClick: () => {
aboutClick();
}
+ },
+ {
+ text: 'Distraction Free',
+ iconClass: 'ui-icon far fa-eye fa-fw',
+ id: 'distraction_free_info_item',
+ onClick: () => {
+ this.props.toggleDistractionFreeMode();
+ }
}
];
if (
@@ -132,6 +141,9 @@ function mapStateToProps(state) {
};
}
const mapDispatchToProps = dispatch => ({
+ toggleDistractionFreeMode: () => {
+ dispatch(toggleDistractionFreeMode());
+ },
sendFeedback: isInitiated => {
onClickFeedback(isInitiated);
if (!isInitiated) {
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index e3062970d..dd670cf28 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -151,7 +151,7 @@ class toolbarContainer extends Component {
title="Toggle Distraction Free Mode"
onClick={() => this.props.toggleDistractionFreeMode() }
>
- <i className="fas fa-share-square fa-2x" />
+ <i className="far fa-eye fa-2x" />
</Button>
: <React.Fragment>
<Button
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index c7be685a0..30fd6dc36 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -101,12 +101,14 @@ export function mapui(models, config, store, ui) {
case TOGGLE_DISTRACTION_FREE_MODE: {
var map = self.selected;
if (action.isDistractionFreeModeActive) {
+ // hide map scale and zoom buttons
map.removeControl(map.wv.scaleImperial);
map.removeControl(map.wv.scaleMetric);
$('#' + map.getTarget() + ' .select-wrapper').hide();
$('.wv-map-zoom-in').hide();
$('.wv-map-zoom-out').hide();
} else {
+ // show map scale and zoom buttons
map.addControl(map.wv.scaleImperial);
map.addControl(map.wv.scaleMetric);
$('#' + map.getTarget() + ' .select-wrapper').show();
diff --git a/web/js/modules/ui/actions.js b/web/js/modules/ui/actions.js
index b97ca2080..1a6bc1e3e 100644
--- a/web/js/modules/ui/actions.js
+++ b/web/js/modules/ui/actions.js
@@ -1,9 +1,11 @@
import { TOGGLE_DISTRACTION_FREE_MODE } from './constants';
export function toggleDistractionFreeMode() {
- return (dispatch) => {
+ return (dispatch, getState) => {
+ const newisDistractionFreeModeActive = getState().ui.isDistractionFreeModeActive;
dispatch({
- type: TOGGLE_DISTRACTION_FREE_MODE
+ type: TOGGLE_DISTRACTION_FREE_MODE,
+ isDistractionFreeModeActive: !newisDistractionFreeModeActive
});
};
}