Interactive interface for browsing global, full-resolution satellite imagery
Create redux feedback module #1553
Benjamin King47a39cc7e2c4
diff --git a/web/js/modules/feedback/actions.js b/web/js/modules/feedback/actions.jsnew file mode 100644index 000000000..5d6a3266b--- /dev/null+++ b/web/js/modules/feedback/actions.js@@ -0,0 +1,7 @@+import { INIT_FEEDBACK } from './constants';++export function initFeedback() {+ return {+ type: INIT_FEEDBACK+ };+}diff --git a/web/js/modules/feedback/constants.js b/web/js/modules/feedback/constants.jsnew file mode 100644index 000000000..916f63ac4--- /dev/null+++ b/web/js/modules/feedback/constants.js@@ -0,0 +1,6 @@+/* The feedback global variable is defined by+ * https://fbm.earthdata.nasa.gov/for/worldview/feedback.js+ * which is included via config.scripts in web/config/wv.json+ */+export const INIT_FEEDBACK = 'INITIATE_FEEDBACK_MODULE';+export const href = 'mailto:@MAIL@?subject=Feedback for @LONG_NAME@ tool';diff --git a/web/js/modules/feedback/reducers.js b/web/js/modules/feedback/reducers.jsnew file mode 100644index 000000000..6201ad5de--- /dev/null+++ b/web/js/modules/feedback/reducers.js@@ -0,0 +1,16 @@+import { INIT_FEEDBACK } from './constants';+import { assign as lodashAssign } from 'lodash';+const feedbackState = {+ isInitiated: false+};++export default function projectionReducer(state = feedbackState, action) {+ switch (action.type) {+ case INIT_FEEDBACK:+ return lodashAssign({}, state, {+ isInitiated: true+ });+ default:+ return state;+ }+}diff --git a/web/js/modules/feedback/util.js b/web/js/modules/feedback/util.jsnew file mode 100644index 000000000..fb1e1f0d7--- /dev/null+++ b/web/js/modules/feedback/util.js@@ -0,0 +1,20 @@+/* global feedback */++/* The feedback global variable is defined by+ * https://fbm.earthdata.nasa.gov/for/worldview/feedback.js+ * which is included via config.scripts in web/config/wv.json+ */++import util from '../../util/util';++export function onClickFeedback(wasInitiated) {+ if (!util.browser.small && window.feedback) {+ event.preventDefault();+ if (!wasInitiated) {+ feedback.init({+ showIcon: false+ });+ }+ feedback.showForm();+ }+}