1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { createStore, applyMiddleware, compose, Middleware, combineReducers } from 'redux';
6 import { routerMiddleware, routerReducer, RouterState } from "react-router-redux";
7 import thunkMiddleware from 'redux-thunk';
8 import { History } from "history";
10 import projectsReducer, { ProjectState } from "./project/project-reducer";
11 import sidePanelReducer, { SidePanelState } from './side-panel/side-panel-reducer';
12 import authReducer, { AuthState } from "./auth/auth-reducer";
13 import dataExplorerReducer, { DataExplorerState } from './data-explorer/data-explorer-reducer';
14 import { projectPanelMiddleware } from '../store/project-panel/project-panel-middleware';
15 import detailsPanelReducer, { DetailsPanelState } from './details-panel/details-panel-reducer';
17 const composeEnhancers =
18 (process.env.NODE_ENV === 'development' &&
19 window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
22 export interface RootState {
24 projects: ProjectState;
26 dataExplorer: DataExplorerState;
27 sidePanel: SidePanelState;
28 detailsPanel: DetailsPanelState;
31 const rootReducer = combineReducers({
33 projects: projectsReducer,
34 router: routerReducer,
35 dataExplorer: dataExplorerReducer,
36 sidePanel: sidePanelReducer,
37 detailsPanel: detailsPanelReducer
41 export default function configureStore(history: History) {
42 const middlewares: Middleware[] = [
43 routerMiddleware(history),
45 projectPanelMiddleware
47 const enhancer = composeEnhancers(applyMiddleware(...middlewares));
48 return createStore(rootReducer, enhancer);