X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bfaee40696c3c15556ef089e69da47bb832b08db..894deddbed7f00569ec2fb6d35d5709888b22608:/services/workbench2/src/views/main-panel/main-panel-root.tsx

diff --git a/services/workbench2/src/views/main-panel/main-panel-root.tsx b/services/workbench2/src/views/main-panel/main-panel-root.tsx
index e5514d8ef6..9654f4eb27 100644
--- a/services/workbench2/src/views/main-panel/main-panel-root.tsx
+++ b/services/workbench2/src/views/main-panel/main-panel-root.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import React from 'react';
+import React, { useEffect } from 'react';
 import { StyleRulesCallback, WithStyles, withStyles, Grid, LinearProgress } from '@material-ui/core';
 import { User } from "models/user";
 import { ArvadosTheme } from 'common/custom-theme';
@@ -11,6 +11,7 @@ import { LoginPanel } from 'views/login-panel/login-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 { Routes } from 'routes/routes';
 
 type CssRules = 'root';
 
@@ -33,10 +34,14 @@ export interface MainPanelRootDataProps {
     siteBanner: string;
     sessionIdleTimeout: number;
     sidePanelIsCollapsed: boolean;
+    isTransitioning: boolean;
+    currentSideWidth: number;
+    currentRoute: string;
 }
 
 interface MainPanelRootDispatchProps {
-    toggleSidePanel: () => void
+    toggleSidePanel: () => void,
+    setCurrentRouteUuid: (uuid: string | null) => void;
 }
 
 type MainPanelRootProps = MainPanelRootDataProps & MainPanelRootDispatchProps & WithStyles<CssRules>;
@@ -44,7 +49,19 @@ type MainPanelRootProps = MainPanelRootDataProps & MainPanelRootDispatchProps &
 export const MainPanelRoot = withStyles(styles)(
     ({ classes, loading, working, user, buildInfo, uuidPrefix,
         isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout, 
-        sidePanelIsCollapsed, toggleSidePanel }: MainPanelRootProps) =>{
+        sidePanelIsCollapsed, isTransitioning, currentSideWidth, currentRoute, setCurrentRouteUuid}: MainPanelRootProps) =>{
+
+            useEffect(() => {
+                const splitRoute = currentRoute.split('/');
+                const uuid = splitRoute[splitRoute.length - 1];
+                if(Object.values(Routes).includes(`/${uuid}`) === false) {
+                    setCurrentRouteUuid(uuid);
+                } else {
+                    setCurrentRouteUuid(null);
+                }
+                // eslint-disable-next-line react-hooks/exhaustive-deps
+            }, [currentRoute]);
+
         return loading
             ? <WorkbenchLoadingScreen />
             : <>
@@ -62,7 +79,13 @@ export const MainPanelRoot = withStyles(styles)(
             <Grid container direction="column" className={classes.root}>
                 {user
                     ? (user.isActive || (!user.isActive && isLinkingPath)
-                    ? <WorkbenchPanel isNotLinking={isNotLinking} isUserActive={user.isActive} sessionIdleTimeout={sessionIdleTimeout} sidePanelIsCollapsed={sidePanelIsCollapsed}/>
+                    ? <WorkbenchPanel 
+                        isNotLinking={isNotLinking}
+                        isUserActive={user.isActive}
+                        sessionIdleTimeout={sessionIdleTimeout}
+                        sidePanelIsCollapsed={sidePanelIsCollapsed}
+                        isTransitioning={isTransitioning}
+                        currentSideWidth={currentSideWidth}/>
                     : <InactivePanel />)
                     : <LoginPanel />}
             </Grid>
