-
Notifications
You must be signed in to change notification settings - Fork 0
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
3c25939
commit 65dd007
Showing
11 changed files
with
164 additions
and
49 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,111 @@ | ||
@page "/address-book" | ||
@using aoWebWallet.Models | ||
@inherits MvvmComponentBase<MainViewModel> | ||
@inject IDialogService DialogService | ||
@inject ISnackbar Snackbar | ||
@inject ClipboardService ClipboardService | ||
|
||
<PageTitle>Address Book - @Program.PageTitlePostFix</PageTitle> | ||
|
||
|
||
<MudContainer Class="mt-16 px-8" MaxWidth="MaxWidth.False"> | ||
|
||
|
||
<MudText Typo="Typo.h5">Address Book</MudText> | ||
|
||
<MudContainer Width="100%" Class="d-flex justify-end mb-4 pr-3 d-max-w-100"> | ||
@if (BindingContext.WalletList.Data != null && BindingContext.WalletList.Data.Any()) | ||
{ | ||
<MudTooltip Text="Add contact" Arrow="true" Placement="Placement.Left"> | ||
<MudIconButton Icon="@Icons.Material.Filled.AddCircle" aria-label="add contact" Size="Size.Large" OnClick="OpenDialog"></MudIconButton> | ||
</MudTooltip> | ||
} | ||
</MudContainer> | ||
|
||
<MudStack> | ||
@if (BindingContext.WalletList.Data != null) | ||
{ | ||
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" /> | ||
|
||
<MudStack Class="d-overflow-hidden" Justify="Justify.Center" Spacing="0"> | ||
<div Class="d-custom-2"> | ||
<MudLink Class="KodeMono tx-wrap" Href="@detailUrl" Typo="Typo.h6"> | ||
@wallet.Address | ||
</MudLink> | ||
<MudIconButton Class="copy-clipboard" Icon="@Icons.Material.Filled.ContentCopy" Color="Color.Default" OnClick="async () => { await ClipboardService.CopyToClipboard(wallet.Address); }" /> | ||
</div> | ||
<div Class="d-flex flex-row"> | ||
<MudText Typo="Typo.body2">@wallet.Name</MudText> | ||
</div> | ||
</MudStack> | ||
<MudSpacer /> | ||
@if(BindingContext.ProcessesDataList?.Data?.Where(x => x.Data?.Address == wallet.Address && (x.Data?.Processes?.Any() ?? false)).Any() ?? false) | ||
{ | ||
<MudChip>AOS</MudChip> | ||
} | ||
|
||
<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 | ||
{ | ||
<MudGrid Row="true" Justify="Justify.Center" Class="p-2"> | ||
<MudItem sm="12" xs="12"> | ||
<AddWalletComponent IsExpanded="true"></AddWalletComponent> | ||
Check warning on line 69 in src/aoWebWallet/Pages/AddressBook.razor GitHub Actions / build
Check warning on line 69 in src/aoWebWallet/Pages/AddressBook.razor GitHub Actions / build
|
||
</MudItem> | ||
</MudGrid> | ||
|
||
} | ||
} | ||
else | ||
{ | ||
<MudText Typo="Typo.h6">Loading address book...</MudText> | ||
|
||
<DataLoaderProgress DataLoader="BindingContext.WalletList.DataLoader" Title="wallets" /> | ||
} | ||
|
||
</MudStack> | ||
</MudContainer> | ||
|
||
|
||
@code | ||
{ | ||
private void OpenDialog() | ||
{ | ||
var options = new DialogOptions { CloseOnEscapeKey = true }; | ||
DialogService.Show<AddContactComponent>("Add Contact", options); | ||
} | ||
|
||
private async void DeleteWallet(Wallet wallet) | ||
{ | ||
bool? result = await DialogService.ShowMessageBox( | ||
"Warning", | ||
$"Are you sure you want to delete this contact? {wallet.Address}?", | ||
yesText: "Delete!", cancelText: "Cancel"); | ||
|
||
if (result != null) | ||
{ | ||
await BindingContext.DeleteWallet(wallet); | ||
|
||
Snackbar.Add($"Contact deleted ({wallet.Address})", Severity.Info); | ||
} | ||
StateHasChanged(); | ||
} | ||
|
||
|
||
} |
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,27 @@ | ||
using aoWebWallet.ViewModels; | ||
|
||
namespace aoWebWallet.Pages | ||
{ | ||
public partial class AddressBook : MvvmComponentBase<MainViewModel> | ||
{ | ||
protected override void OnInitialized() | ||
{ | ||
//WatchDataLoaderVM(BindingContext.TokenList); | ||
WatchDataLoaderVM(BindingContext.WalletList); | ||
WatchDataLoaderVM(BindingContext.ProcessesDataList); | ||
|
||
base.OnInitialized(); | ||
} | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
await BindingContext.LoadWalletList(); | ||
} | ||
|
||
await base.OnAfterRenderAsync(firstRender); | ||
} | ||
|
||
} | ||
} |
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
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
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
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
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