Clean up unused code, add comments, tidy up

This commit is contained in:
Franc Camps-Febrer
2018-11-26 10:02:17 -05:00
parent a33e8769a9
commit 16625ba1f1
13 changed files with 74 additions and 1011 deletions

View File

@@ -1,8 +1,4 @@
import {
createStore,
applyMiddleware,
compose
} from 'redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';

View File

@@ -1,27 +1,33 @@
// TODO: annotate sections of this state.
// NB: why does this canvas document need to be created?
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
const initial = {
/*
* The Domain or 'domain' of this state refers to the tree of data
* available for render and display.
* Selections and filters in the 'app' subtree will operate the domain
* in mapStateToProps of the Dashboard, and deterimne which items
* in the domain will get rendered by React
*/
domain: {
events: [],
narratives: [],
locations: [],
categories: [],
sites: [],
// Tag tree
tags: { },
tags: {},
notifications: [],
},
/*
* The 'app' subtree of this state determines the data and information to be
* displayed.
* It may refer to those the user interacts with, by selecting,
* fitlering and so on, which ultimately operate on the data to be displayed.
* Additionally, some of the 'app' flags are determined by the config file
* or by the characteristics of the client, browser, etc.
*/
app: {
error: null,
highlighted: null,
selected: [],
notifications: [],
filters: {
timerange: [
d3.timeParse("%Y-%m-%dT%H:%M:%S")("2014-08-22T12:00:00"),
@@ -38,7 +44,6 @@ const initial = {
},
base_uri: 'http://127.0.0.1:8000/', // Modify accordingly on production setup.
isMobile: (/Mobi/.test(navigator.userAgent)),
isWebGL: (gl && gl instanceof WebGLRenderingContext),
language: 'en-US',
mapAnchor: process.env.MAP_ANCHOR,
features: {
@@ -46,6 +51,12 @@ const initial = {
USE_SEARCH: process.env.features.USE_SEARCH
}
},
/*
* The 'ui' subtree of this state refers the state of the cosmetic
* elements of the application, such as color palettes of groups or how some
* of the UI tools are enabled or disabled dynamically by the user
*/
ui: {
style: {
colors: {
@@ -77,9 +88,7 @@ const initial = {
flags: {
isFetchingDomain: false,
isFetchingEvents: false,
isView2d: true,
isTimeline: true,
isToolbar: false,
isCardstack: true,
isInfopopup: false,
isNotification: true
@@ -88,9 +97,6 @@ const initial = {
formatter: d3.timeFormat("%d %b, %H:%M"),
formatterWithYear: d3.timeFormat("%d %b %Y, %H:%M"),
parser: d3.timeParse("%Y-%m-%dT%H:%M:%S")
},
components: {
toolbarTab: false,
}
}
};