Fix proxiwash translations not loading
This commit is contained in:
parent
f5233c53f8
commit
da55abed8f
2 changed files with 26 additions and 26 deletions
|
@ -67,22 +67,22 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const stateStrings: {[key in MachineStates]: string} = {
|
|
||||||
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.states.ready'),
|
|
||||||
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.states.running'),
|
|
||||||
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
|
||||||
'screens.proxiwash.states.runningNotStarted',
|
|
||||||
),
|
|
||||||
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.states.finished'),
|
|
||||||
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.states.broken'),
|
|
||||||
[MachineStates.ERROR]: i18n.t('screens.proxiwash.states.error'),
|
|
||||||
[MachineStates.UNKNOWN]: i18n.t('screens.proxiwash.states.unknown'),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to display a proxiwash item, showing machine progression and state
|
* Component used to display a proxiwash item, showing machine progression and state
|
||||||
*/
|
*/
|
||||||
class ProxiwashListItem extends React.Component<PropsType> {
|
class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
|
static stateStrings: {[key in MachineStates]: string} = {
|
||||||
|
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.states.ready'),
|
||||||
|
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.states.running'),
|
||||||
|
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
||||||
|
'screens.proxiwash.states.runningNotStarted',
|
||||||
|
),
|
||||||
|
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.states.finished'),
|
||||||
|
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.states.broken'),
|
||||||
|
[MachineStates.ERROR]: i18n.t('screens.proxiwash.states.error'),
|
||||||
|
[MachineStates.UNKNOWN]: i18n.t('screens.proxiwash.states.unknown'),
|
||||||
|
};
|
||||||
|
|
||||||
stateColors: {[key: string]: string};
|
stateColors: {[key: string]: string};
|
||||||
|
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -146,7 +146,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
? `${props.item.startTime}/${props.item.endTime}`
|
? `${props.item.startTime}/${props.item.endTime}`
|
||||||
: '';
|
: '';
|
||||||
const stateIcon = ProxiwashConstants.stateIcons[machineState];
|
const stateIcon = ProxiwashConstants.stateIcons[machineState];
|
||||||
const stateString = stateStrings[machineState];
|
const stateString = ProxiwashListItem.stateStrings[machineState];
|
||||||
let progress;
|
let progress;
|
||||||
if (isRunning && props.item.donePercent !== '') {
|
if (isRunning && props.item.donePercent !== '') {
|
||||||
progress = parseFloat(props.item.donePercent) / 100;
|
progress = parseFloat(props.item.donePercent) / 100;
|
||||||
|
|
|
@ -46,18 +46,6 @@ import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import type {SectionListDataType} from '../../components/Screens/WebSectionList';
|
import type {SectionListDataType} from '../../components/Screens/WebSectionList';
|
||||||
import type {LaundromatType} from './ProxiwashAboutScreen';
|
import type {LaundromatType} from './ProxiwashAboutScreen';
|
||||||
|
|
||||||
const modalStateStrings: {[key in MachineStates]: string} = {
|
|
||||||
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.modal.ready'),
|
|
||||||
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.modal.running'),
|
|
||||||
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
|
||||||
'screens.proxiwash.modal.runningNotStarted',
|
|
||||||
),
|
|
||||||
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.modal.finished'),
|
|
||||||
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.modal.broken'),
|
|
||||||
[MachineStates.ERROR]: i18n.t('screens.proxiwash.modal.error'),
|
|
||||||
[MachineStates.UNKNOWN]: i18n.t('screens.proxiwash.modal.unknown'),
|
|
||||||
};
|
|
||||||
|
|
||||||
const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
|
const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
|
@ -98,6 +86,18 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static modalStateStrings: {[key in MachineStates]: string} = {
|
||||||
|
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.modal.ready'),
|
||||||
|
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.modal.running'),
|
||||||
|
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
||||||
|
'screens.proxiwash.modal.runningNotStarted',
|
||||||
|
),
|
||||||
|
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.modal.finished'),
|
||||||
|
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.modal.broken'),
|
||||||
|
[MachineStates.ERROR]: i18n.t('screens.proxiwash.modal.error'),
|
||||||
|
[MachineStates.UNKNOWN]: i18n.t('screens.proxiwash.modal.unknown'),
|
||||||
|
};
|
||||||
|
|
||||||
modalRef: null | Modalize;
|
modalRef: null | Modalize;
|
||||||
|
|
||||||
fetchedData: {
|
fetchedData: {
|
||||||
|
@ -205,7 +205,7 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
icon: '',
|
icon: '',
|
||||||
onPress: () => undefined,
|
onPress: () => undefined,
|
||||||
};
|
};
|
||||||
let message = modalStateStrings[item.state];
|
let message = ProxiwashScreen.modalStateStrings[item.state];
|
||||||
const onPress = () => this.onSetupNotificationsPress(item);
|
const onPress = () => this.onSetupNotificationsPress(item);
|
||||||
if (item.state === MachineStates.RUNNING) {
|
if (item.state === MachineStates.RUNNING) {
|
||||||
let remainingTime = parseInt(item.remainingTime, 10);
|
let remainingTime = parseInt(item.remainingTime, 10);
|
||||||
|
|
Loading…
Reference in a new issue