Skip to content

Commit 1ce133f

Browse files
committed
Added share url to receive page
1 parent a75b789 commit 1ce133f

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/aoWebWallet/Pages/ReceivePage.razor

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,18 @@
4343
</div>
4444
</MudStack>
4545

46+
<MudText Typo="Typo.h4">From aoWebWallet</MudText>
47+
<MudStack Spacing="0" Row="true">
48+
<MudLink Href="@shareUrl" Typo="Typo.h6">
49+
@shareUrl
50+
</MudLink>
51+
<MudIconButton Class="copy-clipboard" Icon="@Icons.Material.Filled.ContentCopy" Color="Color.Default" OnClick="async () => { await ClipboardService.CopyToClipboard(shareUrl); }" />
52+
</MudStack>
53+
4654
<MudText Typo="Typo.h4">Scan QR</MudText>
4755
<MudBarcode Value="@BindingContext.QrCode" Width="200" Height="200" ForceHeight="1" BarcodeFormat="BarcodeFormat.QR_CODE" Clickable="false" />
4856
</MudStack>
57+
4958
<br />
5059
@if (BindingContext.Token != null)
5160
{
@@ -69,6 +78,7 @@
6978
public string? TokenId { get; set; }
7079

7180
public string detailUrl => $"/wallet/{Address}";
81+
public string shareUrl => NavigationManager.ToAbsoluteUri(BindingContext.ShareLink).ToString();
7282

7383

7484
protected override async Task OnParametersSetAsync()

src/aoWebWallet/Pages/ScanQrPage.razor

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555

5656
NavigationManager.NavigateTo($"/action?{aoAction.ToQueryString()}");
5757
}
58+
else
59+
{
60+
NavigationManager.NavigateTo($"/wallet/{address}");
61+
}
5862

5963
Snackbar.Add("Token type not recognized", Severity.Error);
6064
return;

src/aoWebWallet/ViewModels/ReceiveViewModel.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using aoWebWallet.Models;
22
using aoWebWallet.Services;
33
using CommunityToolkit.Mvvm.ComponentModel;
4+
using System.Net;
45

56
namespace aoWebWallet.ViewModels
67
{
@@ -24,6 +25,19 @@ public string QrCode
2425
}
2526
}
2627

28+
public string ShareLink
29+
{
30+
get
31+
{
32+
if (!string.IsNullOrWhiteSpace(TokenId))
33+
{
34+
return "/action?" + AoAction.CreateForTokenTransaction(Address, TokenId).ToQueryString();
35+
}
36+
else
37+
return $"/wallet/{Address}";
38+
}
39+
}
40+
2741
public async Task Initialize(string address, string? tokenId)
2842
{
2943
Address = address;

0 commit comments

Comments
 (0)