diff --git a/app/components/HistoryCard.js b/app/components/HistoryCard.js
index bd3654f..f024a3f 100644
--- a/app/components/HistoryCard.js
+++ b/app/components/HistoryCard.js
@@ -1,84 +1,102 @@
import React from 'react';
import { View } from 'react-native';
import PropTypes from 'prop-types';
import moment from 'moment';
import momentFormat from 'moment-duration-format';
-import { Card, IconButton, Caption, Subheading } from 'react-native-paper';
+import { Card, IconButton, Caption, Title, Subheading } from 'react-native-paper';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import styles from '../assets/styles/blink/_HistoryCard.scss';
import UserIcon from './UserIcon';
const HistoryCard = (props) => {
const identity = {
displayName: props.historyItem.displayName,
uri: props.historyItem.remoteParty || props.historyItem
}
const startVideoCall = (e) => {
e.stopPropagation();
props.setTargetUri(identity.uri);
// We need to wait for targetURI
setImmediate(() => {
props.startVideoCall(e);
});
}
const startAudioCall = (e) => {
e.stopPropagation();
props.setTargetUri(identity.uri);
// We need to wait for targetURI
setImmediate(() => {
props.startAudioCall(e);
});
}
let duration = moment.duration(props.historyItem.duration, 'seconds').format('hh:mm:ss', {trim: false});
let color = {};
if (props.historyItem.direction === 'received' && props.historyItem.duration === 0) {
color.color = '#a94442';
duration = 'missed';
+ } else if (props.historyItem.direction === 'placed' && props.historyItem.duration === 0) {
+ color.color = 'orange';
+ duration = 'cancelled';
}
const name = identity.displayName || identity.uri;
+ let title = identity.displayName || identity.uri;
+ let subtitle = identity.uri + ' (' + duration + ')';
+
+ if (!identity.displayName) {
+ title = identity.uri;
+ if (duration === 'missed') {
+ subtitle = 'Last call missed';
+ } else if (duration === 'cancelled') {
+ subtitle = 'Last call cancelled';
+ } else {
+ subtitle = 'Last call duration ' + duration ;
+ }
+ }
+
return (
{props.setTargetUri(identity.uri)}}
onLongPress={startVideoCall}
style={styles.container}
>
- {name} ({duration})
+ {title}
+ {subtitle}
{props.historyItem.startTime}
);
/*
*/
}
HistoryCard.propTypes = {
historyItem : PropTypes.object,
startAudioCall : PropTypes.func.isRequired,
startVideoCall : PropTypes.func.isRequired,
setTargetUri : PropTypes.func.isRequired
};
export default HistoryCard;