import React from 'react'; import lbryio from 'lbryio'; import {CreditAmount, Icon} from 'component/common.js'; import SubHeader from 'component/subHeader' import {RewardLink} from 'component/reward-link'; export class RewardTile extends React.Component { static propTypes = { type: React.PropTypes.string.isRequired, title: React.PropTypes.string.isRequired, description: React.PropTypes.string.isRequired, claimed: React.PropTypes.bool.isRequired, value: React.PropTypes.number.isRequired, onRewardClaim: React.PropTypes.func } render() { return (

{this.props.title}

{this.props.claimed ? Reward claimed. : }
{this.props.description}
); } } export class RewardsPage extends React.Component { constructor(props) { super(props); this.state = { userRewards: null, failed: null, }; } componentWillMount() { this.loadRewards() } loadRewards() { lbryio.call('reward', 'list', {}).then((userRewards) => { this.setState({ userRewards: userRewards, }); }, () => { this.setState({failed: true }) }); } render() { return (
{!this.state.userRewards ? (this.state.failed ?
Failed to load rewards.
: '') : this.state.userRewards.map(({RewardType, RewardTitle, RewardDescription, TransactionID, RewardAmount}) => { return ; })}
); } } export default RewardsPage;