From 74382f26b7255496ef512dc563c57e8a9c5daf36 Mon Sep 17 00:00:00 2001
From: Philipp Czora
Date: Wed, 7 Nov 2018 12:55:09 +0100
Subject: [PATCH] Moved Profile component to top level; added error message
---
scm-ui/public/locales/en/commons.json | 9 ++++++
scm-ui/src/containers/Main.js | 2 +-
scm-ui/src/{users => }/containers/Profile.js | 34 ++++++++++++--------
3 files changed, 31 insertions(+), 14 deletions(-)
rename scm-ui/src/{users => }/containers/Profile.js (64%)
diff --git a/scm-ui/public/locales/en/commons.json b/scm-ui/public/locales/en/commons.json
index b1bad56993..05e9f79d16 100644
--- a/scm-ui/public/locales/en/commons.json
+++ b/scm-ui/public/locales/en/commons.json
@@ -38,5 +38,14 @@
"paginator": {
"next": "Next",
"previous": "Previous"
+ },
+ "profile": {
+ "actions-label": "Actions",
+ "username": "Username",
+ "displayName": "Display Name",
+ "mail": "E-Mail",
+ "change-password": "Change password",
+ "error-title": "Error",
+ "error-subtitle": "Cannot display profile"
}
}
diff --git a/scm-ui/src/containers/Main.js b/scm-ui/src/containers/Main.js
index 97ffa60125..05e3819c8a 100644
--- a/scm-ui/src/containers/Main.js
+++ b/scm-ui/src/containers/Main.js
@@ -19,7 +19,7 @@ import SingleGroup from "../groups/containers/SingleGroup";
import AddGroup from "../groups/containers/AddGroup";
import Config from "../config/containers/Config";
-import Profile from "../users/containers/Profile";
+import Profile from "./Profile";
type Props = {
authenticated?: boolean
diff --git a/scm-ui/src/users/containers/Profile.js b/scm-ui/src/containers/Profile.js
similarity index 64%
rename from scm-ui/src/users/containers/Profile.js
rename to scm-ui/src/containers/Profile.js
index b8aa3ae068..adb1ba5d6c 100644
--- a/scm-ui/src/users/containers/Profile.js
+++ b/scm-ui/src/containers/Profile.js
@@ -7,14 +7,15 @@ import {
Navigation,
Section,
MailLink
-} from "@scm-manager/ui-components";
+} from "../../../scm-ui-components/packages/ui-components/src/index";
import { NavLink } from "react-router-dom";
-import { getMe } from "../../modules/auth";
+import { getMe } from "../modules/auth";
import { compose } from "redux";
import { connect } from "react-redux";
import { translate } from "react-i18next";
-import type { Me } from "@scm-manager/ui-types";
-import AvatarWrapper from "../../repos/components/changesets/AvatarWrapper";
+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";
type Props = {
me: Me,
@@ -28,8 +29,14 @@ class Profile extends React.Component {
render() {
const { me, t } = this.props;
- if (!me) {
- return null;
+ if (me) {
+ return (
+
+ );
}
return (
@@ -41,7 +48,6 @@ class Profile extends React.Component {
{
// TODO: add avatar
}
- }
@@ -50,15 +56,15 @@ class Profile extends React.Component {
- | {t("user.name")} |
+ {t("profile.username")} |
{me.name} |
- | {t("user.displayName")} |
+ {t("profile.displayName")} |
{me.displayName} |
- | {t("user.mail")} |
+ {t("profile.mail")} |
|
@@ -68,8 +74,10 @@ class Profile extends React.Component {
-
- {t("profile.change-pw")}
+
+
+ {t("profile.change-password")}
+
@@ -85,6 +93,6 @@ const mapStateToProps = state => {
};
export default compose(
- translate("users"),
+ translate("commons"),
connect(mapStateToProps)
)(Profile);