Browse Source

Added link to the timetable + removed list update toast if success

keplyx 4 years ago
parent
commit
fd0d896709
4 changed files with 26 additions and 14 deletions
  1. 16
    8
      components/SideMenu.js
  2. 1
    0
      translations/en.json
  3. 1
    0
      translations/fr.json
  4. 8
    6
      utils/WebDataManager.js

+ 16
- 8
components/SideMenu.js View File

@@ -10,8 +10,9 @@ const deviceHeight = Dimensions.get("window").height;
10 10
 
11 11
 const drawerCover = require("../assets/drawer-cover.png");
12 12
 
13
-const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud/index.php/Accueil";
13
+const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud";
14 14
 const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale";
15
+const TIMETABLE_LINK = "http://planex.insa-toulouse.fr";
15 16
 
16 17
 type Props = {
17 18
     navigation: Object,
@@ -73,14 +74,23 @@ export default class SideBar extends React.Component<Props, State> {
73 74
                 route: "amicale",
74 75
                 icon: "web",
75 76
                 bg: "#477EEA",
77
+                link: Amicale_LINK
78
+                // types: "11"
79
+            },
80
+            {
81
+                name: i18n.t('screens.timetable'),
82
+                route: "timetable",
83
+                icon: "timetable",
84
+                bg: "#477EEA",
85
+                link: TIMETABLE_LINK
76 86
                 // types: "11"
77 87
             },
78
-
79 88
             {
80 89
                 name: "Wiketud",
81 90
                 route: "wiketud",
82
-                icon: "web",
91
+                icon: "wikipedia",
83 92
                 bg: "#477EEA",
93
+                link: WIKETUD_LINK
84 94
                 // types: "11"
85 95
             },
86 96
             {
@@ -129,12 +139,10 @@ export default class SideBar extends React.Component<Props, State> {
129 139
                                 noBorder={item.name !== 'Wiketud' && item.name !== 'Proximo'} // Display a separator before settings and Amicale
130 140
                                 selected={this.state.active === item.route}
131 141
                                 onPress={() => {
132
-                                    if (item.name !== 'Wiketud' && item.name !== 'Amicale')
142
+                                    if (item.link !== undefined)
143
+                                        Linking.openURL(item.link).catch((err) => console.error('Error opening link', err));
144
+                                    else
133 145
                                         this.navigateToScreen(item.route);
134
-                                    else if (item.name === 'Wiketud')
135
-                                        Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err));
136
-                                    else if (item.name === 'Amicale')
137
-                                        Linking.openURL(Amicale_LINK).catch((err) => console.error('Error opening link', err));
138 146
                                 }}
139 147
                             >
140 148
                                 <Left>

+ 1
- 0
translations/en.json View File

@@ -4,6 +4,7 @@
4 4
     "planning": "Planning",
5 5
     "proxiwash": "Proxiwash",
6 6
     "proximo": "Proximo",
7
+    "timetable": "Timetable",
7 8
     "settings": "Settings",
8 9
     "about": "About"
9 10
   },

+ 1
- 0
translations/fr.json View File

@@ -4,6 +4,7 @@
4 4
     "planning": "Planning",
5 5
     "proxiwash": "Proxiwash",
6 6
     "proximo": "Proximo",
7
+    "timetable": "Emploi du temps",
7 8
     "settings": "Paramètres",
8 9
     "about": "À Propos"
9 10
   },

+ 8
- 6
utils/WebDataManager.js View File

@@ -29,12 +29,14 @@ export default class WebDataManager {
29 29
 
30 30
     showUpdateToast(successString, errorString) {
31 31
         let isSuccess = this.isDataObjectValid();
32
-        Toast.show({
33
-            text: isSuccess ? successString : errorString,
34
-            buttonText: 'OK',
35
-            type: isSuccess ? "success" : "danger",
36
-            duration: 2000
37
-        })
32
+        if (!isSuccess) {
33
+            Toast.show({
34
+                text: isSuccess ? successString : errorString,
35
+                buttonText: 'OK',
36
+                type: isSuccess ? "success" : "danger",
37
+                duration: 2000
38
+            });
39
+        }
38 40
     }
39 41
 
40 42
 }

Loading…
Cancel
Save