mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-09 16:24:51 +00:00
Update deprecated resource definitions (#331)
This commit is contained in:
parent
58e02d6dff
commit
d8d393cdf6
1 changed files with 10 additions and 12 deletions
|
@ -1,15 +1,20 @@
|
||||||
// in src/Menu.js
|
// in src/Menu.js
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import { useMediaQuery } from "@mui/material";
|
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 DefaultIcon from "@mui/icons-material/ViewList";
|
||||||
import LabelIcon from "@mui/icons-material/Label";
|
|
||||||
|
|
||||||
const Menu = ({ onMenuClick, logout }) => {
|
const Menu = ({ onMenuClick, logout }) => {
|
||||||
const isXSmall = useMediaQuery(theme => theme.breakpoints.down("xs"));
|
const isXSmall = useMediaQuery(theme => theme.breakpoints.down("xs"));
|
||||||
const open = useSelector(state => state.admin.ui.sidebarOpen);
|
const [open] = useSidebarState();
|
||||||
const resources = useSelector(getResources);
|
const resourcesDefinitions = useResourceDefinitions();
|
||||||
|
const resources = Object.keys(resourcesDefinitions).map(
|
||||||
|
name => resourcesDefinitions[name]
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{resources.map(resource => (
|
{resources.map(resource => (
|
||||||
|
@ -24,13 +29,6 @@ const Menu = ({ onMenuClick, logout }) => {
|
||||||
sidebarIsOpen={open}
|
sidebarIsOpen={open}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<MenuItemLink
|
|
||||||
to="/custom-route"
|
|
||||||
primaryText="Miscellaneous"
|
|
||||||
leftIcon={<LabelIcon />}
|
|
||||||
onClick={onMenuClick}
|
|
||||||
sidebarIsOpen={open}
|
|
||||||
/>
|
|
||||||
{isXSmall && logout}
|
{isXSmall && logout}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue