lbry-desktop/ui/js/component/rewardLink/view.jsx

45 lines
1,023 B
React
Raw Normal View History

2017-06-08 02:56:52 +02:00
import React from "react";
import { Icon } from "component/common";
import Modal from "component/modal";
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,
errorMessage,
isClaimed,
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">
{isClaimed
2017-05-26 10:53:32 +02:00
? <span><Icon icon="icon-check" /> Reward claimed.</span>
2017-06-08 02:56:52 +02:00
: <Link
button={button ? button : "alt"}
disabled={isPending}
label={isPending ? "Claiming..." : "Claim Reward"}
onClick={() => {
claimReward(reward);
}}
/>}
{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;