Browse Source

Update ui to go to proxiwash Settings

Remove the header of proxiwash screen
Add a button on proxiwash screen tool bar
docjyJ 3 years ago
parent
commit
02e30f87cf

+ 6
- 3
src/components/Lists/Proxiwash/ProxiwashListItem.js View File

@@ -59,6 +59,8 @@ class ProxiwashListItem extends React.Component<PropsType> {
59 59
 
60 60
   title: string;
61 61
 
62
+  titlePopUp: string;
63
+
62 64
   constructor(props: PropsType) {
63 65
     super(props);
64 66
     this.stateColors = {};
@@ -67,7 +69,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
67 69
     this.updateStateStrings();
68 70
 
69 71
     let displayNumber = props.item.number;
70
-    const displayMaxWeight = props.item.maxWeight;
72
+    const displayMaxWeight = props.item['maxWeight '];
71 73
     if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
72 74
       displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
73 75
         parseInt(props.item.number, 10),
@@ -76,7 +78,8 @@ class ProxiwashListItem extends React.Component<PropsType> {
76 78
     this.title = props.isDryer
77 79
       ? i18n.t('screens.proxiwash.dryer')
78 80
       : i18n.t('screens.proxiwash.washer');
79
-    this.title += ` n°${displayNumber} - ${displayMaxWeight} kg`;
81
+    this.title += ` n°${displayNumber}`;
82
+    this.titlePopUp = `${this.title} - ${displayMaxWeight} kg`;
80 83
   }
81 84
 
82 85
   shouldComponentUpdate(nextProps: PropsType): boolean {
@@ -91,7 +94,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
91 94
 
92 95
   onListItemPress = () => {
93 96
     const {props} = this;
94
-    props.onPress(this.title, props.item, props.isDryer);
97
+    props.onPress(this.titlePopUp, props.item, props.isDryer);
95 98
   };
96 99
 
97 100
   updateStateStrings() {

+ 15
- 30
src/screens/Proxiwash/ProxiwashScreen.js View File

@@ -37,7 +37,7 @@ const LIST_ITEM_HEIGHT = 64;
37 37
 export type ProxiwashMachineType = {
38 38
   number: string,
39 39
   state: string,
40
-  maxWeight: number,
40
+  'maxWeight ': number,
41 41
   startTime: string,
42 42
   endTime: string,
43 43
   donePercent: string,
@@ -128,6 +128,11 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
128 128
             iconName="information"
129 129
             onPress={this.onAboutPress}
130 130
           />
131
+          <Item
132
+            title="settings"
133
+            iconName="settings"
134
+            onPress={this.onSettingsPress}
135
+          />
131 136
         </MaterialHeaderButtons>
132 137
       ),
133 138
     });
@@ -143,6 +148,15 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
143 148
   };
144 149
 
145 150
   /**
151
+   * Callback used when pressing the settings button.
152
+   * This will open the ProxiwashSettingsScreen.
153
+   */
154
+  onSettingsPress = () => {
155
+    const {navigation} = this.props;
156
+    navigation.navigate('proxiwash-settings');
157
+  };
158
+
159
+  /**
146 160
    * Callback used when the user clicks on enable notifications for a machine
147 161
    *
148 162
    * @param machine The machine to set notifications for
@@ -422,34 +436,6 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
422 436
     }
423 437
   };
424 438
 
425
-  onPressCallback = () => {
426
-    const {navigation} = this.props;
427
-    navigation.navigate('proxiwash-settings');
428
-  };
429
-
430
-  getListHeader = (): React.Node => {
431
-    const {selectedWash} = this.state;
432
-    let item: LaverieType;
433
-    switch (selectedWash) {
434
-      case 'tripodeB':
435
-        item = PROXIWASH_DATA.tripodeB;
436
-        break;
437
-      default:
438
-        item = PROXIWASH_DATA.washinsa;
439
-    }
440
-    const getItemIcon = (props: ListIconPropsType): React.Node =>
441
-      ProxiwashScreen.getItemIcon(item, props);
442
-    return (
443
-      <List.Item
444
-        title={item.title}
445
-        description={item.subtitle}
446
-        left={getItemIcon}
447
-        right={ProxiwashScreen.getChevronIcon}
448
-        onPress={this.onPressCallback}
449
-      />
450
-    );
451
-  };
452
-
453 439
   /**
454 440
    * Adds the given notifications associated to a machine ID to the watchlist, and saves the array to the preferences
455 441
    *
@@ -519,7 +505,6 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
519 505
             autoRefreshTime={REFRESH_TIME}
520 506
             refreshOnFocus
521 507
             updateData={state.machinesWatched.length}
522
-            renderListHeaderComponent={this.getListHeader}
523 508
           />
524 509
         </View>
525 510
         <MascotPopup

Loading…
Cancel
Save