mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-03 03:25:24 +03:00
Merge branch 'payout-details' into development
This commit is contained in:
commit
bade109ef3
@ -71,6 +71,38 @@ 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;
|
||||||
|
}
|
||||||
|
const { base, quote, sbdPrintRate } = globalProps;
|
||||||
|
const SBD_PRINT_RATE_MAX = 10000;
|
||||||
|
const percent_steem_dollars = get(content, 'percent_steem_dollars') / 20000;
|
||||||
|
const pending_payout_sbd = pendingPayout * percent_steem_dollars;
|
||||||
|
const price_per_steem = base / quote;
|
||||||
|
|
||||||
|
const pending_payout_sp = (pendingPayout - pending_payout_sbd) / price_per_steem;
|
||||||
|
const pending_payout_printed_sbd = pending_payout_sbd * (sbdPrintRate / SBD_PRINT_RATE_MAX);
|
||||||
|
const pending_payout_printed_steem =
|
||||||
|
(pending_payout_sbd - pending_payout_printed_sbd) / price_per_steem;
|
||||||
|
|
||||||
|
const breakdownPayout =
|
||||||
|
pending_payout_printed_sbd.toFixed(3) +
|
||||||
|
' SBD, ' +
|
||||||
|
pending_payout_printed_steem.toFixed(3) +
|
||||||
|
' STEEM, ' +
|
||||||
|
pending_payout_sp.toFixed(3) +
|
||||||
|
' SP';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UpvoteView
|
<UpvoteView
|
||||||
@ -93,6 +125,9 @@ class UpvoteContainer extends PureComponent {
|
|||||||
promotedPayout={promotedPayout}
|
promotedPayout={promotedPayout}
|
||||||
totalPayout={totalPayout}
|
totalPayout={totalPayout}
|
||||||
upvotePercent={upvotePercent}
|
upvotePercent={upvotePercent}
|
||||||
|
beneficiaries={beneficiaries}
|
||||||
|
warnZeroPayout={warnZeroPayout}
|
||||||
|
breakdownPayout={breakdownPayout}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -200,9 +200,11 @@ class UpvoteView extends Component {
|
|||||||
payoutDate,
|
payoutDate,
|
||||||
intl,
|
intl,
|
||||||
isDownVoted,
|
isDownVoted,
|
||||||
|
beneficiaries,
|
||||||
|
warnZeroPayout,
|
||||||
|
breakdownPayout,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state;
|
const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state;
|
||||||
|
|
||||||
let iconName = 'upcircleo';
|
let iconName = 'upcircleo';
|
||||||
const iconType = 'AntDesign';
|
const iconType = 'AntDesign';
|
||||||
let downVoteIconName = 'downcircleo';
|
let downVoteIconName = 'downcircleo';
|
||||||
@ -284,31 +286,60 @@ 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>
|
||||||
|
)}
|
||||||
|
{breakdownPayout && pendingPayout > 0 && (
|
||||||
|
<Text style={styles.detailsText}>
|
||||||
|
{`${intl.formatMessage({
|
||||||
|
id: 'payout.breakdown',
|
||||||
|
})} ${breakdownPayout}`}
|
||||||
|
</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>
|
||||||
|
@ -330,7 +330,10 @@
|
|||||||
"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",
|
||||||
|
"breakdown": "Breakdown"
|
||||||
},
|
},
|
||||||
"post_dropdown": {
|
"post_dropdown": {
|
||||||
"copy": "copy link",
|
"copy": "copy link",
|
||||||
|
@ -70,6 +70,7 @@ export const fetchGlobalProps = async () => {
|
|||||||
(parseToken(get(globalDynamic, 'total_vesting_fund_steem')) /
|
(parseToken(get(globalDynamic, 'total_vesting_fund_steem')) /
|
||||||
parseToken(get(globalDynamic, 'total_vesting_shares'))) *
|
parseToken(get(globalDynamic, 'total_vesting_shares'))) *
|
||||||
1e6;
|
1e6;
|
||||||
|
const sbdPrintRate = get(globalDynamic, 'sbd_print_rate');
|
||||||
const base = parseToken(get(feedHistory, 'current_median_history.base'));
|
const base = parseToken(get(feedHistory, 'current_median_history.base'));
|
||||||
const quote = parseToken(get(feedHistory, 'current_median_history.quote'));
|
const quote = parseToken(get(feedHistory, 'current_median_history.quote'));
|
||||||
const fundRecentClaims = get(rewardFund, 'recent_claims');
|
const fundRecentClaims = get(rewardFund, 'recent_claims');
|
||||||
@ -80,6 +81,7 @@ export const fetchGlobalProps = async () => {
|
|||||||
quote,
|
quote,
|
||||||
fundRecentClaims,
|
fundRecentClaims,
|
||||||
fundRewardBalance,
|
fundRewardBalance,
|
||||||
|
sbdPrintRate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return globalProps;
|
return globalProps;
|
||||||
|
Loading…
Reference in New Issue
Block a user