Skip to content

Commit

Permalink
Fix NumericPicker field.
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksKSoftware committed Sep 17, 2023
1 parent 92f3d5e commit 8e64a64
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
11 changes: 8 additions & 3 deletions src/Pages/ChannelRequests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@
</Feedback>
</NumericPicker>
<FieldHelp>

@($"Amount in Satoshis. Minimum {_minimumChannelCapacity:f8}. Current amount: {Math.Round(PriceConversionService.SatToUsdConversion(new Money(_amount, MoneyUnit.BTC).Satoshi, _btcPrice), 2)} USD")

@if (Constants.MAXIMUM_WITHDRAWAL_BTC_AMOUNT < _amount)
{
<span class="text-danger">@($"Amount in Satoshis. Maximum {Constants.MAXIMUM_WITHDRAWAL_BTC_AMOUNT}.")</span>
}
else
{
@($"Amount in Satoshis. Minimum {_minimumChannelCapacity:f8}. Current amount: {Math.Round(PriceConversionService.SatToUsdConversion(new Money(_amount, MoneyUnit.BTC).Satoshi, _btcPrice), 2)} USD")
}
</FieldHelp>
</Validation>
<div class="mb-3">
Expand Down
28 changes: 16 additions & 12 deletions src/Pages/Withdrawals.razor
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,22 @@
@if (!_isAmountDisabled)
{
<Validation Validator="args => ValidationHelper.ValidateWithdrawalAmount(args, _isAmountDisabled)">
<NumericPicker TValue="decimal" @bind-Value="@_amount" Disabled="_isAmountDisabled" Step="0.00001m" CurrencySymbol="" Max="@(_maxWithdrawal)" Min="_minWithdrawal" Decimals="8">
<Feedback>
<ValidationError />
</Feedback>
</NumericPicker>
<FieldHelp>
@($"Amount in Satoshis. Minimum {_minimumChannelCapacity:f8}. Current amount: {Math.Round(PriceConversionService.SatToUsdConversion(new Money(_amount, MoneyUnit.BTC).Satoshi, _btcPrice), 2)} USD")
</FieldHelp>
<NumericPicker TValue="decimal" @bind-Value="@_amount" Disabled="_isAmountDisabled" Step="0.00001m" CurrencySymbol="" Max="@(_maxWithdrawal)" Min="_minWithdrawal" Decimals="8" />
<FieldHelp>
@if (Constants.MAXIMUM_WITHDRAWAL_BTC_AMOUNT < _amount)
{
<span class="text-danger">@($"Amount in Satoshis. Maximum {Constants.MAXIMUM_WITHDRAWAL_BTC_AMOUNT}.")</span>
}
else
{
@($"Amount in Satoshis. Minimum {_minimumChannelCapacity:f8}. Current amount: {Math.Round(PriceConversionService.SatToUsdConversion(new Money(_amount, MoneyUnit.BTC).Satoshi, _btcPrice), 2)} USD")
}
</FieldHelp>
</Validation>
}
else
{
<NumericPicker TValue="decimal" Disabled="_isAmountDisabled" Value="@((decimal)context.CellValue)" ValueChanged="(value) => { context.CellValue = value; }" CurrencySymbol="SAT " Step="0.00001m"/>
<NumericPicker TValue="decimal" Disabled="_isAmountDisabled" Value="@((decimal)context.CellValue)" ValueChanged="(value) => { context.CellValue = value; }" CurrencySymbol="SAT "/>
}
<div class="mb-3">
<Button Color="Color.Primary" Disabled="@(!_selectedWalletId.HasValue)" Clicked="@OpenCoinSelectionModal">Select Coins</Button> or use
Expand Down Expand Up @@ -453,7 +456,6 @@
private Validation? _sourceNodeValidation;
private Validation? _destNodeValidation;
private Validation? _capacityValidation;

private DataGrid<WalletWithdrawalRequest>? _allRequestsDatagrid;
private UTXOSelectorModal _utxoSelectorModalRef;
private ConfirmationModal _confirmationModal;
Expand All @@ -471,7 +473,9 @@
private Dictionary<string, bool> AllRequestsColumns = new();
private bool columnsLoaded;
private decimal _selectedWalletBalance;

private bool _validationError;
private decimal _previousAmount;

public abstract class PendingWithdrawalsColumnName
{
public static readonly ColumnDefault Description = new("Description");
Expand Down Expand Up @@ -499,7 +503,7 @@
public static readonly ColumnDefault UpdateDate = new("Update Date");
public static readonly ColumnDefault Links = new("Links");
}

protected override async Task OnInitializedAsync()
{
if (LoggedUser == null) return;
Expand Down

0 comments on commit 8e64a64

Please sign in to comment.