lbry-desktop/src/renderer/component/rewardTile/view.jsx

47 lines
1.3 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import React from 'react';
2018-03-26 23:32:43 +02:00
import Icon from 'component/common/icon';
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';
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,
},
};
2018-03-26 23:32:43 +02:00
const RewardTile = (props: Props) => {
const { reward } = props;
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>
) : (
<RewardLink button reward_type={reward.reward_type} />
2018-03-26 23:32:43 +02:00
))}
</div>
</section>
);
};
export default RewardTile;