2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
2019-10-23 15:47:08 +02:00
|
|
|
import { WithTranslation, withTranslation } from "react-i18next";
|
2019-10-20 18:02:52 +02:00
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
import { User } from "@scm-manager/ui-types";
|
|
|
|
|
import { Icon } from "@scm-manager/ui-components";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
type Props = WithTranslation & {
|
2019-10-19 16:38:07 +02:00
|
|
|
user: User;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class UserRow extends React.Component<Props> {
|
|
|
|
|
renderLink(to: string, label: string) {
|
|
|
|
|
return <Link to={to}>{label}</Link>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { user, t } = this.props;
|
|
|
|
|
const to = `/user/${user.name}`;
|
|
|
|
|
const iconType = user.active ? (
|
2019-10-20 18:02:52 +02:00
|
|
|
<Icon title={t("user.active")} name="user" />
|
2019-10-19 16:38:07 +02:00
|
|
|
) : (
|
2019-10-20 18:02:52 +02:00
|
|
|
<Icon title={t("user.inactive")} name="user-slash" />
|
2019-10-19 16:38:07 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
2019-10-20 18:02:52 +02:00
|
|
|
<tr className={user.active ? "border-is-green" : "border-is-yellow"}>
|
2019-10-19 16:38:07 +02:00
|
|
|
<td>
|
|
|
|
|
{iconType} {this.renderLink(to, user.name)}
|
|
|
|
|
</td>
|
2019-10-21 10:57:56 +02:00
|
|
|
<td className="is-hidden-mobile">{this.renderLink(to, user.displayName)}</td>
|
2019-10-19 16:38:07 +02:00
|
|
|
<td>
|
|
|
|
|
<a href={`mailto:${user.mail}`}>{user.mail}</a>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
export default withTranslation("users")(UserRow);
|