1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
7 import Drawer from '@material-ui/core/Drawer';
8 import { ArvadosTheme } from '~/common/custom-theme';
9 import { SidePanelTree, SidePanelTreeProps } from '~/views-components/side-panel-tree/side-panel-tree';
10 import { compose, Dispatch } from 'redux';
11 import { connect } from 'react-redux';
12 import { navigateFromSidePanel } from '../../store/side-panel/side-panel-action';
14 const DRAWER_WITDH = 240;
16 type CssRules = 'drawerPaper' | 'toolbar';
18 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
23 flexDirection: 'column',
27 toolbar: theme.mixins.toolbar
30 const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({
31 onItemActivation: id => {
32 dispatch<any>(navigateFromSidePanel(id));
36 export const SidePanel = compose(
38 connect(undefined, mapDispatchToProps)
39 )(({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps) =>
42 classes={{ paper: classes.drawerPaper }}>
43 <div className={classes.toolbar} />
44 <SidePanelTree {...props} />