Skip to content

Commit c5e869f

Browse files
committed
Fix edit wallet name
1 parent 3db77e2 commit c5e869f

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

src/aoWebWallet/Services/StorageService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public async ValueTask SaveWallet (Wallet wallet)
176176
if(existing != null)
177177
list.Remove(existing);
178178

179-
list.Add(wallet);
179+
list.Insert(0,wallet);
180180

181181
await SaveWalletList(list);
182182
}

src/aoWebWallet/Shared/EditWalletComponent.razor

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
<MudPaper Class="pa-8">
66
<MudStack Spacing="2">
7-
<MudTextField @bind-Value="Wallet.Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" Label="Wallet Address" Variant="Variant.Text"></MudTextField>
7+
<MudTextField @bind-Value="Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" Label="Wallet Address" Variant="Variant.Text"></MudTextField>
88
<MudText Color="Color.Secondary">@Progress</MudText>
9-
<MudTextField @bind-Value="Wallet.Name" Label="Wallet Name" Variant="Variant.Text"></MudTextField>
9+
<MudTextField @bind-Value="Name" Label="Wallet Name" Variant="Variant.Text"></MudTextField>
1010

1111
<div Class="d-w-100 d-flex justify-end mt-2">
1212
<MudButton OnClick="Submit" Color="Color.Primary" Variant="Variant.Filled">
@@ -25,10 +25,20 @@
2525
[CascadingParameter] MudDialogInstance? MudDialog { get; set; }
2626

2727
public string? Progress { get; set; }
28+
public string Address { get; set; } = string.Empty;
29+
public string? Name { get; set; }
2830

29-
public bool IsReadOnly => !Wallet.IsReadOnly;
31+
public bool IsReadOnly => !string.IsNullOrEmpty(Wallet.Address);
3032

3133

34+
protected override void OnParametersSet()
35+
{
36+
Address = Wallet.Address;
37+
Name = Wallet.Name;
38+
39+
base.OnParametersSet();
40+
}
41+
3242
protected override void OnInitialized()
3343
{
3444
base.OnInitialized();
@@ -44,16 +54,21 @@
4454
// return false;
4555
// }
4656
47-
if (string.IsNullOrWhiteSpace(Wallet.Address) || Wallet.Address.Length != 43)
57+
if (string.IsNullOrWhiteSpace(Address) || Address.Length != 43)
4858
{
4959
Progress = "Length must be 43 characters.";
5060
StateHasChanged();
5161
return false;
5262
}
5363

64+
Wallet.Name = Name;
65+
Wallet.Address = Address;
66+
5467
await BindingContext.SaveWallet(Wallet);
5568

56-
Snackbar.Add($"Address saved ({Wallet.Address})", Severity.Info);
69+
StateHasChanged();
70+
71+
Snackbar.Add($"Address saved {Wallet.Name} ({Wallet.Address})", Severity.Info);
5772

5873
MudDialog?.Close(true);
5974

src/aoWebWallet/aoWebWallet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
2020
<PackageReference Include="BlazorWasmPreRendering.Build" Version="4.0.0" />
2121
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
22-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
23-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" PrivateAssets="all" />
22+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
23+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

0 commit comments

Comments
 (0)