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

64 lines
1.8 KiB
React
Raw Normal View History

2017-12-12 00:50:22 +01:00
// @flow
2018-03-26 23:32:43 +02:00
import * as React from 'react';
import Button from 'component/button';
import CreditAmount from 'component/common/credit-amount';
import BusyIndicator from 'component/common/busy-indicator';
2017-08-20 23:42:00 +02:00
2017-12-12 00:50:22 +01:00
type Props = {
unclaimedRewardAmount: number,
fetching: boolean,
fetchRewards: () => void,
fetchRewardedContent: () => void,
2017-12-12 21:49:50 +01:00
};
2017-12-12 00:50:22 +01:00
class RewardSummary extends React.Component<Props> {
componentDidMount() {
this.props.fetchRewards();
this.props.fetchRewardedContent();
}
2017-08-20 23:42:00 +02:00
render() {
const { unclaimedRewardAmount, fetching } = this.props;
const hasRewards = unclaimedRewardAmount > 0;
return (
<section className="card card--section">
<div className="card__title">
{__('Rewards')}
{fetching && <BusyIndicator />}
</div>
<p className="card__subtitle">
{!fetching &&
(hasRewards ? (
<React.Fragment>
{__('You have')}
&nbsp;
<CreditAmount inheritStyle amount={unclaimedRewardAmount} precision={8} />
&nbsp;
{__('in unclaimed rewards')}.
</React.Fragment>
) : (
<React.Fragment>
{__('There are no rewards available at this time, please check back later')}.
</React.Fragment>
))}
</p>
<div className="card__actions">
<Button
button="primary"
navigate="/rewards"
label={hasRewards ? __('Claim Rewards') : __('View Rewards')}
/>
</div>
<p className="help help--padded">
{__('Read our')}{' '}
<Button button="link" label={__('FAQ')} href="https://lbry.io/faq/rewards" />{' '}
{__('to learn more about LBRY Rewards')}.
</p>
</section>
);
}
}
2017-08-20 23:42:00 +02:00
export default RewardSummary;