X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c314adae7b1551ef6682d4a3760bda5787b989ce..8228d441690ed78340e1a44f3e0bf8b4f94215a0:/src/views-components/side-panel/side-panel-collapsed.tsx?ds=sidebyside

diff --git a/src/views-components/side-panel/side-panel-collapsed.tsx b/src/views-components/side-panel/side-panel-collapsed.tsx
index ba829f6c30..18e4df2527 100644
--- a/src/views-components/side-panel/side-panel-collapsed.tsx
+++ b/src/views-components/side-panel/side-panel-collapsed.tsx
@@ -5,7 +5,8 @@
 import React, { ReactElement } from 'react'
 import { connect } from 'react-redux'
 import { ProjectsIcon, ProcessIcon, FavoriteIcon, ShareMeIcon, TrashIcon, PublicFavoriteIcon, GroupsIcon } from 'components/icon/icon'
-import { List, ListItem, Tooltip } from '@material-ui/core'
+import { TerminalIcon } from 'components/icon/icon'
+import { IconButton, List, ListItem, Tooltip } from '@material-ui/core'
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'
 import { ArvadosTheme } from 'common/custom-theme'
 import { navigateTo } from 'store/navigation/navigation-action'
@@ -19,24 +20,35 @@ import {
     navigateToAllProcesses,
     navigateToTrash,
 } from 'store/navigation/navigation-action'
+import { navigateToUserVirtualMachines } from 'store/navigation/navigation-action'
 import { RouterAction } from 'react-router-redux'
 
-type CssRules = 'root' | 'icon'
+type CssRules = 'button' | 'unselected' | 'selected'
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {},
-    icon: {
-        color: theme.customs.colors.grey700,
+    button: {
+        width: '40px',
+        height: '40px',
+        paddingLeft: '-2rem',
+        marginLeft: '-0.6rem',
+        marginBottom: '-1rem'
+    },
+    unselected: {
+        color: theme.customs.colors.grey600,
+    },
+    selected: {
+        color: theme.palette.primary.main,
     },
 })
 
 enum SidePanelCollapsedCategory {
     PROJECTS = 'Home Projects',
-    SHARED_WITH_ME = 'Shared with me',
-    PUBLIC_FAVORITES = 'Public Favorites',
     FAVORITES = 'My Favorites',
-    GROUPS = 'Groups',
+    PUBLIC_FAVORITES = 'Public Favorites',
+    SHARED_WITH_ME = 'Shared with me',
     ALL_PROCESSES = 'All Processes',
+    SHELL_ACCESS = 'Shell Access',
+    GROUPS = 'Groups',
     TRASH = 'Trash',
 }
 
@@ -53,9 +65,9 @@ const sidePanelCollapsedCategories: TCollapsedCategory[] = [
         navTarget: '',
     },
     {
-        name: SidePanelCollapsedCategory.SHARED_WITH_ME,
-        icon: <ShareMeIcon />,
-        navTarget: navigateToSharedWithMe,
+        name: SidePanelCollapsedCategory.FAVORITES,
+        icon: <FavoriteIcon />,
+        navTarget: navigateToFavorites,
     },
     {
         name: SidePanelCollapsedCategory.PUBLIC_FAVORITES,
@@ -63,20 +75,25 @@ const sidePanelCollapsedCategories: TCollapsedCategory[] = [
         navTarget: navigateToPublicFavorites,
     },
     {
-        name: SidePanelCollapsedCategory.FAVORITES,
-        icon: <FavoriteIcon />,
-        navTarget: navigateToFavorites,
-    },
-    {
-        name: SidePanelCollapsedCategory.GROUPS,
-        icon: <GroupsIcon />,
-        navTarget: navigateToGroups,
+        name: SidePanelCollapsedCategory.SHARED_WITH_ME,
+        icon: <ShareMeIcon />,
+        navTarget: navigateToSharedWithMe,
     },
     {
         name: SidePanelCollapsedCategory.ALL_PROCESSES,
         icon: <ProcessIcon />,
         navTarget: navigateToAllProcesses,
     },
+    {
+        name: SidePanelCollapsedCategory.SHELL_ACCESS,
+        icon: <TerminalIcon />,
+        navTarget: navigateToUserVirtualMachines,
+    },
+    {
+        name: SidePanelCollapsedCategory.GROUPS,
+        icon: <GroupsIcon style={{marginLeft: '2px', scale: '85%'}}/>,
+        navTarget: navigateToGroups,
+    },
     {
         name: SidePanelCollapsedCategory.TRASH,
         icon: <TrashIcon />,
@@ -84,10 +101,15 @@ const sidePanelCollapsedCategories: TCollapsedCategory[] = [
     },
 ]
 
-const mapStateToProps = (state: RootState) => {
-    return {
-        user: state.auth.user,
-    }
+const mapStateToProps = ({auth, properties }: RootState) => {
+        return {
+            user: auth.user,
+            selectedPath: properties.breadcrumbs
+                ? properties.breadcrumbs[0].label !== 'Virtual Machines'
+                ? properties.breadcrumbs[0].label
+                : SidePanelCollapsedCategory.SHELL_ACCESS
+                : SidePanelCollapsedCategory.PROJECTS,
+        }
 }
 
 const mapDispatchToProps = (dispatch: Dispatch) => {
@@ -98,26 +120,29 @@ const mapDispatchToProps = (dispatch: Dispatch) => {
 }
 
 export const SidePanelCollapsed = withStyles(styles)(
-    connect(mapStateToProps, mapDispatchToProps)(({ classes, user, navToHome, navTo }: WithStyles & any) => {
+    connect(mapStateToProps, mapDispatchToProps)(({ classes, user, selectedPath, navToHome, navTo }: WithStyles & any) => {
 
         const handleClick = (cat: TCollapsedCategory) => {
             if (cat.name === SidePanelCollapsedCategory.PROJECTS) navToHome(user.uuid)
             else navTo(cat.navTarget)
         }
 
+        const { button, unselected, selected } = classes
         return (
-            <List>
-                {sidePanelCollapsedCategories.map(cat => (
+            <List data-cy="side-panel-collapsed">
+                {sidePanelCollapsedCategories.map((cat) => (
+                    
                     <ListItem
                         key={cat.name}
-                        className={classes.icon}
+                        data-cy={`collapsed-${cat.name.toLowerCase().replace(/\s+/g, '-')}`}
                         onClick={() => handleClick(cat)}
-                    >
+                        >
                         <Tooltip
+                            className={selectedPath === cat.name ? selected : unselected}
                             title={cat.name}
                             disableFocusListener
-                        >
-                            {cat.icon}
+                            >
+                            <IconButton className={button}>{cat.icon}</IconButton>
                         </Tooltip>
                     </ListItem>
                 ))}
