From 4ce6865b6a313a71f72d39e9d0948f8ef127b731 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Wed, 1 Apr 2020 14:48:11 +0200 Subject: [PATCH] Improved profile display and added new translations --- components/Sidebar.js | 2 +- screens/Amicale/ProfileScreen.js | 46 ++++++++++++++++++++------------ translations/en.json | 3 ++- translations/fr.json | 3 ++- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/components/Sidebar.js b/components/Sidebar.js index 98990dd..6e6d0af 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -49,7 +49,7 @@ class SideBar extends React.PureComponent { icon: "home", }, { - name: "AMICALE", + name: i18n.t('sidenav.divider4'), route: "Divider4" }, { diff --git a/screens/Amicale/ProfileScreen.js b/screens/Amicale/ProfileScreen.js index 3defbb8..5d69db4 100644 --- a/screens/Amicale/ProfileScreen.js +++ b/screens/Amicale/ProfileScreen.js @@ -101,22 +101,10 @@ class ProfileScreen extends React.Component { {i18n.t("profileScreen.personalInformation")} - } - /> - } - /> - } - /> - } - /> + {this.getPersonalListItem(this.data.birthday, "cake-variant")} + {this.getPersonalListItem(this.data.phone, "phone")} + {this.getPersonalListItem(this.data.email, "email")} + {this.getPersonalListItem(this.data.branch, "school")} @@ -208,12 +196,36 @@ class ProfileScreen extends React.Component { ); } + isFieldAvailable(field: ?string) { + return field !== null; + } + getFieldValue(field: ?string) { - return field !== null + return this.isFieldAvailable(field) ? field : i18n.t("profileScreen.noData"); } + getFieldColor(field: ?string) { + return this.isFieldAvailable(field) + ? this.colors.text + : this.colors.textDisabled; + } + + getPersonalListItem(field: ?string, icon: string) { + return ( + } + titleStyle={{color: this.getFieldColor(field)}} + /> + ); + } + render() { return (