|
@@ -2,7 +2,7 @@
|
2
|
2
|
|
3
|
3
|
import * as React from 'react';
|
4
|
4
|
import {Animated, FlatList, StyleSheet, View} from "react-native";
|
5
|
|
-import {Avatar, Button, Card, Divider, List, withTheme} from 'react-native-paper';
|
|
5
|
+import {Avatar, Button, Card, Divider, List, Paragraph, withTheme} from 'react-native-paper';
|
6
|
6
|
import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen";
|
7
|
7
|
import i18n from 'i18n-js';
|
8
|
8
|
import LogoutDialog from "../../components/Amicale/LogoutDialog";
|
|
@@ -10,6 +10,8 @@ import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHead
|
10
|
10
|
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
|
11
|
11
|
import {Collapsible} from "react-navigation-collapsible";
|
12
|
12
|
import {withCollapsible} from "../../utils/withCollapsible";
|
|
13
|
+import type {cardList} from "../../components/Lists/CardList/CardList";
|
|
14
|
+import CardList from "../../components/Lists/CardList/CardList";
|
13
|
15
|
|
14
|
16
|
type Props = {
|
15
|
17
|
navigation: Object,
|
|
@@ -21,6 +23,11 @@ type State = {
|
21
|
23
|
dialogVisible: boolean,
|
22
|
24
|
}
|
23
|
25
|
|
|
26
|
+const CLUBS_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Clubs.png";
|
|
27
|
+const VOTE_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Vote.png";
|
|
28
|
+
|
|
29
|
+const ICON_AMICALE = require('../../../assets/amicale.png');
|
|
30
|
+
|
24
|
31
|
class ProfileScreen extends React.Component<Props, State> {
|
25
|
32
|
|
26
|
33
|
state = {
|
|
@@ -30,6 +37,7 @@ class ProfileScreen extends React.Component<Props, State> {
|
30
|
37
|
data: Object;
|
31
|
38
|
|
32
|
39
|
flatListData: Array<Object>;
|
|
40
|
+ amicaleDataset: cardList;
|
33
|
41
|
|
34
|
42
|
constructor() {
|
35
|
43
|
super();
|
|
@@ -37,7 +45,28 @@ class ProfileScreen extends React.Component<Props, State> {
|
37
|
45
|
{id: '0'},
|
38
|
46
|
{id: '1'},
|
39
|
47
|
{id: '2'},
|
|
48
|
+ {id: '3'},
|
40
|
49
|
]
|
|
50
|
+ this.amicaleDataset = [
|
|
51
|
+ {
|
|
52
|
+ title: i18n.t('screens.clubsAbout'),
|
|
53
|
+ subtitle: i18n.t('servicesScreen.descriptions.clubs'),
|
|
54
|
+ image: CLUBS_IMAGE,
|
|
55
|
+ onPress: () => this.props.navigation.navigate("club-list"),
|
|
56
|
+ },
|
|
57
|
+ {
|
|
58
|
+ title: i18n.t('screens.vote'),
|
|
59
|
+ subtitle: i18n.t('servicesScreen.descriptions.vote'),
|
|
60
|
+ image: VOTE_IMAGE,
|
|
61
|
+ onPress: () => this.props.navigation.navigate("vote"),
|
|
62
|
+ },
|
|
63
|
+ {
|
|
64
|
+ title: i18n.t('screens.amicaleWebsite'),
|
|
65
|
+ subtitle: i18n.t('servicesScreen.descriptions.amicaleWebsite'),
|
|
66
|
+ image: ICON_AMICALE,
|
|
67
|
+ onPress: () => this.props.navigation.navigate("amicale-website"),
|
|
68
|
+ },
|
|
69
|
+ ];
|
41
|
70
|
}
|
42
|
71
|
|
43
|
72
|
componentDidMount() {
|
|
@@ -83,14 +112,61 @@ class ProfileScreen extends React.Component<Props, State> {
|
83
|
112
|
getRenderItem = ({item}: Object) => {
|
84
|
113
|
switch (item.id) {
|
85
|
114
|
case '0':
|
86
|
|
- return this.getPersonalCard();
|
|
115
|
+ return this.getWelcomeCard();
|
87
|
116
|
case '1':
|
|
117
|
+ return this.getPersonalCard();
|
|
118
|
+ case '2':
|
88
|
119
|
return this.getClubCard();
|
89
|
120
|
default:
|
90
|
121
|
return this.getMembershipCar();
|
91
|
122
|
}
|
92
|
123
|
};
|
93
|
124
|
|
|
125
|
+ getServicesList() {
|
|
126
|
+ return (
|
|
127
|
+ <CardList
|
|
128
|
+ dataset={this.amicaleDataset}
|
|
129
|
+ isHorizontal={true}
|
|
130
|
+ />
|
|
131
|
+ );
|
|
132
|
+ }
|
|
133
|
+
|
|
134
|
+ getWelcomeCard() {
|
|
135
|
+ return (
|
|
136
|
+ <Card style={styles.card}>
|
|
137
|
+ <Card.Title
|
|
138
|
+ title={i18n.t("profileScreen.welcomeTitle", {name: this.data.first_name})}
|
|
139
|
+ left={(props) => <Avatar.Image
|
|
140
|
+ size={64}
|
|
141
|
+ source={ICON_AMICALE}
|
|
142
|
+ style={{backgroundColor: 'transparent',}}
|
|
143
|
+ />}
|
|
144
|
+ titleStyle={{marginLeft: 10}}
|
|
145
|
+ />
|
|
146
|
+ <Card.Content>
|
|
147
|
+ <Divider/>
|
|
148
|
+ <Paragraph>
|
|
149
|
+ {i18n.t("profileScreen.welcomeDescription")}
|
|
150
|
+ </Paragraph>
|
|
151
|
+ {this.getServicesList()}
|
|
152
|
+ <Paragraph>
|
|
153
|
+ {i18n.t("profileScreen.welcomeFeedback")}
|
|
154
|
+ </Paragraph>
|
|
155
|
+ <Divider/>
|
|
156
|
+ <Card.Actions>
|
|
157
|
+ <Button
|
|
158
|
+ icon="bug"
|
|
159
|
+ mode="contained"
|
|
160
|
+ onPress={() => this.props.navigation.navigate('feedback')}
|
|
161
|
+ style={styles.editButton}>
|
|
162
|
+ {i18n.t("feedbackScreen.homeButtonTitle")}
|
|
163
|
+ </Button>
|
|
164
|
+ </Card.Actions>
|
|
165
|
+ </Card.Content>
|
|
166
|
+ </Card>
|
|
167
|
+ );
|
|
168
|
+ }
|
|
169
|
+
|
94
|
170
|
/**
|
95
|
171
|
* Checks if the given field is available
|
96
|
172
|
*
|