import Stack from "@mui/material/Stack"; import List from "@mui/material/List"; import Logo from "./components/logo.jsx"; import CollapseButton from "./components/collapseButton.jsx"; import Divider from "@mui/material/Divider"; import NavItem from "./components/navItem.jsx"; import AuthFooter from "./components/authFooter.jsx"; import StarPrompt from "../StarPrompt/index.jsx"; import Icon from "../Icon"; // Utils import { useTheme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; import { useSidebar } from "@/Hooks/useSidebar.js"; const URL_MAP = { support: "https://discord.com/invite/NAb6H3UTjK", discussions: "https://github.com/bluewave-labs/checkmate/discussions", docs: "https://bluewavelabs.gitbook.io/checkmate", changelog: "https://github.com/bluewave-labs/checkmate/releases", }; const getMenu = (t) => [ { name: t("menu.uptime"), path: "uptime", icon: }, { name: t("menu.pagespeed"), path: "pagespeed", icon: }, { name: t("menu.infrastructure"), path: "infrastructure", icon: }, { name: t("menu.notifications"), path: "notifications", icon: , }, { name: t("menu.checks"), path: "checks", icon: }, { name: t("menu.incidents"), path: "incidents", icon: }, { name: t("menu.statusPages"), path: "status", icon: }, { name: t("menu.maintenance"), path: "maintenance", icon: }, { name: t("menu.logs"), path: "logs", icon: }, { name: t("menu.settings"), icon: , path: "settings", }, ]; const getOtherMenuItems = (t) => [ { name: t("menu.support"), path: "support", icon: }, { name: t("menu.discussions"), path: "discussions", icon: , }, { name: t("menu.docs"), path: "docs", icon: }, { name: t("menu.changelog"), path: "changelog", icon: }, ]; const getAccountMenuItems = (t) => [ { name: t("menu.profile"), path: "account/profile", icon: }, { name: t("menu.password"), path: "account/password", icon: }, { name: t("menu.team"), path: "account/team", icon: }, ]; const Sidebar = () => { const theme = useTheme(); const { t } = useTranslation(); const navigate = useNavigate(); const { collapsed, width, transition } = useSidebar(); const menu = getMenu(t); const otherMenuItems = getOtherMenuItems(t); const accountMenuItems = getAccountMenuItems(t); return ( {menu.map((item) => { const selected = location.pathname.startsWith(`/${item.path}`); return ( navigate(`/${item.path}`)} /> ); })} {!collapsed && } {otherMenuItems.map((item) => { const selected = location.pathname.startsWith(`/${item.path}`); return ( { const url = URL_MAP[item.path]; if (url) { window.open(url, "_blank", "noreferrer"); } else { navigate(`/${item.path}`); } }} /> ); })} ); }; export default Sidebar;