Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add comments and make code-style changes #1576

Benjamin King25aed929d56f
diff --git a/web/js/combine-middleware.js b/web/js/combine-middleware.js
index 3a6bebb72..5742abd7e 100644
--- a/web/js/combine-middleware.js
+++ b/web/js/combine-middleware.js
@@ -1,7 +1,14 @@
import thunkMiddleware from 'redux-thunk'; // For ASYNC actions
import { compact } from 'lodash';
import { createLogger } from 'redux-logger';
+
const loggerMiddleware = createLogger({ collapsed: true });
+
+/**
+ * Combine necessary middleware
+ * @param {Boolean} isDevelop | Is development server
+ * @param {Object} locationMiddleware | redux-location-state middleware
+ */
export function getMiddleware(isDevelop, locationMiddleware) {
return isDevelop
? compact([thunkMiddleware, locationMiddleware, loggerMiddleware])
diff --git a/web/js/combine-models.js b/web/js/combine-models.js
index bc8918fc5..9ae784ad2 100644
--- a/web/js/combine-models.js
+++ b/web/js/combine-models.js
@@ -11,7 +11,11 @@ import { compareModel } from './compare/model';
import { tourModel } from './tour/model';
import naturalEventsModel from './natural-events/model';
-export function combineModels(config, state) {
+/**
+ * Return initiated legacy models Object
+ * @param {Object} config
+ */
+export function combineModels(config) {
let models = {
wv: {
events: util.events()
diff --git a/web/js/combine-ui.js b/web/js/combine-ui.js
index f21ff2cba..40a611a03 100644
--- a/web/js/combine-ui.js
+++ b/web/js/combine-ui.js
@@ -37,6 +37,13 @@ import { animationGif } from './animation/gif';
import naturalEventsUI from './natural-events/ui';
import naturalEventsRequest from './natural-events/request';
import { debugLayers } from './debug';
+
+/**
+ * Legacy UI Rendering
+ * @param {Object} models | Legacy Models Object
+ * @param {Object} config
+ * @param {Object} MapMouseEvents | Map events object that is registered here and used in react to render coords
+ */
export function combineUi(models, config, MapMouseEvents) {
let ui = {};
let mapComponents = {
diff --git a/web/js/components/util/image-crop.js b/web/js/components/util/image-crop.js
index 3cbb79ebf..0b2ab3ba4 100644
--- a/web/js/components/util/image-crop.js
+++ b/web/js/components/util/image-crop.js
@@ -6,13 +6,13 @@ import { Portal } from 'react-portal';
// https://stackoverflow.com/a/13139830
const TRANSPARENT_GIF =
'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
+
/*
* A react reuseable list component
*
* @class List
* @extends React.Component
*/
-
export default class Crop extends React.Component {
constructor(props) {
super(props);
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index b4a583107..a74d83775 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -79,74 +79,3 @@ export function serializeDate(date) {
'Z'
);
}
-// return {
-// stateKey: stateKey,
-// initialState: initialState,
-// type: 'date',
-// options: {
-// serialize: date => {
-// if (!date) date = initialState;
-// return serializeDate(date);
-// },
-// parse: str => {
-// return parseDate(str, initialState);
-// }
-// }
-// };
-// export function getDateParameterSetup(parameters) {
-// const nowInital = util.now();
-// const now = parseNow(parameters.now);
-// return {
-// t: getPermalinkManagementObject(now, 'legacy.date.selected'),
-// t1: getPermalinkManagementObject(
-// util.dateAdd(now, 'day', -7),
-// 'legacy.date.selectedB'
-// ),
-// now: {
-// stateKey: 'legacy.date.now',
-// initialState: nowInital,
-// type: 'date',
-// options: {
-// serialize: serializeDate,
-// parse: parseNow
-// }
-// }
-// };
-// }
-// export function getPermalinkManagementObject(initialState, stateKey) {
-// return {
-// stateKey: stateKey,
-// initialState: initialState,
-// type: 'date',
-// options: {
-// serialize: date => {
-// if (!date) date = initialState;
-// return serializeDate(date);
-// },
-// parse: str => {
-// return parseDate(str, initialState);
-// }
-// }
-// };
-// }
-
-// export function parseNow(date) {
-// try {
-// const now = util.parseDateUTC(date);
-// util.now = function() {
-// return new Date(now.getTime());
-// };
-// return util.now();
-// } catch (error) {
-// util.warn('Invalid now: ' + date + error);
-// return util.now();
-// }
-// }
-// export function parseDate(str, initialState) {
-// try {
-// return util.parseDateUTC(str);
-// } catch (error) {
-// util.warn('Invalid date:' + str + error);
-// return initialState;
-// }
-// }
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index f26373ba2..be8fa2c29 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -1,4 +1,3 @@
-// import { isUndefined as lodashIsUndefined, each as lodashEach } from 'lodash';
import util from '../../util/util';
import { encode } from '../link/util';
diff --git a/web/js/modules/natural-events/util.js b/web/js/modules/natural-events/util.js
index ca252d6b5..fca1b908c 100644
--- a/web/js/modules/natural-events/util.js
+++ b/web/js/modules/natural-events/util.js
@@ -1,4 +1,4 @@
-import { get } from 'redux-location-state/lib/helpers';
+import { get } from 'lodash';
import { encode } from '../link/util';
export function getNaturalEventsParameterSetup(
parameters,