Browse Source

Allow laundromat swwitch from header

Arnaud Vergnet 6 months ago
parent
commit
02135d64ff

+ 1
- 0
locales/en.json View File

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

+ 1
- 0
locales/fr.json View File

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

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

@@ -1,8 +1,11 @@
1 1
 import React from 'react';
2 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 4
 import TimeAgo from 'react-native-timeago';
5 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 10
 let moment = require('moment'); //load moment module to set local language
8 11
 require('moment/locale/fr'); // import moment local language file during the application build
@@ -14,14 +17,22 @@ type Props = {
14 17
 };
15 18
 
16 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 28
 function ProximoListHeader(props: Props) {
29
+  const navigation = useNavigation();
21 30
   const { date, selectedWash } = props;
22 31
   let title = i18n.t('screens.proxiwash.washinsa.title');
32
+  let icon = ProxiwashConstants.washinsa.icon;
23 33
   if (selectedWash === 'tripodeB') {
24 34
     title = i18n.t('screens.proxiwash.tripodeB.title');
35
+    icon = ProxiwashConstants.tripodeB.icon;
25 36
   }
26 37
   return (
27 38
     <Card style={styles.card}>
@@ -35,7 +46,17 @@ function ProximoListHeader(props: Props) {
35 46
             </Text>
36 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 60
     </Card>
40 61
   );
41 62
 }

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

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

Loading…
Cancel
Save