import { React, PropTypes, DateUtils } from 'mailspring-exports'; import { Flexbox } from 'mailspring-component-kit'; import ActivityListStore from '../../activity-list/lib/activity-list-store'; class OpenTrackingMessagePopover extends React.Component { static displayName = 'OpenTrackingMessagePopover'; static propTypes = { message: PropTypes.object, openMetadata: PropTypes.object, }; renderOpenActions() { const opens = this.props.openMetadata.open_data; return opens.map(open => { const recipients = this.props.message.to.concat( this.props.message.cc, this.props.message.bcc ); const recipient = ActivityListStore.getRecipient(open.recipient, recipients); const date = new Date(0); date.setUTCSeconds(open.timestamp); return (
{recipient ? recipient.displayName() : 'Someone'}
{DateUtils.shortTimeString(date)}
); }); } render() { return (
Opened by:
{this.renderOpenActions()}
); } } export default OpenTrackingMessagePopover;