Browse Source

Allow laundromat swwitch from header

Arnaud Vergnet 2 years ago
parent
commit
02135d64ff

+ 1
- 0
locales/en.json View File

41
       "washer": "Washer",
41
       "washer": "Washer",
42
       "washers": "Washers",
42
       "washers": "Washers",
43
       "updated": "Updated ",
43
       "updated": "Updated ",
44
+      "switch": "Switch laundromat",
44
       "min": "min",
45
       "min": "min",
45
       "informationTab": "Information",
46
       "informationTab": "Information",
46
       "paymentTab": "Payment",
47
       "paymentTab": "Payment",

+ 1
- 0
locales/fr.json View File

41
       "washer": "Lave-Linge",
41
       "washer": "Lave-Linge",
42
       "washers": "Lave-Linges",
42
       "washers": "Lave-Linges",
43
       "updated": "Mise à jour ",
43
       "updated": "Mise à jour ",
44
+      "switch": "Changer de laverie",
44
       "min": "min",
45
       "min": "min",
45
       "informationTab": "Informations",
46
       "informationTab": "Informations",
46
       "paymentTab": "Paiement",
47
       "paymentTab": "Paiement",

+ 23
- 2
src/components/Lists/Proximo/ProximoListHeader.tsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import { StyleSheet } from 'react-native';
2
 import { StyleSheet } from 'react-native';
3
-import { Card, Text } from 'react-native-paper';
3
+import { Avatar, Button, Card, Text } from 'react-native-paper';
4
 import TimeAgo from 'react-native-timeago';
4
 import TimeAgo from 'react-native-timeago';
5
 import i18n from 'i18n-js';
5
 import i18n from 'i18n-js';
6
+import { useNavigation } from '@react-navigation/core';
7
+import { MainRoutes } from '../../../navigation/MainNavigator';
8
+import ProxiwashConstants from '../../../constants/ProxiwashConstants';
6
 
9
 
7
 let moment = require('moment'); //load moment module to set local language
10
 let moment = require('moment'); //load moment module to set local language
8
 require('moment/locale/fr'); // import moment local language file during the application build
11
 require('moment/locale/fr'); // import moment local language file during the application build
14
 };
17
 };
15
 
18
 
16
 const styles = StyleSheet.create({
19
 const styles = StyleSheet.create({
17
-  card: { marginHorizontal: 5 },
20
+  card: {
21
+    marginHorizontal: 5,
22
+  },
23
+  actions: {
24
+    justifyContent: 'center',
25
+  },
18
 });
26
 });
19
 
27
 
20
 function ProximoListHeader(props: Props) {
28
 function ProximoListHeader(props: Props) {
29
+  const navigation = useNavigation();
21
   const { date, selectedWash } = props;
30
   const { date, selectedWash } = props;
22
   let title = i18n.t('screens.proxiwash.washinsa.title');
31
   let title = i18n.t('screens.proxiwash.washinsa.title');
32
+  let icon = ProxiwashConstants.washinsa.icon;
23
   if (selectedWash === 'tripodeB') {
33
   if (selectedWash === 'tripodeB') {
24
     title = i18n.t('screens.proxiwash.tripodeB.title');
34
     title = i18n.t('screens.proxiwash.tripodeB.title');
35
+    icon = ProxiwashConstants.tripodeB.icon;
25
   }
36
   }
26
   return (
37
   return (
27
     <Card style={styles.card}>
38
     <Card style={styles.card}>
35
             </Text>
46
             </Text>
36
           ) : null
47
           ) : null
37
         }
48
         }
49
+        left={(iconProps) => <Avatar.Icon icon={icon} size={iconProps.size} />}
38
       />
50
       />
51
+      <Card.Actions style={styles.actions}>
52
+        <Button
53
+          mode={'contained'}
54
+          onPress={() => navigation.navigate(MainRoutes.Settings)}
55
+          icon={'swap-horizontal'}
56
+        >
57
+          {i18n.t('screens.proxiwash.switch')}
58
+        </Button>
59
+      </Card.Actions>
39
     </Card>
60
     </Card>
40
   );
61
   );
41
 }
62
 }

+ 0
- 5
src/screens/Proxiwash/ProxiwashScreen.tsx View File

131
       headerRight: () => (
131
       headerRight: () => (
132
         <MaterialHeaderButtons>
132
         <MaterialHeaderButtons>
133
           <Item
133
           <Item
134
-            title={'switch'}
135
-            iconName={'swap-horizontal'}
136
-            onPress={() => navigation.navigate('settings')}
137
-          />
138
-          <Item
139
             title={'information'}
134
             title={'information'}
140
             iconName={'information'}
135
             iconName={'information'}
141
             onPress={() => navigation.navigate('proxiwash-about')}
136
             onPress={() => navigation.navigate('proxiwash-about')}

Loading…
Cancel
Save