diff --git a/scm-ui/src/containers/Profile.js b/scm-ui/src/containers/Profile.js index 5d9902f309..eaa912a4f3 100644 --- a/scm-ui/src/containers/Profile.js +++ b/scm-ui/src/containers/Profile.js @@ -5,16 +5,14 @@ import React from "react"; import { Page, Navigation, - Section, - MailLink + Section } from "../../../scm-ui-components/packages/ui-components/src/index"; -import { NavLink, Route } from "react-router-dom"; +import { NavLink, Route, withRouter } from "react-router-dom"; import { getMe } from "../modules/auth"; import { compose } from "redux"; import { connect } from "react-redux"; import { translate } from "react-i18next"; import type { Me } from "../../../scm-ui-components/packages/ui-types/src/index"; -import AvatarWrapper from "../repos/components/changesets/AvatarWrapper"; import { ErrorPage } from "@scm-manager/ui-components"; import ChangeUserPassword from "./ChangeUserPassword"; import ProfileInfo from "./ProfileInfo"; @@ -23,12 +21,26 @@ type Props = { me: Me, // Context props - t: string => string + t: string => string, + match: any }; type State = {}; class Profile extends React.Component { + stripEndingSlash = (url: string) => { + if (url.endsWith("/")) { + return url.substring(0, url.length - 2); + } + return url; + }; + + matchedUrl = () => { + return this.stripEndingSlash(this.props.match.url); + }; + render() { + const url = this.matchedUrl(); + const { me, t } = this.props; if (!me) { @@ -43,8 +55,24 @@ class Profile extends React.Component { return ( - } /> - +
+
+ } /> + +
+
+ +
+ + {t("profile.change-password")} + + +
+
); } @@ -58,5 +86,6 @@ const mapStateToProps = state => { export default compose( translate("commons"), - connect(mapStateToProps) + connect(mapStateToProps), + withRouter )(Profile); diff --git a/scm-ui/src/containers/ProfileInfo.js b/scm-ui/src/containers/ProfileInfo.js index bd93495ddd..5d350d8619 100644 --- a/scm-ui/src/containers/ProfileInfo.js +++ b/scm-ui/src/containers/ProfileInfo.js @@ -1,9 +1,8 @@ // @flow import React from "react"; import AvatarWrapper from "../repos/components/changesets/AvatarWrapper"; -import { NavLink } from "react-router-dom"; import type { Me } from "@scm-manager/ui-types"; -import { MailLink, Navigation, Section } from "@scm-manager/ui-components"; +import { MailLink } from "@scm-manager/ui-components"; import { compose } from "redux"; import { translate } from "react-i18next"; @@ -19,7 +18,7 @@ class ProfileInfo extends React.Component { render() { const { me, t } = this.props; return ( -
+ <>
@@ -31,33 +30,25 @@ class ProfileInfo extends React.Component {
-
- - - - - - - - - - - - - - - -
{t("profile.username")}{me.name}
{t("profile.displayName")}{me.displayName}
{t("profile.mail")} - -
-
-
- -
- {t("profile.change-password")} - -
-
+ + + + + + + + + + + + + + + +
{t("profile.username")}{me.name}
{t("profile.displayName")}{me.displayName}
{t("profile.mail")} + +
+ ); } }