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

36 lines
870 B
React
Raw Normal View History

import React from 'react';
import Modal from 'modal/modal';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
2017-05-26 10:53:32 +02:00
2017-06-08 02:56:52 +02:00
const RewardLink = props => {
const { reward, button, claimReward, clearError, errorMessage, label, isPending } = props;
2017-06-02 17:45:37 +02:00
2018-03-26 23:32:43 +02:00
return !reward ? null : (
2017-05-26 10:53:32 +02:00
<div className="reward-link">
2018-03-26 23:32:43 +02:00
<Button
button="primary"
2017-07-20 23:35:56 +02:00
disabled={isPending}
2018-03-26 23:32:43 +02:00
label={isPending ? __('Claiming...') : label || `${__('Get')} ${reward.reward_amount} LBC`}
2017-07-20 23:35:56 +02:00
onClick={() => {
claimReward(reward);
}}
/>
2017-11-24 15:31:05 +01:00
{errorMessage ? (
<Modal
isOpen
2017-11-24 15:31:05 +01:00
contentLabel="Reward Claim Error"
className="error-modal"
onConfirmed={() => {
clearError(reward);
}}
>
{errorMessage}
</Modal>
) : (
''
2017-11-24 15:31:05 +01:00
)}
2017-05-26 10:53:32 +02:00
</div>
2017-06-08 02:56:52 +02:00
);
};
export default RewardLink;