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, '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 (
<UpvoteView
author={author}
@ -93,6 +106,8 @@ class UpvoteContainer extends PureComponent {
promotedPayout={promotedPayout}
totalPayout={totalPayout}
upvotePercent={upvotePercent}
beneficiaries={beneficiaries}
warnZeroPayout={warnZeroPayout}
/>
);
}

View File

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

View File

@ -319,7 +319,9 @@
"promoted": "Promoted",
"author_payout": "Author 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": {
"copy": "copy link",
@ -414,4 +416,4 @@
"information": "We noticed that your device has incorrect date or time. Please fix Date & Time or Set Automatically and try again."
}
}
}
}