wip, pending payout details

This commit is contained in:
feruz 2019-12-09 19:40:02 +02:00
parent bbeef9c9e2
commit 2d9cdfbfff
4 changed files with 65 additions and 24 deletions

View File

@ -71,7 +71,20 @@ class UpvoteContainer extends PureComponent {
? get(content, 'cashout_time') ? get(content, 'cashout_time')
: get(content, 'last_payout'), : get(content, 'last_payout'),
); );
const beneficiaries = [];
const beneficiary = get(content, 'beneficiaries');
if (beneficiaries) {
beneficiary.forEach(key => {
beneficiaries.push(
get(key, 'account') + ': ' + (parseFloat(get(key, 'weight')) / 100).toFixed(2) + '%',
);
});
}
const minimumAmountForPayout = 0.02;
let warnZeroPayout = false;
if (pendingPayout > 0 && pendingPayout < minimumAmountForPayout) {
warnZeroPayout = true;
}
return ( return (
<UpvoteView <UpvoteView
author={author} author={author}
@ -93,6 +106,8 @@ class UpvoteContainer extends PureComponent {
promotedPayout={promotedPayout} promotedPayout={promotedPayout}
totalPayout={totalPayout} totalPayout={totalPayout}
upvotePercent={upvotePercent} upvotePercent={upvotePercent}
beneficiaries={beneficiaries}
warnZeroPayout={warnZeroPayout}
/> />
); );
} }

View File

@ -200,9 +200,11 @@ class UpvoteView extends Component {
payoutDate, payoutDate,
intl, intl,
isDownVoted, isDownVoted,
beneficiaries,
warnZeroPayout,
} = this.props; } = this.props;
const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state; const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state;
console.log('pendingPayout', pendingPayout);
let iconName = 'upcircleo'; let iconName = 'upcircleo';
const iconType = 'AntDesign'; const iconType = 'AntDesign';
let downVoteIconName = 'downcircleo'; let downVoteIconName = 'downcircleo';
@ -284,31 +286,53 @@ class UpvoteView extends Component {
<View style={styles.popoverWrapper}> <View style={styles.popoverWrapper}>
{isShowDetails ? ( {isShowDetails ? (
<View> <View>
{promotedPayout > 0 && (
<Text style={styles.detailsText}> <Text style={styles.detailsText}>
{`${intl.formatMessage({ {`${intl.formatMessage({
id: 'payout.promoted', id: 'payout.promoted',
})} ${promotedPayout > 0 ? '~' : ''}$${promotedPayout}`} })} ${'~'}$${promotedPayout}`}
</Text> </Text>
)}
{pendingPayout > 0 && (
<Text style={styles.detailsText}> <Text style={styles.detailsText}>
{`${intl.formatMessage({ {`${intl.formatMessage({
id: 'payout.potential_payout', id: 'payout.potential_payout',
})} ${pendingPayout > 0 ? '~' : ''}$${pendingPayout}`} })} ${'~'}$${pendingPayout}`}
</Text> </Text>
)}
{authorPayout > 0 && (
<Text style={styles.detailsText}> <Text style={styles.detailsText}>
{`${intl.formatMessage({ {`${intl.formatMessage({
id: 'payout.author_payout', id: 'payout.author_payout',
})} ${authorPayout > 0 ? '~' : ''}$${authorPayout}`} })} ${'~'}$${authorPayout}`}
</Text> </Text>
)}
{curationPayout > 0 && (
<Text style={styles.detailsText}> <Text style={styles.detailsText}>
{`${intl.formatMessage({ {`${intl.formatMessage({
id: 'payout.curation_payout', id: 'payout.curation_payout',
})} ${curationPayout > 0 ? '~' : ''}$${curationPayout}`} })} ${'~'}$${curationPayout}`}
</Text> </Text>
)}
{beneficiaries.length > 0 && (
<Text style={styles.detailsText}>
{`${intl.formatMessage({
id: 'payout.beneficiaries',
})} ${beneficiaries}`}
</Text>
)}
<Text style={styles.detailsText}> <Text style={styles.detailsText}>
{`${intl.formatMessage({ {`${intl.formatMessage({
id: 'payout.payout_date', id: 'payout.payout_date',
})} ${payoutDate}`} })} ${payoutDate}`}
</Text> </Text>
{warnZeroPayout && (
<Text style={styles.detailsText}>
{`${intl.formatMessage({
id: 'payout.warn_zero_payout',
})}`}
</Text>
)}
</View> </View>
) : ( ) : (
<Fragment> <Fragment>

View File

@ -319,7 +319,9 @@
"promoted": "Promoted", "promoted": "Promoted",
"author_payout": "Author Payout", "author_payout": "Author Payout",
"curation_payout": "Curation Payout", "curation_payout": "Curation Payout",
"payout_date": "Payout" "payout_date": "Payout",
"beneficiaries": "Beneficiaries",
"warn_zero_payout": "Amount must reach $0.02 for payout"
}, },
"post_dropdown": { "post_dropdown": {
"copy": "copy link", "copy": "copy link",