import * as React from 'react'; import {Avatar, Card, Text, withTheme} from 'react-native-paper'; import {StyleSheet, View} from "react-native"; import ProxiwashConstants from "../../constants/ProxiwashConstants"; /** * Component used to display a proxiwash item, showing machine progression and state * * @param props Props to pass to the component * @return {*} */ function ProxiwashListItem(props) { const {colors} = props.theme; let stateColors = {}; stateColors[ProxiwashConstants.machineStates.TERMINE] = colors.proxiwashFinishedColor; stateColors[ProxiwashConstants.machineStates.DISPONIBLE] = colors.proxiwashReadyColor; stateColors[ProxiwashConstants.machineStates["EN COURS"]] = colors.proxiwashRunningColor; stateColors[ProxiwashConstants.machineStates.HS] = colors.proxiwashBrokenColor; stateColors[ProxiwashConstants.machineStates.ERREUR] = colors.proxiwashErrorColor; const icon = ( props.isWatched ? : ); return ( {ProxiwashConstants.machineStates[props.state] === ProxiwashConstants.machineStates["EN COURS"] ? : null } icon} right={() => ( {props.statusText} )} /> ); } const styles = StyleSheet.create({ icon: { backgroundColor: 'transparent' }, backgroundCard: { height: '100%', position: 'absolute', left: 0, width: '100%', elevation: 0, }, progressionCard: { height: '100%', position: 'absolute', left: 0, elevation: 0, }, title: { backgroundColor: 'transparent', height: 64 } }); export default withTheme(ProxiwashListItem);