diff --git a/app/components/MessageInfoModal.js b/app/components/MessageInfoModal.js index 50f3a9e..817a49d 100644 --- a/app/components/MessageInfoModal.js +++ b/app/components/MessageInfoModal.js @@ -1,67 +1,72 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import autoBind from 'auto-bind'; import { View } from 'react-native'; import { Chip, Dialog, Portal, Text, Button, Surface, TextInput, Paragraph, DataTable } from 'react-native-paper'; import KeyboardAwareDialog from './KeyBoardAwareDialog'; const DialogType = Platform.OS === 'ios' ? KeyboardAwareDialog : Dialog; import styles from '../assets/styles/blink/_MessageInfoModal.scss'; class MessageInfoModal extends Component { constructor(props) { super(props); autoBind(this); this.state = { show: this.props.show, message: this.props.message } } UNSAFE_componentWillReceiveProps(nextProps) { this.setState({message: nextProps.message, show: nextProps.show}); } render() { if (!this.state.message) { return (null); } + let status = 'Message is on the way'; + + if (this.state.message.failed) { + status = 'Message could not be delivered'; + } else if (this.state.message.received) { + status = 'Message was read'; + } else if (this.state.message.sent) { + status = 'Message was delivered, but not read'; + } else if (this.state.message.pending) { + status = 'Message is not yet sent'; + } + return ( - Message info - - - {this.state.message.createdAt} + Status - - {this.state.message.sent ? 'Delivered' : 'Not yet delivered'} + {status} - - {this.state.message.received ? 'Read' : 'Not yet read'} - ); } } MessageInfoModal.propTypes = { show : PropTypes.bool, close : PropTypes.func.isRequired, message : PropTypes.object }; export default MessageInfoModal;