diff --git a/src/aoWebWallet/Services/StorageService.cs b/src/aoWebWallet/Services/StorageService.cs index d690f67..95463e8 100644 --- a/src/aoWebWallet/Services/StorageService.cs +++ b/src/aoWebWallet/Services/StorageService.cs @@ -176,7 +176,7 @@ public async ValueTask SaveWallet (Wallet wallet) if(existing != null) list.Remove(existing); - list.Add(wallet); + list.Insert(0,wallet); await SaveWalletList(list); } diff --git a/src/aoWebWallet/Shared/EditWalletComponent.razor b/src/aoWebWallet/Shared/EditWalletComponent.razor index b74f1c7..c8c070f 100644 --- a/src/aoWebWallet/Shared/EditWalletComponent.razor +++ b/src/aoWebWallet/Shared/EditWalletComponent.razor @@ -4,9 +4,9 @@ - + @Progress - +
@@ -25,10 +25,20 @@ [CascadingParameter] MudDialogInstance? MudDialog { get; set; } public string? Progress { get; set; } + public string Address { get; set; } = string.Empty; + public string? Name { get; set; } - public bool IsReadOnly => !Wallet.IsReadOnly; + public bool IsReadOnly => !string.IsNullOrEmpty(Wallet.Address); + protected override void OnParametersSet() + { + Address = Wallet.Address; + Name = Wallet.Name; + + base.OnParametersSet(); + } + protected override void OnInitialized() { base.OnInitialized(); @@ -44,16 +54,21 @@ // return false; // } - if (string.IsNullOrWhiteSpace(Wallet.Address) || Wallet.Address.Length != 43) + if (string.IsNullOrWhiteSpace(Address) || Address.Length != 43) { Progress = "Length must be 43 characters."; StateHasChanged(); return false; } + Wallet.Name = Name; + Wallet.Address = Address; + await BindingContext.SaveWallet(Wallet); - Snackbar.Add($"Address saved ({Wallet.Address})", Severity.Info); + StateHasChanged(); + + Snackbar.Add($"Address saved {Wallet.Name} ({Wallet.Address})", Severity.Info); MudDialog?.Close(true); diff --git a/src/aoWebWallet/aoWebWallet.csproj b/src/aoWebWallet/aoWebWallet.csproj index 6668c35..96bd239 100644 --- a/src/aoWebWallet/aoWebWallet.csproj +++ b/src/aoWebWallet/aoWebWallet.csproj @@ -19,8 +19,8 @@ - - + +