Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/avatar #6

Merged
merged 2 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:30px;width:30px">
<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 @@
[ObservableProperty]
public bool? hasArConnectExtension;

public int? SelectedWalletIndex { get; set; }


public WalletDetailsViewModel? SelectedWallet { get; set; }


Expand Down Expand Up @@ -97,11 +94,11 @@
await LoadSelectedWalletProcessData(address);
await LoadSelectedWalletOwnerData(address);

CheckHasArConnectExtension();

Check warning on line 97 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.

Check warning on line 97 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.

SetClaims();

Check warning on line 99 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.

Check warning on line 99 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.

mainViewModel.AddToLog(ActivityLogType.ViewAddress, address);

Check warning on line 101 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.

Check warning on line 101 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.
}

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

}
else
{
Expand All @@ -209,11 +203,10 @@
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.
this.LoadTokenTransferList(address);

Check warning on line 209 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.

if (this.SelectedWallet != null)
{
Expand All @@ -224,7 +217,6 @@
else
{
SelectedWallet = null;
SelectedWalletIndex = null;
}
}

Expand All @@ -242,7 +234,7 @@
TokenTransferList.Data = existing.Concat(allNew).OrderByDescending(x => x.Timestamp).ToList();

List<string> allTokenIds = allNew.Where(x => x.TokenId != null).Select(x => x.TokenId!).Distinct().ToList();
dataService.TryAddTokenIds(allTokenIds);

Check warning on line 237 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.

bool hasNew = false;
foreach(var token in allTokenIds)
Expand Down Expand Up @@ -285,7 +277,7 @@

await Task.Delay(50);

balanceData.BalanceDataLoader.DataLoader.LoadAsync(async () =>

Check warning on line 280 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.
{
var balanceData = await tokenClient.GetBalance(token.TokenId, address);
return balanceData;
Expand All @@ -300,11 +292,11 @@
}
}

public async Task LoadSelectedWalletProcessData(string address)

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

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
SelectedProcessData.Data = new WalletProcessDataViewModel { Address = address };

SelectedProcessData.DataLoader.LoadAsync(() =>

Check warning on line 299 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.
{
return memoryDataCache!.GetAsync($"{nameof(MainViewModel.LoadProcessesDataList)}-{address}", async () =>
{
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
Loading