mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-26 00:03:17 +00:00
Create UserEditActions
on user page (#222)
* Create `UserEditActions` on user page * Fix crash with crashes `undefined`
This commit is contained in:
parent
e787b0a940
commit
e23e9ccd82
1 changed files with 17 additions and 6 deletions
|
@ -259,20 +259,31 @@ export function generateRandomUser() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserEditToolbar = props => {
|
const UserEditToolbar = props => (
|
||||||
const translate = useTranslate();
|
|
||||||
return (
|
|
||||||
<Toolbar {...props}>
|
<Toolbar {...props}>
|
||||||
<SaveButton submitOnEnter={true} disabled={props.pristine} />
|
<SaveButton submitOnEnter={true} disabled={props.pristine} />
|
||||||
|
</Toolbar>
|
||||||
|
);
|
||||||
|
|
||||||
|
const UserEditActions = ({ data }) => {
|
||||||
|
const translate = useTranslate();
|
||||||
|
var userStatus = "";
|
||||||
|
if (data) {
|
||||||
|
userStatus = data.deactivated;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TopToolbar>
|
||||||
|
{!userStatus && <ServerNoticeButton record={data} />}
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
|
record={data}
|
||||||
label="resources.users.action.erase"
|
label="resources.users.action.erase"
|
||||||
confirmTitle={translate("resources.users.helper.erase", {
|
confirmTitle={translate("resources.users.helper.erase", {
|
||||||
smart_count: 1,
|
smart_count: 1,
|
||||||
})}
|
})}
|
||||||
mutationMode="pessimistic"
|
mutationMode="pessimistic"
|
||||||
/>
|
/>
|
||||||
<ServerNoticeButton />
|
</TopToolbar>
|
||||||
</Toolbar>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -334,7 +345,7 @@ export const UserEdit = props => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Edit {...props} title={<UserTitle />}>
|
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
|
||||||
<TabbedForm toolbar={<UserEditToolbar />}>
|
<TabbedForm toolbar={<UserEditToolbar />}>
|
||||||
<FormTab
|
<FormTab
|
||||||
label={translate("resources.users.name", { smart_count: 1 })}
|
label={translate("resources.users.name", { smart_count: 1 })}
|
||||||
|
|
Loading…
Reference in a new issue