diff --git a/scm-ui/ui-components/src/repos/CommitAuthor.tsx b/scm-ui/ui-components/src/repos/CommitAuthor.tsx index e371069ad3..f845582267 100644 --- a/scm-ui/ui-components/src/repos/CommitAuthor.tsx +++ b/scm-ui/ui-components/src/repos/CommitAuthor.tsx @@ -22,34 +22,31 @@ * SOFTWARE. */ -import React from "react"; -import { WithTranslation, withTranslation } from "react-i18next"; +import React, { FC } from "react"; +import { useTranslation } from "react-i18next"; import Notification from "../Notification"; import { Me } from "@scm-manager/ui-types"; import { connect } from "react-redux"; -import { compose } from "redux"; -type Props = WithTranslation & { +type Props = { // props from global state me: Me; }; -class CommitAuthor extends React.Component { - render() { - const { me, t } = this.props; +const CommitAuthor: FC = ({ me }) => { + const [t] = useTranslation("repos"); - const mail = me.mail ? me.mail : me.fallbackMail; + const mail = me.mail ? me.mail : me.fallbackMail; - return ( - <> - {!me.mail && {t("commit.commitAuthor.noMail")}} - - {t("commit.commitAuthor.author")} {`${me.displayName} <${mail}>`} - - - ); - } -} + return ( + <> + {!me.mail && {t("commit.commitAuthor.noMail")}} + + {t("commit.commitAuthor.author")} {`${me.displayName} <${mail}>`} + + + ); +}; const mapStateToProps = (state: any) => { const { auth } = state; @@ -60,4 +57,4 @@ const mapStateToProps = (state: any) => { }; }; -export default compose(connect(mapStateToProps), withTranslation("repos"))(CommitAuthor); +export default connect(mapStateToProps)(CommitAuthor);