Update deprecated resource definitions (#331)
This commit is contained in:
parent
58e02d6dff
commit
d8d393cdf6
@ -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 (
|
||||
<div>
|
||||
{resources.map(resource => (
|
||||
@ -24,13 +29,6 @@ const Menu = ({ onMenuClick, logout }) => {
|
||||
sidebarIsOpen={open}
|
||||
/>
|
||||
))}
|
||||
<MenuItemLink
|
||||
to="/custom-route"
|
||||
primaryText="Miscellaneous"
|
||||
leftIcon={<LabelIcon />}
|
||||
onClick={onMenuClick}
|
||||
sidebarIsOpen={open}
|
||||
/>
|
||||
{isXSmall && logout}
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user