Skip to content

Commit

Permalink
ProcessPage button disabled fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Sep 16, 2024
1 parent a7fbc07 commit ffd2b8c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/aoWebWallet/Pages/ProcessPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<MudText Typo="Typo.h5">Find a process</MudText>
<MudText Typo="Typo.body1">Effortlessly call any process on AO. Simply input the process ID, and aoWebWallet will assist in constructing the call to the process.</MudText>

<MudTextField @bind-Value="inputProcessId" Label="Enter Process ID" Validation="@(new Func<string, IEnumerable<string>>(ValidateProcess))" />
<MudButton Color="Color.Primary" Disabled="string.IsNullOrWhiteSpace(inputProcessId)" OnClick="NavigateToProcess">Go to Process</MudButton>
<MudTextField @bind-Value="inputProcessId" Immediate="true" Label="Enter Process ID" Validation="@(new Func<string, IEnumerable<string>>(ValidateProcess))" />
<MudButton Color="Color.Primary" Disabled="!IsButtonEnabled(inputProcessId)" OnClick="NavigateToProcess">Go to Process</MudButton>

</MudPaper>
</MudItem>
Expand Down Expand Up @@ -119,12 +119,22 @@

public IEnumerable<string> ValidateProcess(string? input)
{
if (input == null || !AddressValidator.IsValidAddress(input))
if (input != null && !AddressValidator.IsValidAddress(input))
{
yield return "Invalid address.";
}
}

public bool IsButtonEnabled(string? input)
{
if (input != null && AddressValidator.IsValidAddress(input))
{
return true;
}

return false;
}

private async Task LoadActions()
{
if (ProcessId != null)
Expand Down

0 comments on commit ffd2b8c

Please sign in to comment.