lbry-desktop/ui/component/rewardSummary/view.jsx

53 lines
1.5 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 I18nMessage from 'component/i18nMessage';
2019-09-26 18:07:11 +02:00
import Card from 'component/common/card';
2017-08-20 23:42:00 +02:00
2017-12-12 00:50:22 +01:00
type Props = {
unclaimedRewardAmount: number,
fetching: boolean,
2017-12-12 21:49:50 +01:00
};
2017-12-12 00:50:22 +01:00
class RewardSummary extends React.Component<Props> {
render() {
const { unclaimedRewardAmount, fetching } = this.props;
const hasRewards = unclaimedRewardAmount > 0;
return (
2019-09-26 18:07:11 +02:00
<Card
title={__('Available Rewards')}
2019-09-26 18:07:11 +02:00
subtitle={
<React.Fragment>
{fetching && __('You have...')}
{!fetching && hasRewards ? (
<I18nMessage
tokens={{
credit_amount: <CreditAmount inheritStyle amount={unclaimedRewardAmount} precision={8} />,
}}
2019-11-22 22:13:00 +01:00
f
2019-09-26 18:07:11 +02:00
>
You have %credit_amount% in unclaimed rewards.
</I18nMessage>
) : (
__('You have no rewards available.')
)}
</React.Fragment>
}
actions={
2019-11-22 22:13:00 +01:00
<React.Fragment>
2019-09-26 18:07:11 +02:00
<Button
button="primary"
navigate="/$/rewards"
label={hasRewards ? __('Claim Rewards') : __('View Rewards')}
/>
2019-11-22 22:13:00 +01:00
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" />
</React.Fragment>
2019-09-26 18:07:11 +02:00
}
/>
);
}
}
2017-08-20 23:42:00 +02:00
export default RewardSummary;