migrate Avatarf in users.js
This commit is contained in:
parent
6f5d2f8c3c
commit
e5db544157
@ -7,7 +7,7 @@ import DefaultIcon from "@mui/icons-material/ViewList";
|
|||||||
import LabelIcon from "@mui/icons-material/Label";
|
import LabelIcon from "@mui/icons-material/Label";
|
||||||
|
|
||||||
const Menu = ({ onMenuClick, logout }) => {
|
const Menu = ({ onMenuClick, logout }) => {
|
||||||
const isXSmall = useMediaQuery(theme => theme.breakpoints.down('sm'));
|
const isXSmall = useMediaQuery(theme => theme.breakpoints.down("sm"));
|
||||||
const open = useSelector(state => state.admin.ui.sidebarOpen);
|
const open = useSelector(state => state.admin.ui.sidebarOpen);
|
||||||
const resources = useSelector(getResources);
|
const resources = useSelector(getResources);
|
||||||
return (
|
return (
|
||||||
|
@ -52,7 +52,6 @@ import { Link } from "react-router-dom";
|
|||||||
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
||||||
import { DeviceRemoveButton } from "./devices";
|
import { DeviceRemoveButton } from "./devices";
|
||||||
import { ProtectMediaButton, QuarantineMediaButton } from "./media";
|
import { ProtectMediaButton, QuarantineMediaButton } from "./media";
|
||||||
import { makeStyles } from "@mui/styles";
|
|
||||||
|
|
||||||
const redirect = () => {
|
const redirect = () => {
|
||||||
return {
|
return {
|
||||||
@ -60,18 +59,6 @@ const redirect = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
small: {
|
|
||||||
height: "40px",
|
|
||||||
width: "40px",
|
|
||||||
},
|
|
||||||
large: {
|
|
||||||
height: "120px",
|
|
||||||
width: "120px",
|
|
||||||
float: "right",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const choices_medium = [
|
const choices_medium = [
|
||||||
{ id: "email", name: "resources.users.email" },
|
{ id: "email", name: "resources.users.email" },
|
||||||
{ id: "msisdn", name: "resources.users.msisdn" },
|
{ id: "msisdn", name: "resources.users.msisdn" },
|
||||||
@ -169,12 +156,11 @@ const UserBulkActionButtons = props => (
|
|||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
||||||
const AvatarField = ({ source, className, record = {} }) => (
|
const AvatarField = ({ source, record, sx }) => (
|
||||||
<Avatar src={record[source]} className={className} />
|
<Avatar src={record[source]} sx={sx} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const UserList = props => {
|
export const UserList = props => {
|
||||||
const classes = useStyles();
|
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
@ -188,7 +174,7 @@ export const UserList = props => {
|
|||||||
<Datagrid rowClick="edit">
|
<Datagrid rowClick="edit">
|
||||||
<AvatarField
|
<AvatarField
|
||||||
source="avatar_src"
|
source="avatar_src"
|
||||||
className={classes.small}
|
sx={{ height: "40", width: "40" }}
|
||||||
sortBy="avatar_url"
|
sortBy="avatar_url"
|
||||||
/>
|
/>
|
||||||
<TextField source="id" sortBy="name" />
|
<TextField source="id" sortBy="name" />
|
||||||
@ -344,7 +330,6 @@ const UserTitle = props => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const UserEdit = props => {
|
export const UserEdit = props => {
|
||||||
const classes = useStyles();
|
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
|
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
|
||||||
@ -356,7 +341,7 @@ export const UserEdit = props => {
|
|||||||
<AvatarField
|
<AvatarField
|
||||||
source="avatar_src"
|
source="avatar_src"
|
||||||
sortable={false}
|
sortable={false}
|
||||||
className={classes.large}
|
sx={{ height: "120", width: "120", float: "right" }}
|
||||||
/>
|
/>
|
||||||
<TextInput source="id" disabled />
|
<TextInput source="id" disabled />
|
||||||
<TextInput source="displayname" />
|
<TextInput source="displayname" />
|
||||||
|
Loading…
Reference in New Issue
Block a user