Browse Source

Allow clicking on a club in profile screen to show its information

Arnaud Vergnet 4 years ago
parent
commit
2e4fa20895

+ 12
- 2
src/navigation/DrawerNavigator.js View File

236
                     };
236
                     };
237
                 }}
237
                 }}
238
             />
238
             />
239
+            <ClubStack.Screen
240
+                name="club-information"
241
+                component={ClubDisplayScreen}
242
+                options={({navigation}) => {
243
+                    return {
244
+                        title: i18n.t('screens.clubDisplayScreen'),
245
+                        ...TransitionPresets.ModalSlideFromBottomIOS,
246
+                    };
247
+                }}
248
+            />
239
         </ProfileStack.Navigator>
249
         </ProfileStack.Navigator>
240
     );
250
     );
241
 }
251
 }
290
                 component={ClubDisplayScreen}
300
                 component={ClubDisplayScreen}
291
                 options={({navigation}) => {
301
                 options={({navigation}) => {
292
                     return {
302
                     return {
293
-                        title: "",
303
+                        title: i18n.t('screens.clubDisplayScreen'),
294
                         ...TransitionPresets.ModalSlideFromBottomIOS,
304
                         ...TransitionPresets.ModalSlideFromBottomIOS,
295
                     };
305
                     };
296
                 }}
306
                 }}
300
                 component={ClubAboutScreen}
310
                 component={ClubAboutScreen}
301
                 options={({navigation}) => {
311
                 options={({navigation}) => {
302
                     return {
312
                     return {
303
-                        title: "ABOUT",
313
+                        title: i18n.t('screens.about'),
304
                         ...TransitionPresets.ModalSlideFromBottomIOS,
314
                         ...TransitionPresets.ModalSlideFromBottomIOS,
305
                     };
315
                     };
306
                 }}
316
                 }}

+ 1
- 0
src/screens/Amicale/Clubs/ClubDisplayScreen.js View File

135
     getScreen = (data: Object) => {
135
     getScreen = (data: Object) => {
136
         console.log('fetchedData passed to screen:');
136
         console.log('fetchedData passed to screen:');
137
         console.log(data);
137
         console.log(data);
138
+        console.log("Using fake data");
138
         data = FakeClub;
139
         data = FakeClub;
139
         this.updateHeaderTitle(data);
140
         this.updateHeaderTitle(data);
140
 
141
 

+ 27
- 8
src/screens/Amicale/ProfileScreen.js View File

79
                 return this.getPersonalCard();
79
                 return this.getPersonalCard();
80
             case '1':
80
             case '1':
81
                 return this.getClubCard();
81
                 return this.getClubCard();
82
-            case '2':
82
+            default:
83
                 return this.getMembershipCar();
83
                 return this.getMembershipCar();
84
         }
84
         }
85
     };
85
     };
164
         );
164
         );
165
     }
165
     }
166
 
166
 
167
+    openClubDetailsScreen(id: number) {
168
+        this.props.navigation.navigate("club-information", {clubId: id});
169
+    }
170
+
171
+    clubListItem = ({item}: Object) => {
172
+        const onPress = () => this.openClubDetailsScreen(0); // TODO get club id
173
+        const isManager = false; // TODO detect if manager
174
+        let description = i18n.t("profileScreen.isMember");
175
+        let icon = (props) => <List.Icon {...props} icon="chevron-right"/>;
176
+        if (isManager) {
177
+            description = i18n.t("profileScreen.isManager");
178
+            icon = (props) => <List.Icon {...props} icon="star" color={this.colors.primary}/>;
179
+        }
180
+        return <List.Item
181
+            title={item.name}
182
+            description={description}
183
+            left={icon}
184
+            onPress={onPress}
185
+        />;
186
+    };
187
+
188
+    clubKeyExtractor = (item: Object) => item.name;
189
+
167
     getClubList(list: Array<string>) {
190
     getClubList(list: Array<string>) {
168
         let dataset = [];
191
         let dataset = [];
169
         for (let i = 0; i < list.length; i++) {
192
         for (let i = 0; i < list.length; i++) {
170
             dataset.push({name: list[i]});
193
             dataset.push({name: list[i]});
171
         }
194
         }
172
         return (
195
         return (
196
+            //$FlowFixMe
173
             <FlatList
197
             <FlatList
174
-                renderItem={({item}) =>
175
-                    <List.Item
176
-                        title={item.name}
177
-                        left={props => <List.Icon {...props} icon="chevron-right"/>}
178
-                    />
179
-                }
180
-                keyExtractor={item => item.name}
198
+                renderItem={this.clubListItem}
199
+                keyExtractor={this.clubKeyExtractor}
181
                 data={dataset}
200
                 data={dataset}
182
             />
201
             />
183
         );
202
         );

+ 4
- 2
translations/en.json View File

220
     "personalInformation": "Personal information",
220
     "personalInformation": "Personal information",
221
     "noData": "No data",
221
     "noData": "No data",
222
     "editInformation": "Edit Information",
222
     "editInformation": "Edit Information",
223
-    "clubs": "Clubs",
224
-    "clubsSubtitle": "Clubs you are part of",
223
+    "clubs": "Your clubs",
224
+    "clubsSubtitle": "Click on a club to show its information",
225
+    "isMember": "Member",
226
+    "isManager": "Manager",
225
     "membership": "Membership Fee",
227
     "membership": "Membership Fee",
226
     "membershipSubtitle": "Allows you to take part in various activities",
228
     "membershipSubtitle": "Allows you to take part in various activities",
227
     "membershipPayed": "Payed",
229
     "membershipPayed": "Payed",

+ 4
- 2
translations/fr.json View File

220
     "personalInformation": "Informations Personnelles",
220
     "personalInformation": "Informations Personnelles",
221
     "noData": "Pas de données",
221
     "noData": "Pas de données",
222
     "editInformation": "Modifier les informations",
222
     "editInformation": "Modifier les informations",
223
-    "clubs": "Clubs",
224
-    "clubsSubtitle": "Liste de vos clubs",
223
+    "clubs": "Vos clubs",
224
+    "clubsSubtitle": "Cliquez sur un club pour afficher ses informations",
225
+    "isMember": "Membre",
226
+    "isManager": "Responsable",
225
     "membership": "Cotisation",
227
     "membership": "Cotisation",
226
     "membershipSubtitle": "Permet de participer à diverses activités",
228
     "membershipSubtitle": "Permet de participer à diverses activités",
227
     "membershipPayed": "Payée",
229
     "membershipPayed": "Payée",

Loading…
Cancel
Save