Update ui to go to proxiwash Settings

Remove the header of proxiwash screen
Add a button on proxiwash screen tool bar
This commit is contained in:
docjyJ 2020-09-10 11:54:25 +02:00
parent 83a3354d1e
commit 02e30f87cf
2 changed files with 21 additions and 33 deletions

View file

@ -59,6 +59,8 @@ class ProxiwashListItem extends React.Component<PropsType> {
title: string;
titlePopUp: string;
constructor(props: PropsType) {
super(props);
this.stateColors = {};
@ -67,7 +69,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
this.updateStateStrings();
let displayNumber = props.item.number;
const displayMaxWeight = props.item.maxWeight;
const displayMaxWeight = props.item['maxWeight '];
if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
parseInt(props.item.number, 10),
@ -76,7 +78,8 @@ class ProxiwashListItem extends React.Component<PropsType> {
this.title = props.isDryer
? i18n.t('screens.proxiwash.dryer')
: i18n.t('screens.proxiwash.washer');
this.title += `${displayNumber} - ${displayMaxWeight} kg`;
this.title += `${displayNumber}`;
this.titlePopUp = `${this.title} - ${displayMaxWeight} kg`;
}
shouldComponentUpdate(nextProps: PropsType): boolean {
@ -91,7 +94,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
onListItemPress = () => {
const {props} = this;
props.onPress(this.title, props.item, props.isDryer);
props.onPress(this.titlePopUp, props.item, props.isDryer);
};
updateStateStrings() {

View file

@ -37,7 +37,7 @@ const LIST_ITEM_HEIGHT = 64;
export type ProxiwashMachineType = {
number: string,
state: string,
maxWeight: number,
'maxWeight ': number,
startTime: string,
endTime: string,
donePercent: string,
@ -128,6 +128,11 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
iconName="information"
onPress={this.onAboutPress}
/>
<Item
title="settings"
iconName="settings"
onPress={this.onSettingsPress}
/>
</MaterialHeaderButtons>
),
});
@ -142,6 +147,15 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
navigation.navigate('proxiwash-about');
};
/**
* Callback used when pressing the settings button.
* This will open the ProxiwashSettingsScreen.
*/
onSettingsPress = () => {
const {navigation} = this.props;
navigation.navigate('proxiwash-settings');
};
/**
* Callback used when the user clicks on enable notifications for a machine
*
@ -422,34 +436,6 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
}
};
onPressCallback = () => {
const {navigation} = this.props;
navigation.navigate('proxiwash-settings');
};
getListHeader = (): React.Node => {
const {selectedWash} = this.state;
let item: LaverieType;
switch (selectedWash) {
case 'tripodeB':
item = PROXIWASH_DATA.tripodeB;
break;
default:
item = PROXIWASH_DATA.washinsa;
}
const getItemIcon = (props: ListIconPropsType): React.Node =>
ProxiwashScreen.getItemIcon(item, props);
return (
<List.Item
title={item.title}
description={item.subtitle}
left={getItemIcon}
right={ProxiwashScreen.getChevronIcon}
onPress={this.onPressCallback}
/>
);
};
/**
* Adds the given notifications associated to a machine ID to the watchlist, and saves the array to the preferences
*
@ -519,7 +505,6 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
autoRefreshTime={REFRESH_TIME}
refreshOnFocus
updateData={state.machinesWatched.length}
renderListHeaderComponent={this.getListHeader}
/>
</View>
<MascotPopup