Browse Source

Improved code readability

Arnaud Vergnet 3 years ago
parent
commit
926515213d
2 changed files with 67 additions and 78 deletions
  1. 67
    67
      src/screens/Services/ServicesScreen.js
  2. 0
    11
      src/screens/Services/ServicesSectionScreen.js

+ 67
- 67
src/screens/Services/ServicesScreen.js View File

@@ -45,68 +45,68 @@ class ServicesScreen extends React.Component<Props> {
45 45
         super(props);
46 46
         const nav = props.navigation;
47 47
         this.studentsDataset = [
48
-                {
49
-                    title: "proximo",
50
-                    subtitle: "proximo",
51
-                    image: PROXIMO_IMAGE,
52
-                    onPress: () => nav.navigate("proximo"),
53
-                },
54
-                {
55
-                    title: "AMICALE",
56
-                    subtitle: "AMICALE",
57
-                    image: AMICALE_IMAGE,
58
-                    onPress: () => nav.navigate("amicale-website"),
59
-                },
60
-                {
61
-                    title: "wiketud",
62
-                    subtitle: "wiketud",
63
-                    image: WIKETUD_LINK,
64
-                    onPress: () => nav.navigate("wiketud"),
65
-                },
66
-                {
67
-                    title: "ELUS ETUDIANTS",
68
-                    subtitle: "ELUS ETUDIANTS",
69
-                    image: EE_IMAGE,
70
-                    onPress: () => nav.navigate("elus-etudiants"),
71
-                },
72
-                {
73
-                    title: "TUTOR INSA",
74
-                    subtitle: "TUTOR INSA",
75
-                    image: TUTORINSA_IMAGE,
76
-                    onPress: () => nav.navigate("tutorinsa"),
77
-                },
48
+            {
49
+                title: "proximo",
50
+                subtitle: "proximo",
51
+                image: PROXIMO_IMAGE,
52
+                onPress: () => nav.navigate("proximo"),
53
+            },
54
+            {
55
+                title: "AMICALE",
56
+                subtitle: "AMICALE",
57
+                image: AMICALE_IMAGE,
58
+                onPress: () => nav.navigate("amicale-website"),
59
+            },
60
+            {
61
+                title: "wiketud",
62
+                subtitle: "wiketud",
63
+                image: WIKETUD_LINK,
64
+                onPress: () => nav.navigate("wiketud"),
65
+            },
66
+            {
67
+                title: "ELUS ETUDIANTS",
68
+                subtitle: "ELUS ETUDIANTS",
69
+                image: EE_IMAGE,
70
+                onPress: () => nav.navigate("elus-etudiants"),
71
+            },
72
+            {
73
+                title: "TUTOR INSA",
74
+                subtitle: "TUTOR INSA",
75
+                image: TUTORINSA_IMAGE,
76
+                onPress: () => nav.navigate("tutorinsa"),
77
+            },
78 78
         ];
79 79
         this.insaDataset = [
80
-                {
81
-                    title: "RU",
82
-                    subtitle: "the ru",
83
-                    image: RU_IMAGE,
84
-                    onPress: () => nav.navigate("self-menu"),
85
-                },
86
-                {
87
-                    title: "AVAILABLE ROOMS",
88
-                    subtitle: "ROOMS",
89
-                    image: ROOM_IMAGE,
90
-                    onPress: () => nav.navigate("available-rooms"),
91
-                },
92
-                {
93
-                    title: "BIB",
94
-                    subtitle: "BIB",
95
-                    image: BIB_IMAGE,
96
-                    onPress: () => nav.navigate("bib"),
97
-                },
98
-                {
99
-                    title: "EMAIL",
100
-                    subtitle: "EMAIL",
101
-                    image: EMAIL_IMAGE,
102
-                    onPress: () => nav.navigate("bluemind"),
103
-                },
104
-                {
105
-                    title: "ENT",
106
-                    subtitle: "ENT",
107
-                    image: ENT_IMAGE,
108
-                    onPress: () => nav.navigate("ent"),
109
-                },
80
+            {
81
+                title: "RU",
82
+                subtitle: "the ru",
83
+                image: RU_IMAGE,
84
+                onPress: () => nav.navigate("self-menu"),
85
+            },
86
+            {
87
+                title: "AVAILABLE ROOMS",
88
+                subtitle: "ROOMS",
89
+                image: ROOM_IMAGE,
90
+                onPress: () => nav.navigate("available-rooms"),
91
+            },
92
+            {
93
+                title: "BIB",
94
+                subtitle: "BIB",
95
+                image: BIB_IMAGE,
96
+                onPress: () => nav.navigate("bib"),
97
+            },
98
+            {
99
+                title: "EMAIL",
100
+                subtitle: "EMAIL",
101
+                image: EMAIL_IMAGE,
102
+                onPress: () => nav.navigate("bluemind"),
103
+            },
104
+            {
105
+                title: "ENT",
106
+                subtitle: "ENT",
107
+                image: ENT_IMAGE,
108
+                onPress: () => nav.navigate("ent"),
109
+            },
110 110
         ];
111 111
         this.finalDataset = [
112 112
             {
@@ -141,15 +141,15 @@ class ServicesScreen extends React.Component<Props> {
141 141
 
142 142
     getAvatar(props, source: string | number) {
143 143
         if (typeof source === "number")
144
-        return <Avatar.Image
145
-            size={48}
146
-            source={AMICALE_IMAGE}
147
-            style={{backgroundColor: 'transparent'}}/>
144
+            return <Avatar.Image
145
+                size={48}
146
+                source={AMICALE_IMAGE}
147
+                style={{backgroundColor: 'transparent'}}/>
148 148
         else
149
-            return <List.Icon {...props} icon={source} />
149
+            return <List.Icon {...props} icon={source}/>
150 150
     }
151 151
 
152
-    renderItem = ({item} : {item: listItem}) => {
152
+    renderItem = ({item}: { item: listItem }) => {
153 153
         return (
154 154
             <Card
155 155
                 style={{
@@ -161,7 +161,7 @@ class ServicesScreen extends React.Component<Props> {
161 161
                     title={item.title}
162 162
                     subtitle={item.description}
163 163
                     left={(props) => this.getAvatar(props, item.image)}
164
-                    right={(props) => <List.Icon {...props} icon="chevron-right" />}
164
+                    right={(props) => <List.Icon {...props} icon="chevron-right"/>}
165 165
                 />
166 166
                 <CardList
167 167
                     dataset={item.content}

+ 0
- 11
src/screens/Services/ServicesSectionScreen.js View File

@@ -13,17 +13,6 @@ type Props = {
13 13
     route: Object,
14 14
     collapsibleStack: Collapsible,
15 15
 }
16
-const BIB_IMAGE = "https://scontent-cdg2-1.xx.fbcdn.net/v/t1.0-9/50695561_2124263197597162_2325349608210825216_n.jpg?_nc_cat=109&_nc_sid=8bfeb9&_nc_ohc=tmcV6FWO7_kAX9vfWHU&_nc_ht=scontent-cdg2-1.xx&oh=3b81c76e46b49f7c3a033ea3b07ec212&oe=5EC59B4D";
17
-const RU_IMAGE = "https://scontent-cdg2-1.xx.fbcdn.net/v/t1.0-9/47123773_2041883702501779_5289372776166064128_o.jpg?_nc_cat=100&_nc_sid=cdbe9c&_nc_ohc=dpuBGlIIy_EAX8CyC0l&_nc_ht=scontent-cdg2-1.xx&oh=5c5bb4f0c7f12b554246f7c9b620a5f3&oe=5EC4DB31";
18
-const ROOM_IMAGE = "https://scontent-cdt1-1.xx.fbcdn.net/v/t1.0-9/47041013_2043521689004647_316124496522117120_n.jpg?_nc_cat=103&_nc_sid=8bfeb9&_nc_ohc=bIp8OVJvvSEAX8mKnDZ&_nc_ht=scontent-cdt1-1.xx&oh=b4fef72a645804a849ad30e9e20fca12&oe=5EC29309";
19
-const EMAIL_IMAGE = "https://etud-mel.insa-toulouse.fr/webmail/images/logo-bluemind.png";
20
-const ENT_IMAGE = "https://ent.insa-toulouse.fr/media/org/jasig/portal/layout/tab-column/xhtml-theme/insa/institutional/LogoInsa.png";
21
-
22
-const PROXIMO_IMAGE = require("../../../assets/proximo-logo.png");
23
-const WIKETUD_LINK = "https://wiki.etud.insa-toulouse.fr/resources/assets/wiketud.png?ff051";
24
-const AMICALE_IMAGE = require("../../../assets/amicale.png");
25
-const EE_IMAGE = "https://etud.insa-toulouse.fr/~eeinsat/wp-content/uploads/2019/09/logo-blanc.png";
26
-const TUTORINSA_IMAGE = "https://www.etud.insa-toulouse.fr/~tutorinsa/public/images/logo-gray.png";
27 16
 
28 17
 type listItem = {
29 18
     title: string,

Loading…
Cancel
Save