// SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project import {createStore, combineReducers, applyMiddleware, compose} from 'redux'; import keplerGlReducer, {uiStateUpdaters, enhanceReduxMiddleware} from '@kepler.gl/reducers'; import appReducer from './app-reducer'; const customizedKeplerGlReducer = keplerGlReducer .initialState({ mapStyle: { styleType: 'dark-matter' }, uiState: { // hide side panel to disallow user customize the map readOnly: true, // customize which map control button to show mapControls: { ...uiStateUpdaters.DEFAULT_MAP_CONTROLS, visibleLayers: { show: false }, mapLegend: { show: true, active: true }, toggle3d: { show: false }, splitMap: { show: false } } } }) // handle additional actions .plugin({ HIDE_AND_SHOW_SIDE_PANEL: state => ({ ...state, uiState: { ...state.uiState, readOnly: !state.uiState.readOnly } }) }); const reducers = combineReducers({ keplerGl: customizedKeplerGlReducer, app: appReducer }); const middlewares = enhanceReduxMiddleware([]); const enhancers = applyMiddleware(...middlewares); // add redux devtools const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; export default createStore(reducers, {}, composeEnhancers(enhancers));