-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8579c6
commit 20c7b78
Showing
13 changed files
with
315 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@using BTCPayApp.UI.Models | ||
|
||
<a href="@Routes.InvoicePath(Id)" class="invoice list-group-item list-group-item-action d-flex align-items-center gap-3 py-3 px-4"> | ||
<div class="d-flex align-items-baseline justify-content-between flex-wrap flex-grow-1 gap-2"> | ||
<DateDisplay DateTimeOffset="@Date" Format="DateDisplay.DateDisplayFormat.Localized"/> | ||
<TruncateCenter Text="@OrderId"></TruncateCenter> | ||
<span class="amount">@Amount @Currency</span> | ||
<div class="badge-container"> | ||
<span class="badge badge-@State">@State</span> | ||
</div> | ||
</div> | ||
<Icon symbol="caret-right"/> | ||
</a> | ||
|
||
@code { | ||
[Parameter] | ||
public string? Id { get; set; } | ||
|
||
[Parameter] | ||
public string? OrderId { get; set; } | ||
|
||
[Parameter] | ||
public string? Status { get; set; } | ||
|
||
[Parameter] | ||
public DateTimeOffset Date { get; set; } | ||
|
||
[Parameter] | ||
public string? Currency { get; set; } | ||
|
||
[Parameter] | ||
public decimal Amount { get; set; } | ||
|
||
[Parameter] | ||
public Invoice Invoice { | ||
set | ||
{ | ||
Id = value.Id; | ||
OrderId = value.OrderId; | ||
Status = value.Status; | ||
Date = value.Date; | ||
Currency = value.Currency; | ||
Amount = value.Amount; | ||
} | ||
} | ||
|
||
private string State => Status?.ToLowerInvariant() ?? "unknown"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.invoice .badge-container { | ||
flex: 0 0 5.125rem; | ||
text-align: right; | ||
} | ||
|
||
@media (max-width: 359px) { | ||
.invoice .badge-container { | ||
flex-grow: 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<span class="truncate-center truncate-center-id @(Copy ? "truncate-center--copy" : null)"> | ||
<span class="truncate-center-truncated" data-bs-toggle="@(IsTruncated ? "tooltip" : null)" title="@(IsTruncated ? Text : null)"> | ||
<span class="truncate-center-start">@(IsTruncated ? $"{Start}…" : Text)</span> | ||
@if (IsTruncated) | ||
{ | ||
<span class="truncate-center-end">@End</span> | ||
} | ||
</span> | ||
<span class="truncate-center-text">@Text</span> | ||
@if (Copy) | ||
{ | ||
<button type="button" class="btn btn-link p-0" data-clipboard="@Text"> | ||
<Icon Symbol="copy" /> | ||
</button> | ||
} | ||
@if (!string.IsNullOrEmpty(Link)) | ||
{ | ||
<a href="@Link" rel="noreferrer noopener" target="@(Link.StartsWith("http") ? "_blank" : null)"> | ||
<Icon Symbol="info" /> | ||
</a> | ||
} | ||
</span> | ||
|
||
@code { | ||
[Parameter, EditorRequired] | ||
public string? Text { get; set; } | ||
|
||
[Parameter] | ||
public string? Link { get; set; } | ||
|
||
[Parameter] | ||
public int Padding { get; set; } = 7; | ||
|
||
[Parameter] | ||
public bool Copy { get; set; } | ||
|
||
private bool IsTruncated => !string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End); | ||
|
||
private string? Start => Text?.Length > 2 * Padding ? Text[..Padding] : null; | ||
private string? End => Text?.Length > 2 * Padding ? Text[^Padding..] : null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.truncate-center { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: var(--btcpay-space-s); | ||
max-width: 100%; | ||
} | ||
|
||
.truncate-center-end, | ||
.truncate-center-start { | ||
white-space: nowrap; | ||
} | ||
|
||
.truncate-center-id { | ||
font-family: var(--btcpay-font-monospace); | ||
font-size: .875em; | ||
} | ||
|
||
.truncate-center-text { | ||
word-wrap: break-word; | ||
word-break: break-word; | ||
} | ||
|
||
.truncate-center a, | ||
.truncate-center button { | ||
line-height: 1; | ||
} | ||
|
||
.truncate-center-truncated { | ||
text-align: left; | ||
display: inline-flex; | ||
max-width: 100%; | ||
} | ||
|
||
.truncate-center button.btn .icon { | ||
--icon-size: 1rem; | ||
} | ||
|
||
.truncate-center.form-control-plaintext { | ||
padding-right: 3px; | ||
} | ||
|
||
.truncate-center.form-control-plaintext button.btn .icon { | ||
--icon-size: 1.25rem; | ||
} | ||
|
||
.truncate-center-id { | ||
background: var(--btcpay-neutral-100); | ||
border: 1px solid var(--btcpay-neutral-200); | ||
border-radius: var(--btcpay-border-radius-l); | ||
padding: var(--btcpay-space-xs) var(--btcpay-space-s); | ||
} | ||
|
||
.truncate-center-text { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace BTCPayApp.UI.Models; | ||
|
||
public class Invoice | ||
{ | ||
public string? Id { get; set; } | ||
public string? OrderId { get; set; } | ||
public string? Status { get; set; } | ||
public DateTimeOffset Date { get; set; } | ||
public string? Currency { get; set; } | ||
public decimal Amount { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace BTCPayApp.UI.Models; | ||
|
||
public class Notification | ||
{ | ||
public string? Id { get; set; } | ||
public string? Type { get; set; } | ||
public DateTimeOffset Created { get; set; } | ||
public string? Body { get; set; } | ||
public bool Seen { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@attribute [Route(Routes.Invoice)] | ||
@using BTCPayApp.UI.Components.Layout | ||
@using BTCPayApp.UI.Models | ||
@inherits Fluxor.Blazor.Web.Components.FluxorComponent | ||
|
||
<PageTitle>@GetTitle()</PageTitle> | ||
|
||
<SectionContent SectionName="top"> | ||
<Titlebar Back="@Routes.Invoices"> | ||
<h1>@GetTitle()</h1> | ||
</Titlebar> | ||
</SectionContent> | ||
|
||
<section class="container"> | ||
<div class="invoice"> | ||
ID: @Model.Invoice.Id | ||
</div> | ||
</section> | ||
|
||
@code { | ||
[Parameter, EditorRequired] | ||
public string? InvoiceId { get; set; } | ||
|
||
private InvoiceModel Model { get; set; } = new(); | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
Model.Invoice = new Invoice | ||
{ | ||
Id = InvoiceId, | ||
OrderId = "CDOy6cOibCWEdsRiZuaHf8dSG", | ||
Date = DateTimeOffset.Now - TimeSpan.FromSeconds(21), | ||
Status = "Settled", | ||
Currency = "USD", | ||
Amount = 61.5m | ||
}; | ||
} | ||
|
||
private class InvoiceModel | ||
{ | ||
public Invoice Invoice { get; set; } | ||
} | ||
|
||
private string GetTitle() => $"Invoice {Model.Invoice.Id}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@attribute [Route(Routes.Invoices)] | ||
@using BTCPayApp.UI.Components.Layout | ||
@using BTCPayApp.UI.Models | ||
@inherits Fluxor.Blazor.Web.Components.FluxorComponent | ||
|
||
<PageTitle>Invoices</PageTitle> | ||
|
||
<SectionContent SectionName="top"> | ||
<Titlebar Back="@Routes.Dashboard"> | ||
<h1>Invoices</h1> | ||
</Titlebar> | ||
</SectionContent> | ||
|
||
<section> | ||
@if (Model.Invoices.Any()) | ||
{ | ||
<div class="list-group list-group-flush"> | ||
@foreach (var i in Model.Invoices) | ||
{ | ||
<InvoiceItem Invoice="@i"/> | ||
} | ||
</div> | ||
} | ||
else | ||
{ | ||
<p class="text-muted">There are no invoices, yet.</p> | ||
} | ||
</section> | ||
|
||
@code { | ||
private InvoicesModel Model { get; set; } = new(); | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
Model.Invoices = | ||
[ | ||
new Invoice | ||
{ | ||
Id = "CDOy6cOibCWEdsRiZuaHf8dSG", | ||
OrderId = "1", | ||
Date = DateTimeOffset.Now - TimeSpan.FromSeconds(21), | ||
Status = "Settled", | ||
Currency = "USD", | ||
Amount = 61.5m | ||
}, | ||
new Invoice | ||
{ | ||
Id = "jRY5cKmdYQrS6zu863wEFXtn4", | ||
OrderId = "2", | ||
Date = DateTimeOffset.Now - TimeSpan.FromHours(6), | ||
Status = "Processing", | ||
Currency = "SATS", | ||
Amount = 210000m | ||
}, | ||
new Invoice | ||
{ | ||
Id = "RNuhcG8UUGJRYuBGCNuhcG8", | ||
OrderId = "3", | ||
Date = DateTimeOffset.Now - TimeSpan.FromDays(3), | ||
Status = "Expired", | ||
Currency = "USD", | ||
Amount = 6.15m | ||
} | ||
]; | ||
} | ||
|
||
private class InvoicesModel | ||
{ | ||
public Invoice[] Invoices { get; set; } = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters