Mailspring/app/internal_packages/link-tracking/lib/link-tracking-message-popover.jsx
Ben Gotow 251d7c44d1
Activity Summary / Insights v1 🎉
* Initial commit

* SVG-based graph components

* Add histogram, pull data into graphs

* Loading animation, timespan descriptions

* Improvements to read receipt / link tracking section

* Initial pass at subject line analysis

* Fixes to subject-line stats

* Fix theme `ui-variables` include paths

* Add “Share this report” button

* Add “Learn More” button

* Make it more clear how to edit your shortcuts

* Merge activity-list and new activity-dashboard, move in sidebar
2017-11-07 20:05:25 +01:00

44 lines
1.4 KiB
JavaScript

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 (
<Flexbox key={`${click.timestamp}`} className="click-action">
<div className="recipient">{recipient ? recipient.displayName() : 'Someone'}</div>
<div className="spacer" />
<div className="timestamp">{DateUtils.shortTimeString(date)}</div>
</Flexbox>
);
});
}
render() {
return (
<div className="link-tracking-message-popover" tabIndex="-1">
<div className="link-tracking-header">Clicked by:</div>
<div className="click-history-container">{this.renderClickActions()}</div>
</div>
);
}
}
export default LinkTrackingMessagePopover;