mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
31 lines
736 B
TypeScript
31 lines
736 B
TypeScript
import React from "react";
|
|
import { NavLink } from "@scm-manager/ui-components";
|
|
import { translate } from "react-i18next";
|
|
import { Repository } from "@scm-manager/ui-types";
|
|
|
|
type Props = {
|
|
permissionUrl: string;
|
|
t: (p: string) => string;
|
|
repository: Repository;
|
|
};
|
|
|
|
class PermissionsNavLink extends React.Component<Props> {
|
|
hasPermissionsLink = () => {
|
|
return this.props.repository._links.permissions;
|
|
};
|
|
render() {
|
|
if (!this.hasPermissionsLink()) {
|
|
return null;
|
|
}
|
|
const { permissionUrl, t } = this.props;
|
|
return (
|
|
<NavLink
|
|
to={permissionUrl}
|
|
label={t("repositoryRoot.menu.permissionsNavLink")}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default translate("repos")(PermissionsNavLink);
|