Skip to content

Commit

Permalink
Added wallet avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed May 16, 2024
1 parent 9509002 commit 30d9caf
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 410 deletions.
8 changes: 1 addition & 7 deletions src/aoWebWallet/Pages/AddressBook.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
{
if(BindingContext.WalletList.Data.Where(x => x.IsReadOnly).Any())
{
int logoCount = 1;
foreach (var wallet in BindingContext.WalletList.Data.Where(x => x.IsReadOnly))
{
string logoUrl = $"images/account--{logoCount}.svg";
string detailUrl = $"wallet/{wallet.Address}";
<MudPaper Class="pa-4">
<MudStack Row="true">
<MudAvatar Image="@logoUrl" Size="Size.Large" Class="rounded-full" />
<WalletAvatar Address="@wallet.Address" />

<MudStack Class="d-overflow-hidden" Justify="Justify.Center" Spacing="0">
<div Class="d-custom-2">
Expand All @@ -57,10 +55,6 @@
<MudIconButton Class="delete-address" Icon="@Icons.Material.Filled.Delete" aria-label="delete" OnClick="() => { DeleteWallet(wallet); }"></MudIconButton>
</MudStack>
</MudPaper>

logoCount++;
if (logoCount > 5)
logoCount = 1;
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/aoWebWallet/Pages/WalletDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<MudContainer Class="mt-8 px-8" MaxWidth="MaxWidth.False">
<MudPaper Class="pa-4 mb-4">
<MudStack Row="true">
<MudAvatar Image="@($"images/account--{BindingContext.SelectedWalletIndex}.svg")" Size="Size.Large" Class="rounded-full" />
<WalletAvatar Address="@BindingContext.SelectedWallet?.Wallet.Address" />
<MudStack style="overflow: hidden;" Justify="Justify.Center" Spacing="0">
<MudText Class="KodeMono" style="text-overflow: ellipsis; white-space: nowrap;overflow: hidden;" Typo="Typo.h6">
@Address
Expand Down
3 changes: 1 addition & 2 deletions src/aoWebWallet/Pages/Wallets.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
int logoCount = 1;
foreach (var wallet in BindingContext.WalletList.Data.Where(x => !x.IsReadOnly))
{
string logoUrl = $"images/account--{logoCount}.svg";
string detailUrl = $"wallet/{wallet.Address}";
<MudPaper Class="pa-4 wallet-list">
<MudStack Row="true">
<MudAvatar Image="@logoUrl" Size="Size.Large" Class="rounded-full" />
<WalletAvatar Address="@wallet.Address" />

<MudStack Class="d-overflow-hidden" Justify="Justify.Center" Spacing="0">
<div Class="d-custom-2">
Expand Down
9 changes: 9 additions & 0 deletions src/aoWebWallet/Shared/Components/WalletAvatar.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div style="height:50px;width:50px">
<minidenticon-svg username="@Address"></minidenticon-svg>
</div>

@code {

[Parameter]
public string? Address { get; set; }
}
12 changes: 4 additions & 8 deletions src/aoWebWallet/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
{
<MudNavLink Href="" Match="NavLinkMatch.All" Class="aoww-main-nav-text mt-2" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
<MudNavGroup Class="mt-2 mb-2" Title="Wallets" Icon="@Icons.Material.Filled.Wallet" Expanded="true">
@{
int logoCount = 1;
}
@foreach (var wallet in BindingContext.WalletList.Data?.Where(x => !x.IsReadOnly).ToList() ?? new())
{
string logoUrl = $"images/account--{logoCount}.svg";
string detailUrl = $"wallet/{wallet.Address}";
string detailUrl = $"wallet/{wallet.Address}";

<MudNavLink Class="menu-wallets" Href="@detailUrl" style="font-size:12px;" Match="NavLinkMatch.All">
<MudAvatar Image="@logoUrl" Size="Size.Small" Class="rounded-full mr-2" />
<div style="height:50px;width:50px">
<minidenticon-svg username="@wallet.Address"></minidenticon-svg>
</div>
<div>@wallet.Address.ToShortAddress()</div>
</MudNavLink>

logoCount++;
}
</MudNavGroup>
}
Expand Down
8 changes: 0 additions & 8 deletions src/aoWebWallet/ViewModels/WalletDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ public partial class WalletDetailViewModel : ObservableObject
[ObservableProperty]
public bool? hasArConnectExtension;

public int? SelectedWalletIndex { get; set; }


public WalletDetailsViewModel? SelectedWallet { get; set; }


Expand Down Expand Up @@ -194,9 +191,6 @@ private async Task SelectWallet(string? address)
if (current != null)
{
SelectedWallet = new WalletDetailsViewModel(current);
var indexOf = all.IndexOf(current);
SelectedWalletIndex = (indexOf % 5) + 1;

}
else
{
Expand All @@ -209,7 +203,6 @@ private async Task SelectWallet(string? address)
Source = WalletTypes.Explorer
};
SelectedWallet = new WalletDetailsViewModel(tempWallet);
SelectedWalletIndex = 5;
}

this.LoadBalanceDataList(address);

Check warning on line 208 in src/aoWebWallet/ViewModels/WalletDetailViewModel.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
Expand All @@ -224,7 +217,6 @@ private async Task SelectWallet(string? address)
else
{
SelectedWallet = null;
SelectedWalletIndex = null;
}
}

Expand Down
65 changes: 0 additions & 65 deletions src/aoWebWallet/wwwroot/images/account--1.svg

This file was deleted.

21 changes: 0 additions & 21 deletions src/aoWebWallet/wwwroot/images/account--2.svg

This file was deleted.

184 changes: 0 additions & 184 deletions src/aoWebWallet/wwwroot/images/account--3.svg

This file was deleted.

Loading

0 comments on commit 30d9caf

Please sign in to comment.