forked from resource-watch/resource-watch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
136 lines (103 loc) · 3.85 KB
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import { createStore, applyMiddleware, combineReducers } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import thunk from 'redux-thunk';
import { handleModule } from 'redux-tools';
// TO-DO: move redactions to modules
import * as reducers from 'redactions';
import modules from 'modules';
// Layout
import * as header from 'layout/header';
import * as headerAdmin from 'layout/header-admin';
// Search
import * as search from 'layout/search';
// Share
import * as shareModal from 'components/modal/share-modal';
// Dashboard
import * as widgetBlockModule from 'components/wysiwyg/widget-block';
// Dataset
import * as datasetListItem from 'components/datasets/list/list-item';
import * as similarDatasets from 'components/datasets/similar-datasets/similar-datasets';
import * as trySubscriptionModal from 'components/datasets/form/try-subscription-modal';
// subscriptions
import * as subscriptions from 'components/modal/subscriptions-modal';
// Tools
import * as relatedTools from 'components/tools/related-tools';
// Explore
import * as explore from 'layout/explore';
// Explore detail
import * as exploreDetail from 'layout/explore-detail';
// Pulse
import * as pulse from 'layout/app/pulse';
import * as layerContainer from 'layout/app/pulse/layer-container';
import * as layerMenu from 'layout/app/pulse/layer-menu';
import * as layerCard from 'layout/app/pulse/layer-card';
import * as layerPill from 'layout/app/pulse/layer-pill';
import * as labelsPill from 'layout/app/pulse/labels-pill';
import * as globeCesium from 'components/vis/globe-cesium';
// Get Involved
import * as getInvolvedIndex from 'layout/get-involved';
import * as getInvolvedDetail from 'layout/get-involved-detail';
// Admin Interactions
import * as adminInteractions from 'components/admin/data/layers/form/interactions';
import * as adminLayerPreview from 'components/admin/data/layers/form/layer-preview';
// Widget editor
import { reducers as widgetEditorModules } from 'widget-editor';
// React responsive redux
import { reducer as responsiveReducer } from 'react-responsive-redux';
// Embed
import * as embedMapSwipe from 'layout/embed/map-swipe';
// REDUCERS
const reducer = combineReducers({
...reducers,
...modules,
// widgetEditor
...widgetEditorModules,
// React responsive
responsive: responsiveReducer,
// Header
header: handleModule(header),
headerAdmin: handleModule(headerAdmin),
// Search
search: handleModule(search),
// Share
shareModal: handleModule(shareModal),
// Dashboards
widgetBlock: handleModule(widgetBlockModule),
// Explore
explore: handleModule(explore),
exploreDetail: handleModule(exploreDetail),
// Pulse
layerContainerPulse: handleModule(layerContainer),
layerMenuPulse: handleModule(layerMenu),
layerCardPulse: handleModule(layerCard),
contextLayersPulse: handleModule(layerPill),
labelsPulse: handleModule(labelsPill),
globeCesium: handleModule(globeCesium),
pulse: handleModule(pulse),
// Dataset
datasetListItem: handleModule(datasetListItem),
similarDatasets: handleModule(similarDatasets),
trySubscriptionModal: handleModule(trySubscriptionModal),
// subscriptions
subscriptions: handleModule(subscriptions),
// Tools
relatedTools: handleModule(relatedTools),
// Get Involved
getInvolvedIndex: handleModule(getInvolvedIndex),
getInvolvedDetail: handleModule(getInvolvedDetail),
// Admin interactions
interactions: handleModule(adminInteractions),
// Admin layer preview
adminLayerPreview: handleModule(adminLayerPreview),
// Embed
embedMapSwipe: handleModule(embedMapSwipe)
});
export const initStore = (initialState = {}) => createStore(
reducer,
initialState,
composeWithDevTools(
/* The router middleware MUST be before thunk otherwise the URL changes
* inside a thunk function won't work properly */
applyMiddleware(thunk)
)
);