2018-07-26 09:49:44 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
2018-09-05 14:32:49 +02:00
|
|
|
import type { User } from "@scm-manager/ui-types";
|
|
|
|
|
import { NavLink } from "@scm-manager/ui-components";
|
2018-07-26 09:49:44 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
t: string => string,
|
2018-07-30 13:38:15 +02:00
|
|
|
user: User,
|
2018-07-26 09:49:44 +02:00
|
|
|
editUrl: String
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class EditUserNavLink extends React.Component<Props> {
|
|
|
|
|
render() {
|
|
|
|
|
const { t, editUrl } = this.props;
|
|
|
|
|
|
|
|
|
|
if (!this.isEditable()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return <NavLink label={t("edit-user-button.label")} to={editUrl} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isEditable = () => {
|
|
|
|
|
return this.props.user._links.update;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("users")(EditUserNavLink);
|