Browse Source

Move constant data in constants file

Arnaud Vergnet 1 year ago
parent
commit
b27864858b

+ 22
- 0
src/constants/ProxiwashConstants.js View File

@@ -17,4 +17,26 @@ export default {
17 17
     5: 'alert',
18 18
     6: 'help-circle-outline',
19 19
   },
20
+  washinsa: {
21
+    id: 'washinsa',
22
+    title: 'screens.proxiwash.washinsa.title',
23
+    subtitle: 'screens.proxiwash.washinsa.subtitle',
24
+    description: 'screens.proxiwash.washinsa.description',
25
+    tarif: 'screens.proxiwash.washinsa.tariff',
26
+    paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
27
+    icon: 'school-outline',
28
+    url:
29
+      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json',
30
+  },
31
+  tripodeB: {
32
+    id: 'tripodeB',
33
+    title: 'screens.proxiwash.tripodeB.title',
34
+    subtitle: 'screens.proxiwash.tripodeB.subtitle',
35
+    description: 'screens.proxiwash.tripodeB.description',
36
+    tarif: 'screens.proxiwash.tripodeB.tariff',
37
+    paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
38
+    icon: 'domain',
39
+    url:
40
+      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json',
41
+  },
20 42
 };

+ 3
- 27
src/screens/Proxiwash/ProxiwashAboutScreen.js View File

@@ -6,6 +6,7 @@ import i18n from 'i18n-js';
6 6
 import {Card, Avatar, Paragraph, Title} from 'react-native-paper';
7 7
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
8 8
 import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
9
+import ProxiwashConstants from '../../constants/ProxiwashConstants';
9 10
 
10 11
 const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
11 12
 
@@ -20,31 +21,6 @@ export type LaundromatType = {
20 21
   url: string,
21 22
 };
22 23
 
23
-export const PROXIWASH_DATA = {
24
-  washinsa: {
25
-    id: 'washinsa',
26
-    title: 'screens.proxiwash.washinsa.title',
27
-    subtitle: 'screens.proxiwash.washinsa.subtitle',
28
-    description: 'screens.proxiwash.washinsa.description',
29
-    tarif: 'screens.proxiwash.washinsa.tariff',
30
-    paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
31
-    icon: 'school-outline',
32
-    url:
33
-      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json',
34
-  },
35
-  tripodeB: {
36
-    id: 'tripodeB',
37
-    title: 'screens.proxiwash.tripodeB.title',
38
-    subtitle: 'screens.proxiwash.tripodeB.subtitle',
39
-    description: 'screens.proxiwash.tripodeB.description',
40
-    tarif: 'screens.proxiwash.tripodeB.tariff',
41
-    paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
42
-    icon: 'domain',
43
-    url:
44
-      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json',
45
-  },
46
-};
47
-
48 24
 /**
49 25
  * Class defining the proxiwash about screen.
50 26
  */
@@ -88,9 +64,9 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
88 64
           />
89 65
         </View>
90 66
 
91
-        {ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.washinsa)}
67
+        {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.washinsa)}
92 68
 
93
-        {ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.tripodeB)}
69
+        {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.tripodeB)}
94 70
 
95 71
         <Card style={{margin: 5}}>
96 72
           <Card.Title

+ 2
- 3
src/screens/Proxiwash/ProxiwashScreen.js View File

@@ -26,7 +26,6 @@ import {
26 26
 import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
27 27
 import MascotPopup from '../../components/Mascot/MascotPopup';
28 28
 import type {SectionListDataType} from '../../components/Screens/WebSectionList';
29
-import {PROXIWASH_DATA} from './ProxiwashAboutScreen';
30 29
 import type {LaundromatType} from './ProxiwashAboutScreen';
31 30
 
32 31
 const modalStateStrings = {};
@@ -450,10 +449,10 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
450 449
     let data: LaundromatType;
451 450
     switch (state.selectedWash) {
452 451
       case 'tripodeB':
453
-        data = PROXIWASH_DATA.tripodeB;
452
+        data = ProxiwashConstants.tripodeB;
454 453
         break;
455 454
       default:
456
-        data = PROXIWASH_DATA.washinsa;
455
+        data = ProxiwashConstants.washinsa;
457 456
     }
458 457
     return (
459 458
       <View

Loading…
Cancel
Save