|
@@ -5,9 +5,11 @@ import ProxiwashConstants from "../../../constants/ProxiwashConstants";
|
5
|
5
|
import i18n from "i18n-js";
|
6
|
6
|
import AprilFoolsManager from "../../../managers/AprilFoolsManager";
|
7
|
7
|
import * as Animatable from "react-native-animatable";
|
|
8
|
+import type {CustomTheme} from "../../../managers/ThemeManager";
|
8
|
9
|
|
9
|
10
|
type Props = {
|
10
|
11
|
item: Object,
|
|
12
|
+ theme: CustomTheme,
|
11
|
13
|
onPress: Function,
|
12
|
14
|
isWatched: boolean,
|
13
|
15
|
isDryer: boolean,
|
|
@@ -53,20 +55,24 @@ class ProxiwashListItem extends React.Component<Props> {
|
53
|
55
|
}
|
54
|
56
|
|
55
|
57
|
updateStateStrings() {
|
56
|
|
- this.stateStrings[ProxiwashConstants.machineStates.TERMINE] = i18n.t('proxiwashScreen.states.finished');
|
57
|
|
- this.stateStrings[ProxiwashConstants.machineStates.DISPONIBLE] = i18n.t('proxiwashScreen.states.ready');
|
58
|
|
- this.stateStrings[ProxiwashConstants.machineStates["EN COURS"]] = i18n.t('proxiwashScreen.states.running');
|
59
|
|
- this.stateStrings[ProxiwashConstants.machineStates.HS] = i18n.t('proxiwashScreen.states.broken');
|
60
|
|
- this.stateStrings[ProxiwashConstants.machineStates.ERREUR] = i18n.t('proxiwashScreen.states.error');
|
|
58
|
+ this.stateStrings[ProxiwashConstants.machineStates.AVAILABLE] = i18n.t('proxiwashScreen.states.ready');
|
|
59
|
+ this.stateStrings[ProxiwashConstants.machineStates.RUNNING] = i18n.t('proxiwashScreen.states.running');
|
|
60
|
+ this.stateStrings[ProxiwashConstants.machineStates.RUNNING_NOT_STARTED] = i18n.t('proxiwashScreen.states.runningNotStarted');
|
|
61
|
+ this.stateStrings[ProxiwashConstants.machineStates.FINISHED] = i18n.t('proxiwashScreen.states.finished');
|
|
62
|
+ this.stateStrings[ProxiwashConstants.machineStates.UNAVAILABLE] = i18n.t('proxiwashScreen.states.broken');
|
|
63
|
+ this.stateStrings[ProxiwashConstants.machineStates.ERROR] = i18n.t('proxiwashScreen.states.error');
|
|
64
|
+ this.stateStrings[ProxiwashConstants.machineStates.UNKNOWN] = i18n.t('proxiwashScreen.states.unknown');
|
61
|
65
|
}
|
62
|
66
|
|
63
|
67
|
updateStateColors() {
|
64
|
68
|
const colors = this.props.theme.colors;
|
65
|
|
- this.stateColors[ProxiwashConstants.machineStates.TERMINE] = colors.proxiwashFinishedColor;
|
66
|
|
- this.stateColors[ProxiwashConstants.machineStates.DISPONIBLE] = colors.proxiwashReadyColor;
|
67
|
|
- this.stateColors[ProxiwashConstants.machineStates["EN COURS"]] = colors.proxiwashRunningColor;
|
68
|
|
- this.stateColors[ProxiwashConstants.machineStates.HS] = colors.proxiwashBrokenColor;
|
69
|
|
- this.stateColors[ProxiwashConstants.machineStates.ERREUR] = colors.proxiwashErrorColor;
|
|
69
|
+ this.stateColors[ProxiwashConstants.machineStates.AVAILABLE] = colors.proxiwashReadyColor;
|
|
70
|
+ this.stateColors[ProxiwashConstants.machineStates.RUNNING] = colors.proxiwashRunningColor;
|
|
71
|
+ this.stateColors[ProxiwashConstants.machineStates.RUNNING_NOT_STARTED] = colors.proxiwashRunningNotStartedColor;
|
|
72
|
+ this.stateColors[ProxiwashConstants.machineStates.FINISHED] = colors.proxiwashFinishedColor;
|
|
73
|
+ this.stateColors[ProxiwashConstants.machineStates.UNAVAILABLE] = colors.proxiwashBrokenColor;
|
|
74
|
+ this.stateColors[ProxiwashConstants.machineStates.ERROR] = colors.proxiwashErrorColor;
|
|
75
|
+ this.stateColors[ProxiwashConstants.machineStates.UNKNOWN] = colors.proxiwashUnknownColor;
|
70
|
76
|
}
|
71
|
77
|
|
72
|
78
|
onListItemPress = () => this.props.onPress(this.title, this.props.item, this.props.isDryer);
|
|
@@ -75,14 +81,14 @@ class ProxiwashListItem extends React.Component<Props> {
|
75
|
81
|
const props = this.props;
|
76
|
82
|
const colors = props.theme.colors;
|
77
|
83
|
const machineState = props.item.state;
|
78
|
|
- const isRunning = ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates["EN COURS"];
|
79
|
|
- const isReady = ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates.DISPONIBLE;
|
|
84
|
+ const isRunning = machineState === ProxiwashConstants.machineStates.RUNNING;
|
|
85
|
+ const isReady = machineState === ProxiwashConstants.machineStates.AVAILABLE;
|
80
|
86
|
const description = isRunning ? props.item.startTime + '/' + props.item.endTime : '';
|
81
|
87
|
const stateIcon = ProxiwashConstants.stateIcons[machineState];
|
82
|
|
- const stateString = this.stateStrings[ProxiwashConstants.machineStates[machineState]];
|
|
88
|
+ const stateString = this.stateStrings[machineState];
|
83
|
89
|
const progress = isRunning
|
84
|
90
|
? props.item.donePercent !== ''
|
85
|
|
- ? parseInt(props.item.donePercent) / 100
|
|
91
|
+ ? parseFloat(props.item.donePercent) / 100
|
86
|
92
|
: 0
|
87
|
93
|
: 1;
|
88
|
94
|
|
|
@@ -123,7 +129,7 @@ class ProxiwashListItem extends React.Component<Props> {
|
123
|
129
|
height: props.height
|
124
|
130
|
}}
|
125
|
131
|
progress={progress}
|
126
|
|
- color={this.stateColors[ProxiwashConstants.machineStates[machineState]]}
|
|
132
|
+ color={this.stateColors[machineState]}
|
127
|
133
|
/>
|
128
|
134
|
: null
|
129
|
135
|
}
|
|
@@ -140,7 +146,7 @@ class ProxiwashListItem extends React.Component<Props> {
|
140
|
146
|
<View style={{flexDirection: 'row',}}>
|
141
|
147
|
<View style={{justifyContent: 'center',}}>
|
142
|
148
|
<Text style={
|
143
|
|
- ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates.TERMINE ?
|
|
149
|
+ machineState === ProxiwashConstants.machineStates.FINISHED ?
|
144
|
150
|
{fontWeight: 'bold',} : {}}
|
145
|
151
|
>
|
146
|
152
|
{stateString}
|