2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-01-09 02:15:44 +01:00
|
|
|
import Icon from 'component/icon';
|
2017-12-21 22:08:54 +01:00
|
|
|
import RewardLink from 'component/rewardLink';
|
|
|
|
import rewards from 'rewards.js';
|
2017-08-18 05:31:44 +02:00
|
|
|
|
|
|
|
class InviteList extends React.PureComponent {
|
|
|
|
render() {
|
|
|
|
const { invitees } = this.props;
|
|
|
|
|
|
|
|
if (!invitees) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section className="card">
|
|
|
|
<div className="card__title-primary">
|
2017-12-21 22:08:54 +01:00
|
|
|
<h3>{__('Invite History')}</h3>
|
2017-08-18 05:31:44 +02:00
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
2017-11-24 15:31:05 +01:00
|
|
|
{invitees.length === 0 && (
|
|
|
|
<span className="empty">{__("You haven't invited anyone.")} </span>
|
|
|
|
)}
|
|
|
|
{invitees.length > 0 && (
|
2017-08-18 05:31:44 +02:00
|
|
|
<table className="table-standard table-stretch">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2017-12-21 22:08:54 +01:00
|
|
|
<th>{__('Invitee Email')}</th>
|
|
|
|
<th className="text-center">{__('Invite Status')}</th>
|
|
|
|
<th className="text-center">{__('Reward')}</th>
|
2017-08-18 05:31:44 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2017-12-21 22:08:54 +01:00
|
|
|
{invitees.map((invitee, index) => (
|
|
|
|
<tr key={index}>
|
|
|
|
<td>{invitee.email}</td>
|
|
|
|
<td className="text-center">
|
|
|
|
{invitee.invite_accepted ? (
|
|
|
|
<Icon icon="icon-check" />
|
|
|
|
) : (
|
|
|
|
<span className="empty">{__('unused')}</span>
|
|
|
|
)}
|
|
|
|
</td>
|
|
|
|
<td className="text-center">
|
|
|
|
{invitee.invite_reward_claimed ? (
|
|
|
|
<Icon icon="icon-check" />
|
|
|
|
) : invitee.invite_reward_claimable ? (
|
|
|
|
<RewardLink label={__('claim')} reward_type={rewards.TYPE_REFERRAL} />
|
|
|
|
) : (
|
|
|
|
<span className="empty">{__('unclaimable')}</span>
|
|
|
|
)}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
))}
|
2017-08-18 05:31:44 +02:00
|
|
|
</tbody>
|
2017-11-24 15:31:05 +01:00
|
|
|
</table>
|
|
|
|
)}
|
2017-08-18 05:31:44 +02:00
|
|
|
</div>
|
2017-08-31 20:39:30 +02:00
|
|
|
<div className="card__content">
|
|
|
|
<div className="help">
|
|
|
|
{__(
|
2017-12-21 22:08:54 +01:00
|
|
|
'The maximum number of invite rewards is currently limited. Invite reward can only be claimed if the invitee passes the humanness test.'
|
2017-08-31 20:39:30 +02:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-08-18 05:31:44 +02:00
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default InviteList;
|