Browse Source

Changed tab order and stacks

Arnaud Vergnet 4 years ago
parent
commit
77cc5d8746

+ 0
- 16
src/components/Home/ActionsDashboardItem.js View File

@@ -37,22 +37,6 @@ class ActionsDashBoardItem extends React.Component<Props> {
37 37
                     onPress={() => this.props.navigation.navigate("amicale-home")}
38 38
                     style={styles.list}
39 39
                 />
40
-                <List.Item
41
-                    title={"STUDENT WEBSITES"}
42
-                    description={"TROP COOL"}
43
-                    left={props => <List.Icon {...props} icon="web"/>}
44
-                    right={props => <List.Icon {...props} icon="chevron-right"/>}
45
-                    onPress={() => this.props.navigation.navigate("websites-home")}
46
-                    style={styles.list}
47
-                />
48
-                <List.Item
49
-                    title={"SERVICES INSA"}
50
-                    description={"TROP BIEN"}
51
-                    left={props => <List.Icon {...props} icon="star"/>}
52
-                    right={props => <List.Icon {...props} icon="chevron-right"/>}
53
-                    onPress={() => this.props.navigation.navigate("insa-home")}
54
-                    style={styles.list}
55
-                />
56 40
             </Card>
57 41
         );
58 42
     }

+ 2
- 2
src/components/Tabbar/CustomTabBar.js View File

@@ -18,9 +18,9 @@ type State = {
18 18
 }
19 19
 
20 20
 const TAB_ICONS = {
21
-    planning: 'calendar-range',
22 21
     proxiwash: 'tshirt-crew',
23
-    proximo: 'cart',
22
+    students: 'account-circle',
23
+    insa: 'book',
24 24
     planex: 'clock',
25 25
 };
26 26
 

+ 71
- 68
src/navigation/MainTabNavigator.js View File

@@ -51,6 +51,7 @@ const screenTransition = Platform.OS === 'ios' ? TransitionPresets.SlideFromRigh
51 51
 
