From 0115025b8687db659993f9ff4f5d96cdf7786d4a Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 13 Sep 2019 08:27:41 +0100 Subject: [PATCH] support reward range amount --- src/component/rewardCard/view.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/component/rewardCard/view.js b/src/component/rewardCard/view.js index 0e35ab5..e5faaca 100644 --- a/src/component/rewardCard/view.js +++ b/src/component/rewardCard/view.js @@ -13,6 +13,7 @@ type Props = { id: string, reward_title: string, reward_amount: number, + reward_range?: string, transaction_id: string, created_at: string, reward_description: string, @@ -55,6 +56,20 @@ class RewardCard extends React.PureComponent { }); }; + getDisplayAmount = () => { + const { reward } = this.props; + if (reward) { + if (reward.reward_range && reward.reward_range.includes('-')) { + return reward.reward_range.split('-')[0] + '+'; // ex: 5+ + } else if (reward.reward_amount > 0) { + return reward.reward_amount; + } + } + + // unknown amount which normally shouldn't happen + return '?'; + }; + render() { const { canClaim, isPending, onClaimPress, reward } = this.props; const claimed = !!reward.transaction_id; @@ -101,7 +116,7 @@ class RewardCard extends React.PureComponent { )} - {reward.reward_amount} + {this.getDisplayAmount()} LBC