2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Icon from 'component/common/icon';
|
2017-12-21 22:08:54 +01:00
|
|
|
import RewardLink from 'component/rewardLink';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Button from 'component/button';
|
2018-09-24 05:44:42 +02:00
|
|
|
import { rewards } from 'lbryinc';
|
2018-03-26 23:32:43 +02:00
|
|
|
import * as icons from 'constants/icons';
|
2017-08-19 05:08:01 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
|
|
|
reward: {
|
|
|
|
id: string,
|
|
|
|
reward_title: string,
|
|
|
|
reward_amount: number,
|
|
|
|
transaction_id: string,
|
|
|
|
created_at: string,
|
|
|
|
reward_description: string,
|
|
|
|
reward_type: string,
|
|
|
|
},
|
|
|
|
};
|
2017-08-19 05:08:01 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
const RewardTile = (props: Props) => {
|
|
|
|
const { reward } = props;
|
2017-08-19 05:08:01 +02:00
|
|
|
const claimed = !!reward.transaction_id;
|
|
|
|
|
|
|
|
return (
|
2018-03-26 23:32:43 +02:00
|
|
|
<section className="card card--section">
|
|
|
|
<div className="card__title">{reward.reward_title}</div>
|
|
|
|
<div className="card__subtitle">{reward.reward_description}</div>
|
|
|
|
<div className="card__actions">
|
|
|
|
{reward.reward_type === rewards.TYPE_REFERRAL && (
|
|
|
|
<Button button="primary" navigate="/invite" label={__('Go To Invites')} />
|
|
|
|
)}
|
|
|
|
{reward.reward_type !== rewards.TYPE_REFERRAL &&
|
|
|
|
(claimed ? (
|
|
|
|
<span>
|
|
|
|
<Icon icon={icons.CHECK} /> {__('Reward claimed.')}
|
|
|
|
</span>
|
|
|
|
) : (
|
2018-04-23 07:17:54 +02:00
|
|
|
<RewardLink button reward_type={reward.reward_type} />
|
2018-03-26 23:32:43 +02:00
|
|
|
))}
|
2017-08-19 05:08:01 +02:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default RewardTile;
|