From e202f24592564b24376da6976ecec129d55f2fc8 Mon Sep 17 00:00:00 2001 From: d11n Date: Mon, 18 Apr 2022 03:23:32 +0200 Subject: [PATCH] Wallet view: Minor display improvements (#3647) * Label improvements * Fix erratic display bug in ToTimeAgo helper --- .../Extensions/ViewsRazor.cs | 6 +- .../Views/UIWallets/WalletTransactions.cshtml | 100 ++++++++---------- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/BTCPayServer.Abstractions/Extensions/ViewsRazor.cs b/BTCPayServer.Abstractions/Extensions/ViewsRazor.cs index e0dab593b..8f467201e 100644 --- a/BTCPayServer.Abstractions/Extensions/ViewsRazor.cs +++ b/BTCPayServer.Abstractions/Extensions/ViewsRazor.cs @@ -90,7 +90,7 @@ namespace BTCPayServer.Abstractions.Extensions public static string ToTimeAgo(this DateTimeOffset date) { var diff = DateTimeOffset.UtcNow - date; - var formatted = diff.Seconds > 0 + var formatted = diff.TotalSeconds > 0 ? $"{diff.TimeString()} ago" : $"in {diff.Negate().TimeString()}"; return formatted; @@ -113,9 +113,9 @@ namespace BTCPayServer.Abstractions.Extensions return $"{(int)timeSpan.TotalDays} day{Plural((int)timeSpan.TotalDays)}"; } - private static string Plural(int totalDays) + private static string Plural(int value) { - return totalDays > 1 ? "s" : string.Empty; + return value > 1 ? "s" : string.Empty; } } } diff --git a/BTCPayServer/Views/UIWallets/WalletTransactions.cshtml b/BTCPayServer/Views/UIWallets/WalletTransactions.cshtml index c1c9191d7..3d10d950e 100644 --- a/BTCPayServer/Views/UIWallets/WalletTransactions.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletTransactions.cshtml @@ -23,17 +23,12 @@ .switchTimeFormat { display: block; - max-width: 150px; - width: 150px; + max-width: 125px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } - .badge-container:not(:last-child) { - margin-bottom: 4px; - } - .badge-container { display: flex; flex-wrap: nowrap; @@ -52,12 +47,6 @@ background-color: transparent; border: 0; } - - .transaction-details-icon { - position: relative; - padding-left: 12px; - left: -8px; - } } @@ -78,10 +67,10 @@ @if (Model.Transactions.Any()) { -
+
@if (Model.Labels.Any()) { -
+
Filter
@foreach (var label in Model.Labels) @@ -115,7 +104,7 @@ - + Date @@ -124,7 +113,7 @@ Label Transaction Id Amount - + @@ -140,38 +129,43 @@ - @foreach (var label in transaction.Labels) + @if (transaction.Labels.Any()) { -
-
- @label.Text - -
- - -
-
- @if (!string.IsNullOrEmpty(label.Link)) +
+ @foreach (var label in transaction.Labels) { - - - Transaction details - - +
+
+ @label.Text + +
+ + +
+
+ @if (!string.IsNullOrEmpty(label.Link)) + { + + + Transaction details + + + } +
}
} @@ -190,10 +184,10 @@ @transaction.Balance } -
+