import React from 'react'; import lbry from '../lbry.js'; import lbryio from '../lbryio.js'; import {CreditAmount, Icon} from '../component/common.js'; import rewards from '../rewards.js'; import Modal from '../component/modal.js'; import {WalletNav} from './wallet.js'; import {RewardLink} from '../component/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} ); } }); var 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;