Skip to content

Commit

Permalink
Added some improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksKSoftware committed Oct 17, 2023
1 parent f5d5c50 commit fea5234
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Pages/Wallets.razor
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
</ModalContent>
</Modal>
<Modal @ref="_transferFundsModal">
<ModalContent Centered Size="ModalSize.Large ">
<ModalContent Centered Size="ModalSize.Large">
<ModalHeader>
<ModalTitle>Transfer funds to another wallet</ModalTitle>
<CloseButton/>
Expand Down Expand Up @@ -469,10 +469,10 @@
</div>
</FieldBody>
<FieldHelp class="field-help">
Current balance: @_sourceWalletBalance
@($"Current balance: {_sourceWalletBalance:F8}");
</FieldHelp>
<FieldHelp>
Balance after transfer: @CalculateAmountWalletSourceAfterTransaction():f8 BTC (@Math.Round(PriceConversionService.BtcToUsdConversion(_sourceBalanceAfterTransaction, _btcPrice), 2) USD)
@($"Balance after transfer: {CalculateAmountWalletSourceAfterTransaction():F8} BTC ({Math.Round(PriceConversionService.BtcToUsdConversion(_sourceBalanceAfterTransaction, _btcPrice), 2)} USD)")
</FieldHelp>
</Field>
</Column>
Expand All @@ -495,10 +495,10 @@
</SelectList>
</FieldBody>
<FieldHelp Visibility="@(_transferTargetWalletBalance.IsNullOrEmpty() ? Visibility.Invisible : Visibility.Visible)">
@($"Current balance: {_transferTargetWalletBalance}")
@($"Current balance: {_transferTargetWalletBalance:f8}")
</FieldHelp>
<FieldHelp Visibility="@(_transferTargetWalletBalance.IsNullOrEmpty() ? Visibility.Invisible : Visibility.Visible)">
@($"Balance after transfer: {(CalculateAmountWalletTargetAfterTransaction()):f8} BTC ({Math.Round(PriceConversionService.BtcToUsdConversion((decimal)(targetBalance + _amountToTransfer), _btcPrice), 2)} USD)")
@($"Balance after transfer: {CalculateAmountWalletTargetAfterTransaction():F8} BTC ({Math.Round(PriceConversionService.BtcToUsdConversion((decimal)(targetBalance + _amountToTransfer), _btcPrice), 2)} USD)")
</FieldHelp>
</Field>
</Validation>
Expand Down Expand Up @@ -713,11 +713,8 @@
private decimal CalculateAmountWalletTargetAfterTransaction()
{
if (_transferAllFunds)
{
return targetBalance + _sourceBalance;
}
return targetBalance + _amountToTransfer;
decimal amount = _transferAllFunds ? targetBalance + _sourceBalance : targetBalance + _amountToTransfer;
return amount;
}
private decimal CalculateAmountWalletSourceAfterTransaction()
Expand Down Expand Up @@ -1072,6 +1069,8 @@
_transferTargetWalletBalance = string.Empty;
_sourceTransferWallet = wallet;
_targetTransferWallet = null;
_selectedTransferWalletId = 0;
_amountToTransfer = Constants.MINIMUM_WITHDRAWAL_BTC_AMOUNT;
(_sourceBalance,_) = await BitcoinService.GetWalletConfirmedBalance(wallet);
_sourceWalletBalance = $"{_sourceBalance:f8} BTC ({Math.Round(PriceConversionService.BtcToUsdConversion((decimal) _sourceBalance, _btcPrice), 2)} USD)";
Expand Down

0 comments on commit fea5234

Please sign in to comment.