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
 
59
 
60
   title: string;
60
   title: string;
61
 
61
 
62
+  titlePopUp: string;
63
+
62
   constructor(props: PropsType) {
64
   constructor(props: PropsType) {
63
     super(props);
65
     super(props);
64
     this.stateColors = {};
66
     this.stateColors = {};
67
     this.updateStateStrings();
69
     this.updateStateStrings();
68
 
70
 
69
     let displayNumber = props.item.number;
71
     let displayNumber = props.item.number;
70
-    const displayMaxWeight = props.item.maxWeight;
72
+    const displayMaxWeight = props.item['maxWeight '];
71
     if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
73
     if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
72
       displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
74
       displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
73
         parseInt(props.item.number, 10),
75
         parseInt(props.item.number, 10),
76
     this.title = props.isDryer
78
     this.title = props.isDryer
77
       ? i18n.t('screens.proxiwash.dryer')
79
       ? i18n.t('screens.proxiwash.dryer')
78
       : i18n.t('screens.proxiwash.washer');
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
   shouldComponentUpdate(nextProps: PropsType): boolean {
85
   shouldComponentUpdate(nextProps: PropsType): boolean {
91
 
94
 
92
   onListItemPress = () => {
95
   onListItemPress = () => {
93
     const {props} = this;
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
   updateStateStrings() {
100
   updateStateStrings() {

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

37
 export type ProxiwashMachineType = {
37
 export type ProxiwashMachineType = {
38
   number: string,
38
   number: string,
39
   state: string,
39
   state: string,
40
-  maxWeight: number,
40
+  'maxWeight ': number,
41
   startTime: string,
41
   startTime: string,
42
   endTime: string,
42
   endTime: string,
43
   donePercent: string,
43
   donePercent: string,
128
             iconName="information"
128
             iconName="information"
129
             onPress={this.onAboutPress}
129
             onPress={this.onAboutPress}
130
           />
130
           />
131
+          <Item
132
+            title="settings"
133
+            iconName="settings"
134
+            onPress={this.onSettingsPress}
135
+          />
131
         </MaterialHeaderButtons>
136
         </MaterialHeaderButtons>
132
       ),
137
       ),
133
     });
138
     });
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
    * Callback used when the user clicks on enable notifications for a machine
160
    * Callback used when the user clicks on enable notifications for a machine
147
    *
161
    *
148
    * @param machine The machine to set notifications for
162
    * @param machine The machine to set notifications for
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
    * Adds the given notifications associated to a machine ID to the watchlist, and saves the array to the preferences
440
    * Adds the given notifications associated to a machine ID to the watchlist, and saves the array to the preferences
455
    *
441
    *
519
             autoRefreshTime={REFRESH_TIME}
505
             autoRefreshTime={REFRESH_TIME}
520
             refreshOnFocus
506
             refreshOnFocus
521
             updateData={state.machinesWatched.length}
507
             updateData={state.machinesWatched.length}
522
-            renderListHeaderComponent={this.getListHeader}
523
           />
508
           />
524
         </View>
509
         </View>
525
         <MascotPopup
510
         <MascotPopup

Loading…
Cancel
Save