import React, { useState } from "react";
import { Link, Outlet, useLocation } from "react-router-dom";
import {
AppBar,
Box,
Drawer,
IconButton,
List,
ListItem,
ListItemIcon,
ListItemText,
Toolbar,
Typography,
Tooltip,
Badge,
Chip,
} from "@mui/material";
import MenuIcon from "@mui/icons-material/Menu";
import CloudIcon from "@mui/icons-material/Cloud";
import HomeIcon from "@mui/icons-material/Home";
import AssignmentIcon from "@mui/icons-material/Assignment";
import WorkspacesIcon from "@mui/icons-material/Workspaces";
// use relative path to load Logo
import volcanoLogo from "../assets/volcano-icon-color.svg";
const Layout = () => {
// Hooks must be used inside component functions
const location = useLocation();
const [open, setOpen] = useState(true);
// constants can be kept outside the component
const volcanoOrange = "#E34C26"; // orange red theme
const headerGrey = "#424242"; // dark gray top stripe
const drawerWidth = 240;
const handleDrawerToggle = () => {
setOpen(!open);
};
const menuItems = [
{ text: "Dashboard", icon: , path: "/dashboard" },
{ text: "Jobs", icon: , path: "/jobs" },
{ text: "Queues", icon: , path: "/queues" },
{ text: "Pods", icon: , path: "/pods" },
];
return (
theme.zIndex.drawer + 1,
bgcolor: headerGrey,
boxShadow: "0 2px 8px rgba(0,0,0,0.1)", // Enhanced shadow
}}
>
{/* Enhanced Logo Section */}
Volcano Dashboard
{/* Enhanced Navigation Header */}
{open && (
NAVIGATION
)}
{menuItems.map((item) => {
const isActive = location.pathname === item.path;
const listItem = (
{item.icon}
{open && (
)}
{/* Active indicator line */}
{isActive && (
)}
);
return !open ? (
{listItem}
) : (
{listItem}
);
})}
{/* Enhanced Logo section */}
{open && (
)}
);
};
export default Layout;