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,6 +236,16 @@ function ProfileStackComponent() {
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 249
         </ProfileStack.Navigator>
240 250
     );
241 251
 }
@@ -290,7 +300,7 @@ function ClubStackComponent() {
290 300
                 component={ClubDisplayScreen}
291 301
                 options={({navigation}) => {
292 302
                     return {
293
-                        title: "",
303
+                        title: i18n.t('screens.clubDisplayScreen'),
294 304
                         ...TransitionPresets.ModalSlideFromBottomIOS,
295 305
                     };
296 306
                 }}
@@ -300,7 +310,7 @@ function ClubStackComponent() {
300 310
                 component={ClubAboutScreen}
301 311
                 options={({navigation}) => {
302 312
                     return {
303
-                        title: "ABOUT",
313
+                        title: i18n.t('screens.about'),
304 314
                         ...TransitionPresets.ModalSlideFromBottomIOS,
305 315
                     };
306 316
                 }}

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

@@ -135,6 +135,7 @@ class ClubDisplayScreen extends React.Component<Props, State> {
135 135
     getScreen = (data: Object) => {
136 136
         console.log('fetchedData passed to screen:');
137 137
         console.log(data);
138
+        console.log("Using fake data");
138 139
         data = FakeClub;
139 140
         this.updateHeaderTitle(data);
140 141
 

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

@@ -79,7 +79,7 @@ class ProfileScreen extends React.Component<Props, State> {
79 79
                 return this.getPersonalCard();
80 80
             case '1':
81 81
                 return this.getClubCard();
82
-            case '2':
82
+            default:
83 83
                 return this.getMembershipCar();
84 84
         }
85 85
     };
@@ -164,20 +164,39 @@ class ProfileScreen extends React.Component<Props, State> {
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 190
     getClubList(list: Array<string>) {
168 191
         let dataset = [];
169 192
         for (let i = 0; i < list.length; i++) {
170 193
             dataset.push({name: list[i]});
171 194
         }
172 195
         return (
196
+            //$FlowFixMe
173 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 200
                 data={dataset}
182 201
             />
183 202
         );

+ 4
- 2
translations/en.json View File

@@ -220,8 +220,10 @@
220 220
     "personalInformation": "Personal information",
221 221
     "noData": "No data",
222 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 227
     "membership": "Membership Fee",
226 228
     "membershipSubtitle": "Allows you to take part in various activities",
227 229
     "membershipPayed": "Payed",

+ 4
- 2
translations/fr.json View File

@@ -220,8 +220,10 @@
220 220
     "personalInformation": "Informations Personnelles",
221 221
     "noData": "Pas de données",
222 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 227
     "membership": "Cotisation",
226 228
     "membershipSubtitle": "Permet de participer à diverses activités",
227 229
     "membershipPayed": "Payée",

Loading…
Cancel
Save