16812: Reverted changes in download action, fixed keep links
[arvados-workbench2.git] / src / views-components / side-panel / side-panel.tsx
index 780ecc7fbe77685a6d6c83f002fb46dbc9787610..6599a3fc795a8ca3b1b03eedf42797b3b0c5fbc0 100644 (file)
@@ -6,13 +6,12 @@ import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { SidePanelTree, SidePanelTreeProps } from '~/views-components/side-panel-tree/side-panel-tree';
-import { compose, Dispatch } from 'redux';
+import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
-import { navigateFromSidePanel } from '../../store/side-panel/side-panel-action';
+import { navigateFromSidePanel } from '~/store/side-panel/side-panel-action';
 import { Grid } from '@material-ui/core';
 import { SidePanelButton } from '~/views-components/side-panel-button/side-panel-button';
 import { RootState } from '~/store/store';
-import { SidePanelProgress } from '~/views-components/progress/side-panel-progress';
 
 const DRAWER_WITDH = 240;
 
@@ -34,15 +33,15 @@ const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({
     }
 });
 
-const mapStateToProps = (state: RootState) => ({
-    sidePanelProgress: state.progressIndicator.sidePanelProgress.started
+const mapStateToProps = ({ router }: RootState) => ({
+    currentRoute: router.location ? router.location.pathname : '',
 });
 
-export const SidePanel = compose(
-    withStyles(styles),
-    connect(mapStateToProps, mapDispatchToProps)
-)(({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps) =>
-    <Grid item xs>
-        <SidePanelButton />
-        {props.sidePanelProgress ? <SidePanelProgress /> : <SidePanelTree {...props} />}
-    </Grid>);
\ No newline at end of file
+export const SidePanel = withStyles(styles)(
+    connect(mapStateToProps, mapDispatchToProps)(
+        ({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps & { currentRoute: string }) =>
+            <Grid item xs>
+                <SidePanelButton key={props.currentRoute} />
+                <SidePanelTree {...props} />
+            </Grid>
+    ));