Skip to content

Commit

Permalink
Add wallet flow improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed May 11, 2024
1 parent f4a56d3 commit 11686cc
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 69 deletions.
7 changes: 4 additions & 3 deletions src/aoWebWallet/Pages/ActionPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<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))
else if (!started && !string.IsNullOrEmpty(selectedWallet) && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
{
<SendTransactionProgress DataLoader="transactionService.DryRunResult.DataLoader" Title="Getting dry run result..." />
if (transactionService.DryRunResult.Data != null)
Expand Down Expand Up @@ -204,8 +204,9 @@

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

}
41 changes: 2 additions & 39 deletions src/aoWebWallet/Pages/Start.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,7 @@
@using aoWebWallet.Models
@using aoWebWallet.Shared

<PageTitle>Start - @Program.PageTitlePostFix</PageTitle>
<PageTitle>Add a wallet - @Program.PageTitlePostFix</PageTitle>

<MudContainer Class="mt-16 px-8" MaxWidth="MaxWidth.ExtraExtraLarge">
<MudGrid>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/ths.svg" Alt="hello" Elevation="25" Class="ww-image-start"/>
</div>
</div>
<AddGenerateWalletComponent></AddGenerateWalletComponent>
</MudPaper>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/arconnect-logo.svg" Alt="hello" Elevation="25" Class="ww-image-start ar-logo-setup"/>
</div>
</div>
<AddArConnectComponent></AddArConnectComponent>
</MudPaper>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet-upload">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/json-logo.svg" Alt="hello" Elevation="25" Class="ww-image-start ar-logo-setup"/>
</div>
</div>
<AddUploadWalletComponent></AddUploadWalletComponent>
</MudPaper>
</MudItem>
</MudGrid>
</MudContainer>
<AddWalletComponent />

@code {


}
5 changes: 0 additions & 5 deletions src/aoWebWallet/Pages/Wallets.razor
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@

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

private async void EditWallet(Wallet wallet)

Check warning on line 104 in src/aoWebWallet/Pages/Wallets.razor

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
Expand Down
10 changes: 9 additions & 1 deletion src/aoWebWallet/Shared/AddArConnectComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inherits MvvmComponentBase<MainViewModel>
@inject ISnackbar Snackbar
@inject ArweaveService ArweaveService
@inject NavigationManager NavigationManager

<MudPaper Class="pa-8 mb-4 trigger-transparency">
<MudStack Spacing="2">
Expand Down Expand Up @@ -125,7 +126,14 @@

Snackbar.Add($"Wallet added ({address})", Severity.Info);

MudDialog?.Close(true);
if (MudDialog != null)
{
MudDialog.Close();
}
else
{
NavigationManager.NavigateTo($"/wallet/{wallet.Address}");
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/aoWebWallet/Shared/AddGenerateWalletComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inherits MvvmComponentBase<MainViewModel>
@inject ArweaveService ArweaveService
@inject ISnackbar Snackbar
@inject NavigationManager NavigationManager

<MudPaper Class="pa-8 trigger-transparency">
<MudStack Spacing="2">
Expand All @@ -13,7 +14,7 @@
<MudText DefaultFocus="DefaultFocus" Color="Color.Secondary">@Progress</MudText>
<div Class="d-w-100 d-flex justify-center mt-2">
<MudButton Class="text-transform-none" Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">
Create AOWW Wallet
Create aoWW Wallet
</MudButton>
</div>
</MudStack>
Expand Down Expand Up @@ -65,6 +66,11 @@
{
MudDialog.Close();
}
else
{
NavigationManager.NavigateTo($"/wallet/{wallet.Address}");
}

return true;
}
}
10 changes: 10 additions & 0 deletions src/aoWebWallet/Shared/AddUploadWalletComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
@inherits MvvmComponentBase<MainViewModel>
@inject ArweaveService ArweaveService
@inject ISnackbar Snackbar
@inject NavigationManager NavigationManager


<MudPaper Class="pa-8 trigger-transparency">
<MudStack Spacing="2">
Expand Down Expand Up @@ -154,6 +156,14 @@
{
MudDialog.Close();
}
else if(_fileNames.Count == 1)
{
NavigationManager.NavigateTo($"/wallet/{_fileNames.First().Address}");
}
else
{
NavigationManager.NavigateTo($"/");
}
}

private void SetDragClass()
Expand Down
34 changes: 34 additions & 0 deletions src/aoWebWallet/Shared/AddWalletComponent.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<MudContainer Class="mt-16 px-8" MaxWidth="MaxWidth.ExtraExtraLarge">
<MudGrid>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/ths.svg" Alt="hello" Elevation="25" Class="ww-image-start" />
</div>
</div>
<AddGenerateWalletComponent></AddGenerateWalletComponent>
</MudPaper>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/arconnect-logo.svg" Alt="hello" Elevation="25" Class="ww-image-start ar-logo-setup" />
</div>
</div>
<AddArConnectComponent></AddArConnectComponent>
</MudPaper>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4 border-radius-25 first-wallet-upload">
<div Style="width:100%; display:flex; flex-direction:row; justify-content:center;">
<div Class="background-x">
<MudImage Src="images/json-logo.svg" Alt="hello" Elevation="25" Class="ww-image-start ar-logo-setup" />
</div>
</div>
<AddUploadWalletComponent></AddUploadWalletComponent>
</MudPaper>
</MudItem>
</MudGrid>
</MudContainer>
13 changes: 1 addition & 12 deletions src/aoWebWallet/Shared/AddWalletDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@

<MudDialog>
<DialogContent>
<MudDivider Class="mb-5" />
<MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" PanelClass="pa-6">
<MudTabPanel Text="New wallet">
<AddGenerateWalletComponent></AddGenerateWalletComponent>
</MudTabPanel>
<MudTabPanel Text="ArConnect">
<AddArConnectComponent></AddArConnectComponent>
</MudTabPanel>
<MudTabPanel Text="Load .json">
<AddUploadWalletComponent></AddUploadWalletComponent>
</MudTabPanel>
</MudTabs>
<AddWalletComponent />
</DialogContent>
</MudDialog>
@code {
Expand Down
11 changes: 3 additions & 8 deletions src/aoWebWallet/Shared/EditWalletComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

<div Class="d-w-100 d-flex justify-end mt-2">
<MudButton OnClick="Submit" Color="Color.Primary" Variant="Variant.Filled">
Expand All @@ -26,19 +26,14 @@

public string? Progress { get; set; }

[Parameter]
public bool IsExpanded { get; set; }
public bool IsReadOnly => !Wallet.IsReadOnly;


protected override void OnInitialized()
{
base.OnInitialized();
}

private void OnExpandCollapseClick()
{
IsExpanded = !IsExpanded;
}

public async Task<bool> Submit()
{
Expand Down
6 changes: 6 additions & 0 deletions src/aoWebWallet/aoWebWallet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@
<ProjectReference Include="..\webvNext.DataLoader\webvNext.DataLoader.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="Shared\AddWalletComponent.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>

</Project>

0 comments on commit 11686cc

Please sign in to comment.