52 52
 function createScreenCollapsibleStack(
53 53
     name: string,
54
+    Stack: any,
54 55
     component: any,
55 56
     title: string,
56 57
     useNativeDriver?: boolean,
@@ -58,7 +59,7 @@ function createScreenCollapsibleStack(
58 59
     const {colors} = useTheme();
59 60
     const screenOptions = options != null ? options : {};
60 61
     return createCollapsibleStack(
61
-        <HomeStack.Screen
62
+        <Stack.Screen
62 63
             name={name}
63 64
             component={component}
64 65
             options={{
@@ -76,29 +77,41 @@ function createScreenCollapsibleStack(
76 77
     )
77 78
 }
78 79
 
79
-function getWebsiteStack(name: string, component: any, title: string) {
80
-    return createScreenCollapsibleStack(name, component, title, false);
80
+function getWebsiteStack(name: string, Stack:  any, component: any, title: string) {
81
+    return createScreenCollapsibleStack(name, Stack, component, title, false);
81 82
 }
82 83
 
83 84
 
84
-const ProximoStack = createStackNavigator();
85
+const StudentsStack = createStackNavigator();
85 86
 
86
-function ProximoStackComponent() {
87
+function StudentsStackComponent() {
87 88
     return (
88
-        <ProximoStack.Navigator
89
+        <StudentsStack.Navigator
89 90
             initialRouteName="index"
90 91
             headerMode={"screen"}
91 92
             screenOptions={defaultScreenOptions}
92 93
         >
93
-            {createScreenCollapsibleStack("index", ProximoMainScreen, "Proximo")}
94
+            <StudentsStack.Screen
95
+                name="index"
96
+                component={WebsitesHomeScreen}
97
+                options={{
98
+                    title: "WEBSITES HOME",
99
+                }}
100
+            />
101
+            {getWebsiteStack("amicale-website", StudentsStack, AmicaleWebsiteScreen, "Amicale")}
102
+            {getWebsiteStack("elus-etudiants", StudentsStack, ElusEtudiantsWebsiteScreen, "Élus Étudiants")}
103
+            {getWebsiteStack("wiketud", StudentsStack, WiketudWebsiteScreen, "Wiketud")}
104
+            {getWebsiteStack("tutorinsa", StudentsStack, TutorInsaWebsiteScreen, "Tutor'INSA")}
105
+            {createScreenCollapsibleStack("proximo", StudentsStack, ProximoMainScreen, "Proximo")}
94 106
             {createScreenCollapsibleStack(
95 107
                 "proximo-list",
108
+                StudentsStack,
96 109
                 ProximoListScreen,
97 110
                 i18n.t('screens.proximoArticles'),
98 111
                 true,
99 112
                 {...screenTransition},
100 113
             )}
101
-            <ProximoStack.Screen
114
+            <StudentsStack.Screen
102 115
                 name="proximo-about"
103 116
                 component={ProximoAboutScreen}
104 117
                 options={{
@@ -106,7 +119,22 @@ function ProximoStackComponent() {
106 119
                     ...modalTransition,
107 120
                 }}
108 121
             />
109
-        </ProximoStack.Navigator>
122
+            <StudentsStack.Screen
123
+                name="planning"
124
+                component={PlanningScreen}
125
+                options={{
126
+                    title: i18n.t('screens.planning'),
127
+                }}
128
+            />
129
+            <StudentsStack.Screen
130
+                name="planning-information"
131
+                component={PlanningDisplayScreen}
132
+                options={{
133
+                    title: i18n.t('screens.planningDisplayScreen'),
134
+                    ...modalTransition,
135
+                }}
136
+            />
137
+        </StudentsStack.Navigator>
110 138
     );
111 139
 }
112 140
 
@@ -119,7 +147,7 @@ function ProxiwashStackComponent() {
119 147
             headerMode={"screen"}
120 148
             screenOptions={defaultScreenOptions}
121 149
         >
122
-            {createScreenCollapsibleStack("index", ProxiwashScreen, i18n.t('screens.proxiwash'))}
150
+            {createScreenCollapsibleStack("index", ProxiwashStack, ProxiwashScreen, i18n.t('screens.proxiwash'))}
123 151
             <ProxiwashStack.Screen
124 152
                 name="proxiwash-about"
125 153
                 component={ProxiwashAboutScreen}
@@ -132,31 +160,26 @@ function ProxiwashStackComponent() {
132 160
     );
133 161
 }
134 162
 
135
-const PlanningStack = createStackNavigator();
163
+const InsaStack = createStackNavigator();
136 164
 
137
-function PlanningStackComponent() {
165
+function InsaStackComponent() {
138 166
     return (
139
-        <PlanningStack.Navigator
167
+        <InsaStack.Navigator
140 168
             initialRouteName="index"
141 169
             headerMode={"screen"}
142 170
             screenOptions={defaultScreenOptions}
143 171
         >
144
-            <PlanningStack.Screen
172
+            <InsaStack.Screen
145 173
                 name="index"
146
-                component={PlanningScreen}
147
-                options={{
148
-                    title: i18n.t('screens.planning'),
149
-                }}
150
-            />
151
-            <PlanningStack.Screen
152
-                name="planning-information"
153
-                component={PlanningDisplayScreen}
174
+                component={InsaHomeScreen}
154 175
                 options={{
155
-                    title: i18n.t('screens.planningDisplayScreen'),
156
-                    ...modalTransition,
176
+                    title: "INSA HOME",
157 177
                 }}
158 178
             />
159
-        </PlanningStack.Navigator>
179
+            {getWebsiteStack("available-rooms", InsaStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))}
180
+            {getWebsiteStack("bib", InsaStack, BibScreen, i18n.t('screens.bib'))}
181
+            {createScreenCollapsibleStack("self-menu", InsaStack, SelfMenuScreen, i18n.t('screens.menuSelf'))}
182
+        </InsaStack.Navigator>
160 183
     );
161 184
 }
162 185
 
@@ -191,14 +214,6 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st
191 214
                 }
192 215
             )}
193 216
             <HomeStack.Screen
194
-                name="home-planning-information"
195
-                component={PlanningDisplayScreen}
196
-                options={{
197
-                    title: i18n.t('screens.planningDisplayScreen'),
198
-                    ...modalTransition,
199
-                }}
200
-            />
201
-            <HomeStack.Screen
202 217
                 name="feed-information"
203 218
                 component={FeedItemScreen}
204 219
                 options={{
@@ -214,15 +229,14 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st
214 229
                     ...modalTransition,
215 230
                 }}
216 231
             />
217
-
218
-
219
-            {createScreenCollapsibleStack("self-menu", SelfMenuScreen, i18n.t('screens.menuSelf'))}
220
-            {getWebsiteStack("available-rooms", AvailableRoomScreen, i18n.t('screens.availableRooms'))}
221
-            {getWebsiteStack("bib", BibScreen, i18n.t('screens.bib'))}
222
-            {getWebsiteStack("amicale-website", AmicaleWebsiteScreen, "Amicale")}
223
-            {getWebsiteStack("elus-etudiants", ElusEtudiantsWebsiteScreen, "Élus Étudiants")}
224
-            {getWebsiteStack("wiketud", WiketudWebsiteScreen, "Wiketud")}
225
-            {getWebsiteStack("tutorinsa", TutorInsaWebsiteScreen, "Tutor'INSA")}
232
+            <HomeStack.Screen
233
+                name="home-planning-information"
234
+                component={PlanningDisplayScreen}
235
+                options={{
236
+                    title: i18n.t('screens.planningDisplayScreen'),
237
+                    ...modalTransition,
238
+                }}
239
+            />
226 240
             <HomeStack.Screen
227 241
                 name="tetris"
228 242
                 component={TetrisScreen}
@@ -244,7 +258,7 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st
244 258
                     title: i18n.t('screens.profile'),
245 259
                 }}
246 260
             />
247
-            {createScreenCollapsibleStack("club-list", ClubListScreen, i18n.t('clubs.clubList'))}
261
+            {createScreenCollapsibleStack("club-list", HomeStack, ClubListScreen, i18n.t('clubs.clubList'))}
248 262
             <HomeStack.Screen
249 263
                 name="club-information"
250 264
                 component={ClubDisplayScreen}
@@ -282,20 +296,6 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st
282 296
                     title: "AMICALE HOME",
283 297
                 }}
