import React from "react";
import { BusyMessage, CreditAmount, Icon } from "component/common";
import SubHeader from "component/subHeader";
import Auth from "component/auth";
import RewardLink from "component/rewardLink";
const RewardTile = props => {
const { reward } = props;
const claimed = !!reward.transaction_id;
return (
{reward.reward_title}
{claimed
? {__("Reward claimed.")}
: }
{reward.reward_description}
);
};
class RewardsPage extends React.PureComponent {
componentDidMount() {
this.fetchRewards(this.props);
}
componentWillReceiveProps(nextProps) {
this.fetchRewards(nextProps);
}
fetchRewards(props) {
const { fetching, rewards, fetchRewards } = props;
if (!fetching && (!rewards || !rewards.length)) {
fetchRewards();
}
}
render() {
const {
fetching,
isEligible,
isVerificationCandidate,
hasEmail,
rewards,
newUserReward,
} = this.props;
let content,
isCard = false;
if (!hasEmail || isVerificationCandidate) {
content = (
{newUserReward &&
}
Welcome to LBRY
{" "}{__(
"Claim your welcome credits to be able to publish content, pay creators, and have a say over the LBRY network."
)}
);
isCard = true;
} else if (!isEligible) {
isCard = true;
content = (
{__("You are not eligible to claim rewards.")}
);
} else if (fetching) {
content = (
);
} else if (rewards.length > 0) {
content = (
{rewards.map(reward =>
)}
);
} else {
content = (
{__("Failed to load rewards.")}
);
}
return (
{isCard ? : content}
);
}
}
export default RewardsPage;