diff --git a/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs index e9c97da83..485c3261c 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs @@ -44,7 +44,7 @@ namespace BTCPayServer.Models.WalletViewModels public List RecommendedSatoshiPerByte { get; set; } - [Display(Name = "Fee rate (satoshi per byte)")] + [Display(Name = "Fee rate (sat/vB)")] [Required] public decimal? FeeSatoshiPerByte { get; set; } diff --git a/BTCPayServer/Views/UIWallets/CoinSelection.cshtml b/BTCPayServer/Views/UIWallets/CoinSelection.cshtml index 3270ecb5d..0dc671f12 100644 --- a/BTCPayServer/Views/UIWallets/CoinSelection.cshtml +++ b/BTCPayServer/Views/UIWallets/CoinSelection.cshtml @@ -1,6 +1,6 @@ @model WalletSendModel -
+
-
+ +
Coin selection
@@ -18,11 +23,13 @@ / {{items.length}} total (@Model.CurrentBalance @Model.CryptoCode)
-
- - + +
+ Sort by +
+ + +
-
    -
  • - « -
  • -
  • - - Showing {{pageStart+1}}-{{pageEnd}} of {{currentItems.length}} - -
  • -
  • - » -
  • -
- -
- - +
+
    +
  • + « +
  • +
  • + + Showing {{pageStart+1}}-{{pageEnd}} of {{currentItems.length}} + +
  • +
  • + » +
  • +
+
+ + +
+
+ Page Size: +
+ + + +
+
@@ -111,7 +127,8 @@ document.addEventListener("DOMContentLoaded", function () { page: 0, pageSize: 10, showSelectedOnly: false, - showUnconfirmedOnly: false + showUnconfirmedOnly: false, + sortOrder: 'amount-desc' }, watch: { filter: function() { @@ -130,7 +147,8 @@ document.addEventListener("DOMContentLoaded", function () { }, computed: { currentItems: function() { - return this.showSelectedOnly ? this.selectedItems : this.items.filter(i=> (!this.showUnconfirmedOnly || i.confirmations )); + const items = this.showSelectedOnly ? this.selectedItems : this.items.filter(i=> (!this.showUnconfirmedOnly || i.confirmations )); + return this.sorted(items); }, pageStart: function() { return this.page === 0 ? 0 : this.page * this.pageSize; @@ -199,6 +217,20 @@ document.addEventListener("DOMContentLoaded", function () { }); }, methods: { + sorted: function(items) { + switch (this.sortOrder) { + case 'amount-desc': return items.sort((a, b) => b.amount - a.amount) + case 'amount-asc': return items.sort((a, b) => a.amount - b.amount) + case 'confs-desc': return items.sort((a, b) => b.confirmations - a.confirmations) + case 'confs-asc': return items.sort((a, b) => a.confirmations - b.confirmations) + default: return items; + } + }, + sortBy: function(type) { + this.sortOrder = this.sortOrder === `${type}-desc` ? `${type}-asc` : `${type}-desc` + // reset page + this.page = 0; + }, handle: function() { if (this.selectedInputs.length == 0) { this.showSelectedOnly = false; diff --git a/BTCPayServer/Views/UIWallets/WalletSend.cshtml b/BTCPayServer/Views/UIWallets/WalletSend.cshtml index f5b79e650..29918560a 100644 --- a/BTCPayServer/Views/UIWallets/WalletSend.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletSend.cshtml @@ -37,6 +37,9 @@ border-top-right-radius: .2rem !important; border-bottom-right-radius: .2rem !important; } + .buttons .btn { + flex: 1 0 45%; + } @@ -57,7 +60,7 @@

@ViewData["Title"]

-
+ @@ -83,152 +86,101 @@ } } - - @if (Model.Outputs.Count == 1) - { -
-
- - -
-
- - -
- -
-
-
- - -
-
- - -
- -
- Your available balance is - @Model.CryptoCode. - @if (Model.ImmatureBalance > 0) - { - -
- - - @Model.ImmatureBalance @Model.CryptoCode are still immature and require additional confirmations. - -
- } -
-
-
- - - -
- } - else - { -
- @for (var index = 0; index < Model.Outputs.Count; index++) - { - -
-
-
- +
+ @for (var index = 0; index < Model.Outputs.Count; index++) + { + +
+
+
+ + @if (Model.Outputs.Count > 1) + { -
- - + }
-
- -
- - -
-
- Your available balance is - @Model.CryptoCode. - @if (Model.ImmatureBalance > 0) - { -
Note: @Model.ImmatureBalance @Model.CryptoCode are still immature and require additional confirmations.
- } -
- -
-
- - - -
-
- - - +
+ +
+
- } -
-
- - -
- } +
+ + + +
+
+ +
+ + +
+
+ Your available balance is + @Model.CryptoCode. + @if (Model.ImmatureBalance > 0) + { +
Note: @Model.ImmatureBalance @Model.CryptoCode are still immature and require additional confirmations.
+ } +
+ +
+
+ + + +
+
+ } +
+ +
+ + + Use PSBT + +
@if (Model.InputSelection) { - +
+ +
} -
- - - - +
+
+ + + + +
@if (Model.RecommendedSatoshiPerByte.Any()) { -
- - Confirm in the next - -
+
+
+ Confirm in the next … +
+
@for (var index = 0; index < Model.RecommendedSatoshiPerByte.Count; index++) { var feeRateOption = Model.RecommendedSatoshiPerByte[index]; @@ -242,16 +194,6 @@
}
- @if (Model.Outputs.Count == 1) - { -
-
- - - -
-
- }
-
-
-
- - - - - -
-
-
-
- - -
-
+
+
+ + + + + +
+
+ + +
@if (!string.IsNullOrEmpty(Model.PayJoinBIP21)) { -
+
+ - -
}
-
+
- PSBT -
- + diff --git a/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js b/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js index e2f9f5031..5188256b1 100644 --- a/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js +++ b/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js @@ -1,6 +1,15 @@ -$(function () { - initCameraScanningApp("Scan address/ payment link", data => { - $("#BIP21").val(data); - $("form").submit(); +window.addEventListener("load", () => { + let $input = null; + initCameraScanningApp("Scan address or payment link", data => { + if (data.includes('?') || $input == null) { + document.getElementById("BIP21").value = data; + document.getElementById("SendForm").submit(); + } else { + $input.value = data; + } }, "scanModal"); + document.getElementById('scanModal').addEventListener('show.bs.modal', e => { + const { index } = e.relatedTarget.dataset; + $input = index ? document.querySelector(`[name="Outputs[${index}].DestinationAddress"]`) : null; + }); });