2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
|
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
import { Group } from "@scm-manager/ui-types";
|
|
|
|
|
import { Icon } from "@scm-manager/ui-components";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
group: Group;
|
|
|
|
|
|
|
|
|
|
// context props
|
|
|
|
|
t: (p: string) => string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class GroupRow extends React.Component<Props> {
|
|
|
|
|
renderLink(to: string, label: string) {
|
|
|
|
|
return <Link to={to}>{label}</Link>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { group, t } = this.props;
|
|
|
|
|
const to = `/group/${group.name}`;
|
|
|
|
|
const iconType = group.external ? (
|
2019-10-20 18:02:52 +02:00
|
|
|
<Icon title={t("group.external")} name="sign-out-alt fa-rotate-270" />
|
2019-10-19 16:38:07 +02:00
|
|
|
) : (
|
2019-10-20 18:02:52 +02:00
|
|
|
<Icon title={t("group.internal")} name="sign-in-alt fa-rotate-90" />
|
2019-10-19 16:38:07 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
|
|
|
|
{iconType} {this.renderLink(to, group.name)}
|
|
|
|
|
</td>
|
|
|
|
|
<td className="is-hidden-mobile">{group.description}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
export default translate("groups")(GroupRow);
|