//
// 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";
isUserActive: boolean;
isNotLinking: boolean;
sessionIdleTimeout: number;
+ sidePanelIsCollapsed: boolean;
}
type WorkbenchPanelProps = WithStyles<CssRules> & WorkbenchDataProps;
routes = React.createElement(React.Fragment, null, pluginConfig.centerPanelList.reduce(reduceRoutesFn, React.Children.toArray(routes.props.children)));
+const applyCollapsedState = (isCollapsed) => {
+ const rightPanel: Element = document.getElementsByClassName('layout-pane')[1]
+ if(rightPanel) {
+ rightPanel.setAttribute('style', `width: ${isCollapsed ? 100 : getSplitterInitialSize()}%`)
+ }
+}
+
export const WorkbenchPanel =
withStyles(styles)((props: WorkbenchPanelProps) =>{
- const [isExpanded, setIsExpanded] = useState<boolean>(false)
-
- const expandRightPanel = (): void=> {
- const rightPanel: Element = document.getElementsByClassName('layout-pane')[1]
- rightPanel.setAttribute('style', `width: ${isExpanded ? getSplitterInitialSize() : 100}%`)
- setIsExpanded(!isExpanded)
- }
-
+ applyCollapsedState(props.sidePanelIsCollapsed)
return <Grid container item xs className={props.classes.root}>
{props.sessionIdleTimeout > 0 && <AutoLogout />}
<Grid container item xs className={props.classes.container}>
<SidePanel />
</Grid>}
<Grid container item xs component="main" direction="column" className={props.classes.contentWrapper}>
- <button onClick={expandRightPanel}>moveSplitter</button>
<Grid item xs>
{props.isNotLinking && <MainContentBar />}
</Grid>