Files
SCM-Manager/scm-ui/src/groups/components/navLinks/GeneralGroupNavLink.js

30 lines
667 B
JavaScript
Raw Normal View History

2018-08-02 09:29:28 +02:00
//@flow
2018-08-31 10:47:42 +02:00
import React from "react";
import { NavLink } from "@scm-manager/ui-components";
2018-08-02 09:29:28 +02:00
import { translate } from "react-i18next";
import type { Group } from "@scm-manager/ui-types";
2018-08-02 09:29:28 +02:00
type Props = {
t: string => string,
editUrl: string,
group: Group
};
2018-08-02 09:29:28 +02:00
type State = {};
2018-08-02 09:29:28 +02:00
class GeneralGroupNavLink extends React.Component<Props, State> {
2018-08-02 09:29:28 +02:00
render() {
const { t, editUrl } = this.props;
if (!this.isEditable()) {
return null;
}
return <NavLink label={t("singleGroup.menu.editNavLink")} to={editUrl} />;
2018-08-02 09:29:28 +02:00
}
isEditable = () => {
return this.props.group._links.update;
};
2018-08-02 09:29:28 +02:00
}
export default translate("groups")(GeneralGroupNavLink);