Commit fbbee187 authored by Christos Tranoris's avatar Christos Tranoris
Browse files

sidebar now shows a primary-colored left border on the current pag

parent 46514472
Loading
Loading
Loading
Loading
+20 −4
Changes for src/features/shell/Shell.tsx: 20 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ import Toolbar from '@mui/material/Toolbar';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
import { useColorScheme } from '@mui/material/styles';
import { Link } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import AssignmentIcon from '@mui/icons-material/Assignment';
import BarChartIcon from '@mui/icons-material/BarChart';
import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
@@ -62,6 +62,7 @@ export function Shell() {
  const { state, logout } = useAuth();
  const caps = useCapabilities();
  const { mode, setMode } = useColorScheme();
  const { pathname } = useLocation();
  const { data: flags } = useFlags();

  const unresolvedCount = caps.canManagePools
@@ -134,13 +135,27 @@ export function Shell() {
        <Divider />

        <List dense disablePadding>
          {navItems.filter(item => item.show).map(({ label, to, icon, badge }) => (
          {navItems.filter(item => item.show).map(({ label, to, icon, badge }) => {
            const isActive = pathname === to || pathname.startsWith(to + '/');
            return (
            <Tooltip key={label} title={drawerOpen ? '' : label} placement="right">
              <ListItemButton
                component={Link}
                to={to}
                selected={isActive}
                aria-label={label}
                sx={{ px: 2, py: 1 }}
                aria-current={isActive ? 'page' : undefined}
                sx={{
                  px: 2,
                  py: 1,
                  borderLeft: '3px solid transparent',
                  '&.Mui-selected': {
                    borderLeftColor: 'primary.main',
                    pl: '13px',
                    '& .MuiListItemIcon-root': { color: 'primary.main' },
                    '& .MuiListItemText-primary': { fontWeight: 600 },
                  },
                }}
              >
                <ListItemIcon sx={{ minWidth: 40 }}>
                  {badge ? (
@@ -165,7 +180,8 @@ export function Shell() {
                />
              </ListItemButton>
            </Tooltip>
          ))}
            );
          })}
        </List>
      </Drawer>