Skip to content

Commit

Permalink
Merge pull request #9 from michielpost/feature/meme-frames
Browse files Browse the repository at this point in the history
Meme Frames
  • Loading branch information
michielpost authored Jun 23, 2024
2 parents 9598a2d + 15511a5 commit 8e0e3c7
Show file tree
Hide file tree
Showing 28 changed files with 1,020 additions and 141 deletions.
7 changes: 7 additions & 0 deletions src/aoWebWallet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoww.Services.Tests", "aoww
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoWebWallet.Tests", "aoWebWallet.Tests\aoWebWallet.Tests.csproj", "{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aoww.ProcesModels", "aoww.ProcesModels\aoww.ProcesModels.csproj", "{739E7471-30E4-4522-86B8-5D9BB5F0896A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -43,6 +45,10 @@ Global
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Release|Any CPU.Build.0 = Release|Any CPU
{739E7471-30E4-4522-86B8-5D9BB5F0896A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{739E7471-30E4-4522-86B8-5D9BB5F0896A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{739E7471-30E4-4522-86B8-5D9BB5F0896A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{739E7471-30E4-4522-86B8-5D9BB5F0896A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -52,6 +58,7 @@ Global
{178C3213-D574-4B39-A2DA-1FB1D2806242} = {06E5BC39-764A-48B9-B4F9-F48387A2C965}
{322F4807-05CF-431D-B400-7420E1B29936} = {89AC47DF-65AD-4870-AA1D-74ABF1F3D8FE}
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D} = {89AC47DF-65AD-4870-AA1D-74ABF1F3D8FE}
{739E7471-30E4-4522-86B8-5D9BB5F0896A} = {06E5BC39-764A-48B9-B4F9-F48387A2C965}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {432E3F8E-53FF-4D9C-869D-48449BD3B8B4}
Expand Down
1 change: 1 addition & 0 deletions src/aoWebWallet/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public static class Constants
{
public static string AoTokenId => "m3PaWzK4PTG9lAaqYQPaPdOcXdO8hYqi5Fe9NWqXd0w";
public static string CredTokenId => "Sa0iBLPNyJQrwpTTG-tWLQU-1QeUAJA73DdxGGiKoJc";
}
}
22 changes: 22 additions & 0 deletions src/aoWebWallet/Extensions/AoActionParamExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using aoww.ProcesModels.Action;

namespace aoWebWallet.Extensions
{
public static class AcActionParamExtensions
{
public static List<ArweaveBlazor.Models.Tag> ToEvalTags(this AoAction action)
{
return action.Params.Select(x => new ArweaveBlazor.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}

public static List<ArweaveBlazor.Models.Tag> ToTags(this AoAction action)
{
return action.AllWithoutTarget.Select(x => new ArweaveBlazor.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}

public static List<ArweaveAO.Models.Tag> ToDryRunTags(this AoAction action)
{
return action.AllWithoutTarget.Select(x => new ArweaveAO.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}
}
}
101 changes: 43 additions & 58 deletions src/aoWebWallet/Pages/ActionPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,34 @@
@inject TokenDataService dataService
@inject TransactionService transactionService;
@inject WalletDetailViewModel WalletDetailViewModel
@using Soenneker.Blazor.Utils.Navigation.Abstract
@inject INavigationUtil NavigationUtil

<PageTitle>@Program.PageTitlePostFix</PageTitle>


<MudContainer Class="mt-2 px-8" MaxWidth="MaxWidth.False">
<MudBreadcrumbs Class="breadcrumbs-aoww mb-4" Items="_items"></MudBreadcrumbs>

<MudStack>
@if (BindingContext.WalletList.Data != null)
{
var sendWallets = BindingContext.WalletList.Data.Where(x => !x.IsReadOnly).ToList();
if (!sendWallets.Any())
{
<MudButton aria-label="add wallet" Size="Size.Large" OnClick="OpenDialog">Add Wallet</MudButton>
}
else
{
<MudSelect @bind-Value="@selectedWallet" Label="Select a wallet" Class="mb-4 wallet-item-background" Variant="Variant.Outlined" ReadOnly="@readOnly">
@foreach (var wallet in sendWallets ?? new())
{
<MudSelectItem Value="@wallet.Address" Class="wallet-item-background">
<MudStack Row="true">
@* <MudAvatar Image="@logoUrl" Size="Size.Large" Class="rounded-full" /> *@
<MudStack style="overflow: hidden;" Justify="Justify.Center" Spacing="0">
<div style="display:flex; white-space: nowrap;">
<MudText Class="KodeMono" style="text-overflow: ellipsis; white-space: nowrap;overflow: hidden;" Typo="Typo.h6">
@wallet.Address
</MudText>
</div>
<div style="display:flex; flex-direction:row;padding-top:5px;">
<MudText Typo="Typo.body2">@wallet.Name</MudText>
</div>
</MudStack>
</MudStack>

</MudSelectItem>
}
</MudSelect>
}
}

</MudStack>
<SelectActiveWalletComponent ReadOnly="readOnly" />

@if(readOnly)
@if (readOnly)
{
<MudText>Please review your transaction:</MudText>
}

<ActionEditor AoAction="@AoAction" ReadOnly="@readOnly" Address="@selectedWallet" />
<ActionEditor AoAction="@AoAction" ReadOnly="@readOnly" Address="@BindingContext.ActiveWalletAddress" />

@if (!readOnly && !string.IsNullOrEmpty(selectedWallet))
@if (!readOnly && !string.IsNullOrEmpty(BindingContext.ActiveWalletAddress))
{
if (NavigationUtil.CanNavigateBack)
{
<MudButton Color="Color.Secondary" Variant="Variant.Filled" OnClick="NavigationUtil.NavigateBack" Class="mt-8">Back</MudButton>
}
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Preview" Class="mt-8">Preview</MudButton>
<MudText Color="Color.Error">@validation</MudText>
}
else if (!started && !string.IsNullOrEmpty(selectedWallet) && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
else if (!started && !string.IsNullOrEmpty(BindingContext.ActiveWalletAddress) && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
{
<SendTransactionProgress DataLoader="transactionService.DryRunResult.DataLoader" Title="Getting dry run result..." />
if (transactionService.DryRunResult.Data != null)
Expand All @@ -81,14 +53,26 @@
}
</MudCardContent>
@* <MudCardActions>
<MudButton Variant="Variant.Text" Color="Color.Primary">Learn More</MudButton>
</MudCardActions> *@
<MudButton Variant="Variant.Text" Color="Color.Primary">Learn More</MudButton>
</MudCardActions> *@
</MudCard>
}

if (NavigationUtil.CanNavigateBack)
{
<MudButton Color="Color.Secondary" Variant="Variant.Filled" OnClick="NavigationUtil.NavigateBack" Class="mt-8">Back</MudButton>
}
<MudButton Class="px-12 mt-8 mr-2" Color="Color.Default" Variant="Variant.Filled" OnClick="Cancel">Cancel</MudButton>
<MudButton Class="px-12 mt-8" Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">Submit</MudButton>
}
else if (transactionService.LastTransaction.DataLoader.LoadingState == LoadingState.None && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
{
if (NavigationUtil.CanNavigateBack)
{
<MudButton Color="Color.Secondary" Variant="Variant.Filled" OnClick="NavigationUtil.NavigateBack" Class="mt-8">Back</MudButton>
}
}


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

<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="ReturnToWallet">Return to wallet</MudButton>
if (NavigationUtil.CanNavigateBack)
{
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="NavigationUtil.NavigateBack" Class="mt-8">Back</MudButton>
}
else
{
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="ReturnToWallet">Return to wallet</MudButton>
}
@* <MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="ViewTransaction">View Transaction</MudButton> *@
}
}
Expand All @@ -114,8 +105,7 @@
@code
{
private string? validation;
private string? selectedWallet;
private Wallet? selectedWalletObj;

private bool readOnly = false;
private bool started = false;

Expand All @@ -136,12 +126,12 @@
if (BindingContext.WalletList.Data == null)
return;

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

Expand All @@ -161,7 +151,7 @@

private void ReturnToWallet()
{
NavigationManager.NavigateTo($"/wallet/{selectedWallet}");
NavigationManager.NavigateTo($"/wallet/{BindingContext.ActiveWallet?.Address}");
}

private void ViewTransaction()
Expand All @@ -178,12 +168,12 @@
if (BindingContext.WalletList.Data == null)
return;

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

Expand All @@ -197,11 +187,6 @@
await transactionService.SendAction(wallet, ownerWallet, AoAction);
}

private void OpenDialog()
{
NavigationManager.NavigateTo("/start");
// var options = new DialogOptions { CloseOnEscapeKey = true };
// DialogService.Show<AddWalletDialog>("Add Wallet", options);
}


}
12 changes: 7 additions & 5 deletions src/aoWebWallet/Pages/ActionPage.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using aoWebWallet.Models;
using aoWebWallet.ViewModels;
using aoww.ProcesModels.Action;
using Microsoft.AspNetCore.Components.Routing;

namespace aoWebWallet.Pages
Expand All @@ -14,17 +15,18 @@ protected override void OnInitialized()

GetQueryStringValues();
//WatchDataLoaderVM(BindingContext.TokenList);
WatchProp(nameof(BindingContext.ActiveWalletAddress));
WatchDataLoaderVM(BindingContext.WalletList);
WatchDataLoaderVM(transactionService.LastTransaction);
WatchDataLoaderVM(transactionService.DryRunResult);

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

}
//}

NavigationManager.LocationChanged += NavigationManager_LocationChanged;

Expand Down
Loading

0 comments on commit 8e0e3c7

Please sign in to comment.