2017-05-26 10:53:32 +02:00
|
|
|
import React from 'react';
|
|
|
|
import {Icon} from 'component/common';
|
|
|
|
import Modal from 'component/modal';
|
|
|
|
import Link from 'component/link'
|
|
|
|
|
|
|
|
const RewardLink = (props) => {
|
|
|
|
const {
|
|
|
|
reward,
|
|
|
|
button,
|
|
|
|
claimReward,
|
|
|
|
clearError,
|
2017-06-02 02:51:52 +02:00
|
|
|
errorMessage,
|
|
|
|
isClaimed,
|
|
|
|
isPending
|
2017-05-26 10:53:32 +02:00
|
|
|
} = props
|
2017-06-02 02:51:52 +02:00
|
|
|
console.log(props)
|
2017-05-26 10:53:32 +02:00
|
|
|
return (
|
|
|
|
<div className="reward-link">
|
2017-06-02 02:51:52 +02:00
|
|
|
{isClaimed
|
2017-05-26 10:53:32 +02:00
|
|
|
? <span><Icon icon="icon-check" /> Reward claimed.</span>
|
2017-06-02 02:51:52 +02:00
|
|
|
: <Link button={button ? button : 'alt'} disabled={isPending}
|
|
|
|
label={ isPending ? "Claiming..." : "Claim Reward"} onClick={() => { claimReward(reward) }} />}
|
2017-05-26 10:53:32 +02:00
|
|
|
{errorMessage ?
|
2017-06-02 02:51:52 +02:00
|
|
|
<Modal isOpen={true} contentLabel="Reward Claim Error" className="error-modal" onConfirmed={() => { clearError(reward) }}>
|
2017-05-26 10:53:32 +02:00
|
|
|
{errorMessage}
|
|
|
|
</Modal>
|
|
|
|
: ''}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
export default RewardLink
|