forked from vergnet/application-amicale
Improved profile display and added new translations
This commit is contained in:
parent
a1f20fbf4e
commit
4ce6865b6a
4 changed files with 34 additions and 20 deletions
|
@ -49,7 +49,7 @@ class SideBar extends React.PureComponent<Props, State> {
|
||||||
icon: "home",
|
icon: "home",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "AMICALE",
|
name: i18n.t('sidenav.divider4'),
|
||||||
route: "Divider4"
|
route: "Divider4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,22 +101,10 @@ class ProfileScreen extends React.Component<Props, State> {
|
||||||
<Divider/>
|
<Divider/>
|
||||||
<List.Section>
|
<List.Section>
|
||||||
<List.Subheader>{i18n.t("profileScreen.personalInformation")}</List.Subheader>
|
<List.Subheader>{i18n.t("profileScreen.personalInformation")}</List.Subheader>
|
||||||
<List.Item
|
{this.getPersonalListItem(this.data.birthday, "cake-variant")}
|
||||||
title={this.getFieldValue(this.data.birthday)}
|
{this.getPersonalListItem(this.data.phone, "phone")}
|
||||||
left={props => <List.Icon {...props} icon="cake-variant"/>}
|
{this.getPersonalListItem(this.data.email, "email")}
|
||||||
/>
|
{this.getPersonalListItem(this.data.branch, "school")}
|
||||||
<List.Item
|
|
||||||
title={this.getFieldValue(this.data.phone)}
|
|
||||||
left={props => <List.Icon {...props} icon="phone"/>}
|
|
||||||
/>
|
|
||||||
<List.Item
|
|
||||||
title={this.getFieldValue(this.data.email)}
|
|
||||||
left={props => <List.Icon {...props} icon="email"/>}
|
|
||||||
/>
|
|
||||||
<List.Item
|
|
||||||
title={this.getFieldValue(this.data.branch)}
|
|
||||||
left={props => <List.Icon {...props} icon="school"/>}
|
|
||||||
/>
|
|
||||||
</List.Section>
|
</List.Section>
|
||||||
<Divider/>
|
<Divider/>
|
||||||
<Card.Actions>
|
<Card.Actions>
|
||||||
|
@ -208,12 +196,36 @@ class ProfileScreen extends React.Component<Props, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFieldAvailable(field: ?string) {
|
||||||
|
return field !== null;
|
||||||
|
}
|
||||||
|
|
||||||
getFieldValue(field: ?string) {
|
getFieldValue(field: ?string) {
|
||||||
return field !== null
|
return this.isFieldAvailable(field)
|
||||||
? field
|
? field
|
||||||
: i18n.t("profileScreen.noData");
|
: i18n.t("profileScreen.noData");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFieldColor(field: ?string) {
|
||||||
|
return this.isFieldAvailable(field)
|
||||||
|
? this.colors.text
|
||||||
|
: this.colors.textDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPersonalListItem(field: ?string, icon: string) {
|
||||||
|
return (
|
||||||
|
<List.Item
|
||||||
|
title={this.getFieldValue(field)}
|
||||||
|
left={props => <List.Icon
|
||||||
|
{...props}
|
||||||
|
icon={icon}
|
||||||
|
color={this.getFieldColor(field)}
|
||||||
|
/>}
|
||||||
|
titleStyle={{color: this.getFieldColor(field)}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<AuthenticatedScreen
|
<AuthenticatedScreen
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
"sidenav": {
|
"sidenav": {
|
||||||
"divider1": "Student websites",
|
"divider1": "Student websites",
|
||||||
"divider2": "Services",
|
"divider2": "Services",
|
||||||
"divider3": "Personalisation"
|
"divider3": "Personalisation",
|
||||||
|
"divider4": "Amicale"
|
||||||
},
|
},
|
||||||
"intro": {
|
"intro": {
|
||||||
"slide1": {
|
"slide1": {
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
"sidenav": {
|
"sidenav": {
|
||||||
"divider1": "Sites étudiants",
|
"divider1": "Sites étudiants",
|
||||||
"divider2": "Services",
|
"divider2": "Services",
|
||||||
"divider3": "Personnalisation"
|
"divider3": "Personnalisation",
|
||||||
|
"divider4": "Amicale"
|
||||||
},
|
},
|
||||||
"intro": {
|
"intro": {
|
||||||
"slide1": {
|
"slide1": {
|
||||||
|
|
Loading…
Reference in a new issue