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'; const RewardTile = React.createClass({ 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: function() { return ( {this.props.title} {this.props.claimed ? Reward claimed. : } {this.props.description} ); } }); export let RewardsPage = React.createClass({ componentWillMount: function() { this.loadRewards() }, getInitialState: function() { return { userRewards: null, failed: null }; }, loadRewards: function() { lbryio.call('reward', 'list', {}).then((userRewards) => { this.setState({ userRewards: userRewards, }); }, () => { this.setState({failed: true }) }); }, render: function() { return ( {!this.state.userRewards ? (this.state.failed ? Failed to load rewards. : '') : this.state.userRewards.map(({RewardType, RewardTitle, RewardDescription, TransactionID, RewardAmount}) => { return ; })} ); } }); export default RewardsPage;