added side-panel-reducer file, minor code cleanup Arvados-DCO-1.1-Signed-off-by:...
[arvados-workbench2.git] / src / store / store.ts
index 2925d8f9593461b190dea92b406d6f2567cbc560..303b9dc054435abdd699b0aa0d5291e2839b2ec9 100644 (file)
@@ -73,6 +73,7 @@ import { ALL_PROCESSES_PANEL_ID } from './all-processes-panel/all-processes-pane
 import { Config } from 'common/config';
 import { pluginConfig } from 'plugins';
 import { MiddlewareListReducer } from 'common/plugintypes';
+import { sidePanelReducer } from './side-panel/side-panel-reducer'
 
 declare global {
     interface Window {
@@ -185,22 +186,6 @@ export function configureStore(history: History, services: ServiceRepository, co
     return createStore(rootReducer, enhancer);
 }
 
-//TODO: put sidePanel items in separate file and import
-export const toggleSidePanel = (collapsedState: boolean) => {
-    return (dispatch) => {
-        dispatch({type: 'TOGGLE_COLLAPSE', payload: !collapsedState})
-    }
-}
-
-const sidePanelInitialState = {
-    collapsedState: false
-}
-
-const sidePanelReducer = (state = sidePanelInitialState, action)=>{
-    if(action.type === 'TOGGLE_COLLAPSE') return {...state, collapsedState: action.payload}
-    return state
-}
-
 const createRootReducer = (services: ServiceRepository) => combineReducers({
     auth: authReducer(services),
     collectionPanel: collectionPanelReducer,