import { React, PropTypes, DateUtils } from 'mailspring-exports'; import { Flexbox } from 'mailspring-component-kit'; import ActivityEventStore from '../../activity/lib/activity-event-store'; class LinkTrackingMessagePopover extends React.Component { static displayName = 'LinkTrackingMessagePopover'; static propTypes = { message: PropTypes.object, linkMetadata: PropTypes.object, }; renderClickActions() { const clicks = this.props.linkMetadata.click_data; return clicks.map(click => { const recipients = this.props.message.to.concat( this.props.message.cc, this.props.message.bcc ); const recipient = ActivityEventStore.getRecipient(click.recipient, recipients); const date = new Date(0); date.setUTCSeconds(click.timestamp); return (
{recipient ? recipient.displayName() : 'Someone'}
{DateUtils.shortTimeString(date)}
); }); } render() { return (
Clicked by:
{this.renderClickActions()}
); } } export default LinkTrackingMessagePopover;