import { Dispatch } from 'redux';
import { navigateTo } from 'store/navigation/navigation-action';
+export const sidePanelActions = {
+ TOGGLE_COLLAPSE: 'TOGGLE_COLLAPSE'
+}
+
export const navigateFromSidePanel = (id: string) =>
(dispatch: Dispatch) => {
dispatch<any>(navigateTo(id));
};
+
+export const toggleSidePanel = (collapsedState: boolean) => {
+ return (dispatch) => {
+ dispatch({type: sidePanelActions.TOGGLE_COLLAPSE, payload: !collapsedState})
+ }
+}
\ No newline at end of file
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 {
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,
));
export const CollapseLeftPanelTrigger = (props) =>{
- console.log(props)
return <Tooltip disableFocusListener title="Toggle Side Panel">
<IconButton onClick={()=>{props.toggleSidePanel(props.sidepanelcollapsed)}}>
<MenuIcon aria-label="Toggle Side Panel" />
import { InactivePanel } from 'views/inactive-panel/inactive-panel';
import { WorkbenchLoadingScreen } from 'views/workbench/workbench-loading-screen';
import { MainAppBar } from 'views-components/main-app-bar/main-app-bar';
-import { toggleSidePanel } from 'store/store';
type CssRules = 'root';
export const MainPanelRoot = withStyles(styles)(
(props: MainPanelRootProps | any) =>{
const{ classes, loading, working, user, buildInfo, uuidPrefix,
- isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout, sidePanelIsCollapsed: sidePanelIsCollapsed } = props
+ isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout, sidePanelIsCollapsed } = props
return loading
? <WorkbenchLoadingScreen />
: <>
import { isWorkbenchLoading } from 'store/workbench/workbench-actions';
import { LinkAccountPanelStatus } from 'store/link-account-panel/link-account-panel-reducer';
import { matchLinkAccountRoute } from 'routes/routes';
-import { toggleSidePanel } from "store/store";
+import { toggleSidePanel } from "store/side-panel/side-panel-action";
const mapStateToProps = (state: RootState): MainPanelRootDataProps => {
return {
//
// SPDX-License-Identifier: AGPL-3.0
-import React, { useState } from 'react';
+import React from 'react';
import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
import { Route, Switch } from "react-router";
import { ProjectPanel } from "views/project-panel/project-panel";