diff --git a/src/components/Menu.js b/src/components/Menu.js index 69b0a30..f65ac3a 100644 --- a/src/components/Menu.js +++ b/src/components/Menu.js @@ -1,15 +1,20 @@ // in src/Menu.js import * as React from "react"; -import { useSelector } from "react-redux"; import { useMediaQuery } from "@mui/material"; -import { MenuItemLink, getResources } from "react-admin"; +import { + MenuItemLink, + useResourceDefinitions, + useSidebarState, +} from "react-admin"; import DefaultIcon from "@mui/icons-material/ViewList"; -import LabelIcon from "@mui/icons-material/Label"; const Menu = ({ onMenuClick, logout }) => { const isXSmall = useMediaQuery(theme => theme.breakpoints.down("xs")); - const open = useSelector(state => state.admin.ui.sidebarOpen); - const resources = useSelector(getResources); + const [open] = useSidebarState(); + const resourcesDefinitions = useResourceDefinitions(); + const resources = Object.keys(resourcesDefinitions).map( + name => resourcesDefinitions[name] + ); return (