From d8d393cdf648475a4d5791f919ff60382e31b5f0 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:14:07 +0100 Subject: [PATCH] Update deprecated resource definitions (#331) --- src/components/Menu.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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 (