Browse Source

Added wiketud link in drawer

keplyx 2 years ago
parent
commit
356d7c2092
1 changed files with 22 additions and 10 deletions
  1. 22
    10
      components/SideMenu.js

+ 22
- 10
components/SideMenu.js View File

@@ -1,5 +1,5 @@
1 1
 import React from 'react';
2
-import {Platform, Dimensions, StyleSheet, Image, FlatList} from 'react-native';
2
+import {Platform, Dimensions, StyleSheet, Image, FlatList, Linking} from 'react-native';
3 3
 import {Badge, Text, Container, Content, Icon, Left, ListItem, Right} from "native-base";
4 4
 import i18n from "i18n-js";
5 5
 
@@ -7,6 +7,8 @@ const deviceHeight = Dimensions.get("window").height;
7 7
 
8 8
 const drawerCover = require("../assets/drawer-cover.png");
9 9
 
10
+const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud/index.php/Accueil";
11
+
10 12
 export default class SideBar extends React.Component {
11 13
 
12 14
     constructor(props) {
@@ -44,6 +46,13 @@ export default class SideBar extends React.Component {
44 46
                 // types: "11"
45 47
             },
46 48
             {
49
+                name: "Wiketud",
50
+                route: "",
51
+                icon: "web",
52
+                bg: "#477EEA",
53
+                // types: "11"
54
+            },
55
+            {
47 56
                 name: i18n.t('screens.settings'),
48 57
                 route: "Settings",
49 58
                 icon: "settings",
@@ -60,7 +69,7 @@ export default class SideBar extends React.Component {
60 69
         ];
61 70
     }
62 71
 
63
-    navigateToScreen = (route) => () => {
72
+    navigateToScreen(route) {
64 73
         this.props.navigation.navigate(route);
65 74
         this.props.navigation.closeDrawer();
66 75
         this.setState({active: route});
@@ -71,9 +80,9 @@ export default class SideBar extends React.Component {
71 80
             <Container>
72 81
                 <Content
73 82
                     bounces={false}
74
-                    style={{ flex: 1, top: -1 }}
83
+                    style={{flex: 1, top: -1}}
75 84
                 >
76
-                    <Image source={drawerCover} style={styles.drawerCover} />
85
+                    <Image source={drawerCover} style={styles.drawerCover}/>
77 86
 
78 87
                     <FlatList
79 88
                         data={this.dataSet}
@@ -82,25 +91,28 @@ export default class SideBar extends React.Component {
82 91
                         renderItem={({item}) =>
83 92
                             <ListItem
84 93
                                 button
85
-                                noBorder={item.route !== 'Proximo'} // Display a separator before settings
94
+                                noBorder={item.name !== 'Wiketud'} // Display a separator before settings
86 95
                                 selected={this.state.active === item.route}
87
-                                onPress={
88
-                                    this.navigateToScreen(item.route)
89
-                                }
96
+                                onPress={() => {
97
+                                    if (item.name !== 'Wiketud')
98
+                                        this.navigateToScreen(item.route);
99
+                                    else
100
+                                        Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err));
101
+                                }}
90 102
                             >
91 103
                                 <Left>
92 104
                                     <Icon
93 105
                                         active
94 106
                                         name={item.icon}
95 107
                                         type={'MaterialCommunityIcons'}
96
-                                        style={{ color: "#777", fontSize: 26, width: 30 }}
108
+                                        style={{color: "#777", fontSize: 26, width: 30}}
97 109
                                     />
98 110
                                     <Text style={styles.text}>
99 111
                                         {item.name}
100 112
                                     </Text>
101 113
                                 </Left>
102 114
                                 {item.types &&
103
-                                <Right style={{ flex: 1 }}>
115
+                                <Right style={{flex: 1}}>
104 116
                                     <Badge
105 117
                                         style={{
106 118
                                             borderRadius: 3,

Loading…
Cancel
Save