mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-06 07:34:26 +01:00
Display fiat amount previews in Transaction Details page (#6610)
* Code cleanup * Preparing model to include data needed for fiat display * Displaying fiat amount and allowing switching between it and BTC * Restoring parts removed by vibe coding * Making ToFiatAmount method work for in wider variety of cases * Tweaks for display and negative values * Calculating amounts on serverside and simplifying * Fix warnings --------- Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
{
|
||||
public bool Positive { get; set; }
|
||||
public string Destination { get; set; }
|
||||
public string Balance { get; set; }
|
||||
public StringAmounts Balance { get; set; }
|
||||
public IEnumerable<TransactionTagModel> Labels { get; set; } = new List<TransactionTagModel>();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
public int Index { get; set; }
|
||||
public string Error { get; set; }
|
||||
public bool Positive { get; set; }
|
||||
public string BalanceChange { get; set; }
|
||||
public StringAmounts BalanceChange { get; set; }
|
||||
public IEnumerable<TransactionTagModel> Labels { get; set; } = new List<TransactionTagModel>();
|
||||
}
|
||||
public class AmountViewModel
|
||||
@@ -34,7 +34,7 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
}
|
||||
public AmountViewModel ReplacementBalanceChange { get; set; }
|
||||
public bool HasErrors => Inputs.Count == 0 || Inputs.Any(i => !string.IsNullOrEmpty(i.Error));
|
||||
public string BalanceChange { get; set; }
|
||||
public StringAmounts BalanceChange { get; set; }
|
||||
public bool CanCalculateBalance { get; set; }
|
||||
public bool Positive { get; set; }
|
||||
public List<DestinationViewModel> Destinations { get; set; } = new List<DestinationViewModel>();
|
||||
@@ -50,5 +50,7 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
Inputs[(int)err.InputIndex].Error = err.Message;
|
||||
}
|
||||
}
|
||||
|
||||
public record StringAmounts(string CryptoAmount, string FiatAmount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user