mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
ADD: show selected coins summary on CoinControl screen
This commit is contained in:
parent
942d99b52b
commit
50910067fb
2 changed files with 17 additions and 5 deletions
|
@ -625,6 +625,7 @@
|
|||
"cc": {
|
||||
"change": "Change",
|
||||
"coins_selected": "Coins Selected ({number})",
|
||||
"selected_summ": "{value} selected",
|
||||
"empty": "This wallet doesn’t have any coins at the moment.",
|
||||
"freeze": "Freeze",
|
||||
"freezeLabel": "Freeze",
|
||||
|
|
|
@ -299,12 +299,23 @@ const CoinControl = () => {
|
|||
});
|
||||
|
||||
const tipCoins = () => {
|
||||
if (utxo.length === 0) return null;
|
||||
|
||||
let text = loc.cc.tip;
|
||||
if (selected.length > 0) {
|
||||
// show summ of coins if any selected
|
||||
const summ = selected.reduce((prev, curr) => {
|
||||
return prev + utxo.find(({ txid, vout }) => `${txid}:${vout}` === curr).value;
|
||||
}, 0);
|
||||
|
||||
const value = formatBalance(summ, wallet.getPreferredBalanceUnit(), true);
|
||||
text = loc.formatString(loc.cc.selected_summ, { value });
|
||||
}
|
||||
|
||||
return (
|
||||
utxo.length >= 1 && (
|
||||
<View style={[styles.tip, stylesHook.tip]}>
|
||||
<Text style={{ color: colors.foregroundColor }}>{loc.cc.tip}</Text>
|
||||
</View>
|
||||
)
|
||||
<View style={[styles.tip, stylesHook.tip]}>
|
||||
<Text style={{ color: colors.foregroundColor }}>{text}</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue