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';
|
2019-09-04 23:43:37 +02:00
|
|
|
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,
|
2018-07-18 01:26:03 +02:00
|
|
|
fetching: boolean,
|
2017-12-12 21:49:50 +01:00
|
|
|
};
|
2017-12-12 00:50:22 +01:00
|
|
|
|
2018-07-18 01:26:03 +02: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
|
2020-08-26 22:28:33 +02:00
|
|
|
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')}
|
|
|
|
/>
|
2021-10-21 22:21:51 +02:00
|
|
|
<Button
|
|
|
|
button="link"
|
|
|
|
label={__('Learn more')}
|
|
|
|
href="https://odysee.com/@OdyseeHelp:b/rewards-verification:3"
|
|
|
|
/>
|
2019-11-22 22:13:00 +01:00
|
|
|
</React.Fragment>
|
2019-09-26 18:07:11 +02:00
|
|
|
}
|
|
|
|
/>
|
2018-07-18 01:26:03 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-08-20 23:42:00 +02:00
|
|
|
|
|
|
|
export default RewardSummary;
|