284 298
             />
285
-            <HomeStack.Screen
286
-                name="websites-home"
287
-                component={WebsitesHomeScreen}
288
-                options={{
289
-                    title: "WEBSITES HOME",
290
-                }}
291
-            />
292
-            <HomeStack.Screen
293
-                name="insa-home"
294
-                component={InsaHomeScreen}
295
-                options={{
296
-                    title: "INSA HOME",
297
-                }}
298
-            />
299 299
         </HomeStack.Navigator>
300 300
     );
301 301
 }
@@ -309,9 +309,10 @@ function PlanexStackComponent() {
309 309
             headerMode={"screen"}
310 310
             screenOptions={defaultScreenOptions}
311 311
         >
312
-            {getWebsiteStack("index", PlanexScreen, "Planex")}
312
+            {getWebsiteStack("index", PlanexStack, PlanexScreen, "Planex")}
313 313
             {createScreenCollapsibleStack(
314 314
                 "group-select",
315
+                PlanexStack,
315 316
                 GroupSelectionScreen,
316 317
                 "GROUP SELECT",
317 318
                 true,
@@ -348,26 +349,28 @@ export default class TabNavigator extends React.Component<Props> {
348 349
                 tabBar={props => <CustomTabBar {...props} />}
349 350
             >
350 351
                 <Tab.Screen
351
-                    name="proximo"
352
-                    option
353
-                    component={ProximoStackComponent}
354
-                    options={{title: i18n.t('screens.proximo')}}
352
+                    name="proxiwash"
353
+                    component={ProxiwashStackComponent}
354
+                    options={{title: i18n.t('screens.proxiwash')}}
355 355
                 />
356 356
                 <Tab.Screen
357
-                    name="planning"
358
-                    component={PlanningStackComponent}
359
-                    options={{title: i18n.t('screens.planning')}}
357
+                    name="students"
358
+                    option
359
+                    component={StudentsStackComponent}
360
+                    options={{title: "ETUDIANTS"}}
360 361
                 />
362
+
361 363
                 <Tab.Screen
362 364
                     name="home"
363 365
                     component={this.createHomeStackComponent}
364 366
                     options={{title: i18n.t('screens.home')}}
365 367
                 />
366 368
                 <Tab.Screen
367
-                    name="proxiwash"
368
-                    component={ProxiwashStackComponent}
369
-                    options={{title: i18n.t('screens.proxiwash')}}
369
+                    name="insa"
370
+                    component={InsaStackComponent}
371
+                    options={{title: "INSA"}}
370 372
                 />
373
+
371 374
                 <Tab.Screen
372 375
                     name="planex"
373 376
                     component={PlanexStackComponent}

+ 8
- 7
src/screens/Home/HomeScreen.js View File

@@ -103,11 +103,13 @@ class HomeScreen extends React.Component<Props> {
103 103
     colors: Object;
104 104
 
105 105
     fabRef: { current: null | AnimatedFAB };
106
+    currentNewFeed: Array<feedItem>;
106 107
 
107 108
     constructor(props) {
108 109
         super(props);
109 110
         this.colors = props.theme.colors;
110 111
         this.fabRef = React.createRef();
112
+        this.currentNewFeed = [];
111 113
     }
112 114
 
113 115
     /**
@@ -174,12 +176,10 @@ class HomeScreen extends React.Component<Props> {
174 176
      */
175 177
     createDataset = (fetchedData: rawDashboard) => {
176 178
         // fetchedData = DATA;
177
-        let newsData = [];
178
-        let dashboardData = [];
179
-        if (fetchedData.news_feed != null)
180
-            newsData = fetchedData.news_feed.data;
181
-        else
182
-            newsData = [];
179
+        let dashboardData;
180
+        if (fetchedData.news_feed != null) {
181
+            this.currentNewFeed = fetchedData.news_feed.data;
182
+        }
183 183
         if (fetchedData.dashboard != null)
184 184
             dashboardData = this.generateDashboardDataset(fetchedData.dashboard);
185 185
         else
@@ -192,7 +192,7 @@ class HomeScreen extends React.Component<Props> {
192 192
             },
193 193
             {
194 194
                 title: i18n.t('homeScreen.newsFeed'),
195
-                data: newsData,
195
+                data: this.currentNewFeed,
196 196
                 id: SECTIONS_ID[1]
197 197
             }
198 198
         ];
@@ -256,6 +256,7 @@ class HomeScreen extends React.Component<Props> {
256 256
                 id: 'event',
257 257
                 content: dashboardData == null ? [] : dashboardData.today_events
258 258
             },
259
+
259 260
         ];
260 261
     }
261 262
 

+ 12
- 0
src/screens/Websites/WebsitesHomeScreen.js View File

@@ -51,6 +51,18 @@ class WebsitesHomeScreen extends React.Component<Props, State> {
51 51
                 >
52 52
                     WIKETUD
53 53
                 </Button>
54
+                <Button
55
+                    icon={"information"}
56
+                    onPress={() => nav.navigate("proximo")}
57
+                >
58
+                    PROXIMO
59
+                </Button>
60
+                <Button
61
+                    icon={"information"}
62
+                    onPress={() => nav.navigate("planning")}
63
+                >
64
+                    PLANNING
65
+                </Button>
54 66
             </ScrollView>
55 67
         );
56 68
     }

Loading…
Cancel
Save