Skip to content

Commit

Permalink
Button styling and eval fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Apr 26, 2024
1 parent 1c03932 commit 98b07e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
16 changes: 12 additions & 4 deletions src/aoWebWallet/Pages/ActionPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@

@if (!readOnly)
{
<MudButton OnClick="Preview">Preview</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Preview">Preview</MudButton>
<MudText Color="Color.Error">@validation</MudText>
}
else if (!started && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
{
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton OnClick="Submit">Submit</MudButton>
<MudButton Color="Color.Default" Variant="Variant.Filled" OnClick="Cancel">Cancel</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">Submit</MudButton>
}

@if (transactionService.LastTransaction.DataLoader != null)
Expand All @@ -80,7 +80,7 @@
</MudText>
</MudStack>

<MudButton OnClick="ReturnToWallet">Return to wallet</MudButton>
<MudButton Color="Color.Primary" OnClick="ReturnToWallet">Return to wallet</MudButton>
}
}

Expand All @@ -91,6 +91,7 @@
{
private string? validation;
private string? selectedWallet;
private Wallet? selectedWalletObj;
private bool readOnly = false;
private bool started = false;

Expand All @@ -117,6 +118,13 @@
return;

var wallet = BindingContext.WalletList.Data.Where(x => x.Address == selectedWallet).FirstOrDefault();
if(wallet == null)
{
if(selectedWalletObj?.Address == selectedWallet)
{
wallet = selectedWalletObj;
}
}

if (wallet == null)
return;
Expand Down
8 changes: 6 additions & 2 deletions src/aoWebWallet/Pages/ActionPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ protected override void OnInitialized()
WatchDataLoaderVM(transactionService.LastTransaction);

//Auto select wallet
if(!string.IsNullOrEmpty(WalletDetailViewModel.SelectedWallet?.Wallet.Address))
selectedWallet = WalletDetailViewModel.SelectedWallet?.Wallet.Address;
if (!string.IsNullOrEmpty(WalletDetailViewModel.SelectedWallet?.Wallet.Address))
{
selectedWalletObj = WalletDetailViewModel.SelectedWallet?.Wallet;
selectedWallet = selectedWalletObj?.Address;

}

NavigationManager.LocationChanged += NavigationManager_LocationChanged;

Expand Down
7 changes: 2 additions & 5 deletions src/aoWebWallet/Services/TransactionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,16 @@ public async Task SendAction(Wallet wallet, Wallet? ownerWallet, AoAction action
await SendActionWithEvalWithArConnect(wallet.Address, action);
}

if (!string.IsNullOrEmpty(wallet.OwnerAddress) && ownerWallet?.Address == wallet.Address
if (!string.IsNullOrEmpty(wallet.OwnerAddress) && ownerWallet?.Address == wallet.OwnerAddress
&& !string.IsNullOrEmpty(ownerWallet?.Jwk))
{
Console.WriteLine("eval");

await SendActionWithEval(ownerWallet.Jwk, wallet.Address, action);

}

if (!string.IsNullOrEmpty(wallet.Jwk))
await SendActionWithJwk(wallet.Jwk, action);

Console.WriteLine("nothing");
Console.WriteLine("No Wallet to send");
return;
}

Expand Down

0 comments on commit 98b07e2

Please sign in to comment.