2017-06-08 02:56:52 +02:00
|
|
|
import React from "react";
|
2017-08-18 19:09:40 +02:00
|
|
|
import Modal from "modal/modal";
|
2017-06-08 02:56:52 +02:00
|
|
|
import Link from "component/link";
|
2017-05-26 10:53:32 +02:00
|
|
|
|
2017-06-08 02:56:52 +02:00
|
|
|
const RewardLink = props => {
|
2017-05-26 10:53:32 +02:00
|
|
|
const {
|
|
|
|
reward,
|
|
|
|
button,
|
|
|
|
claimReward,
|
|
|
|
clearError,
|
2017-06-02 02:51:52 +02:00
|
|
|
errorMessage,
|
2017-08-25 21:51:54 +02:00
|
|
|
label,
|
2017-06-08 02:56:52 +02:00
|
|
|
isPending,
|
|
|
|
} = props;
|
2017-06-02 17:45:37 +02:00
|
|
|
|
2017-05-26 10:53:32 +02:00
|
|
|
return (
|
|
|
|
<div className="reward-link">
|
2017-07-20 23:35:56 +02:00
|
|
|
<Link
|
2017-08-26 05:21:26 +02:00
|
|
|
button={button}
|
2017-07-20 23:35:56 +02:00
|
|
|
disabled={isPending}
|
2017-08-25 21:51:54 +02:00
|
|
|
label={
|
|
|
|
isPending ? __("Claiming...") : label ? label : __("Claim Reward")
|
|
|
|
}
|
2017-07-20 23:35:56 +02:00
|
|
|
onClick={() => {
|
|
|
|
claimReward(reward);
|
|
|
|
}}
|
|
|
|
/>
|
2017-06-08 02:56:52 +02:00
|
|
|
{errorMessage
|
|
|
|
? <Modal
|
|
|
|
isOpen={true}
|
|
|
|
contentLabel="Reward Claim Error"
|
|
|
|
className="error-modal"
|
|
|
|
onConfirmed={() => {
|
|
|
|
clearError(reward);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{errorMessage}
|
|
|
|
</Modal>
|
|
|
|
: ""}
|
2017-05-26 10:53:32 +02:00
|
|
|
</div>
|
2017-06-08 02:56:52 +02:00
|
|
|
);
|
|
|
|
};
|
|
|
|
export default RewardLink;
|