From 11686cc9523b5e9803ba6215c178199e0650fb7b Mon Sep 17 00:00:00 2001 From: Michiel Post Date: Sat, 11 May 2024 11:50:16 +0200 Subject: [PATCH] Add wallet flow improvements --- src/aoWebWallet/Pages/ActionPage.razor | 7 ++-- src/aoWebWallet/Pages/Start.razor | 41 +------------------ src/aoWebWallet/Pages/Wallets.razor | 5 --- .../Shared/AddArConnectComponent.razor | 10 ++++- .../Shared/AddGenerateWalletComponent.razor | 8 +++- .../Shared/AddUploadWalletComponent.razor | 10 +++++ .../Shared/AddWalletComponent.razor | 34 +++++++++++++++ src/aoWebWallet/Shared/AddWalletDialog.razor | 13 +----- .../Shared/EditWalletComponent.razor | 11 ++--- src/aoWebWallet/aoWebWallet.csproj | 6 +++ 10 files changed, 76 insertions(+), 69 deletions(-) create mode 100644 src/aoWebWallet/Shared/AddWalletComponent.razor diff --git a/src/aoWebWallet/Pages/ActionPage.razor b/src/aoWebWallet/Pages/ActionPage.razor index adf2e92..d529cdf 100644 --- a/src/aoWebWallet/Pages/ActionPage.razor +++ b/src/aoWebWallet/Pages/ActionPage.razor @@ -62,7 +62,7 @@ Preview @validation } - else if (!started && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id)) + else if (!started && !string.IsNullOrEmpty(selectedWallet) && string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id)) { if (transactionService.DryRunResult.Data != null) @@ -204,8 +204,9 @@ private void OpenDialog() { - var options = new DialogOptions { CloseOnEscapeKey = true }; - DialogService.Show("Add Wallet", options); + NavigationManager.NavigateTo("/start"); + // var options = new DialogOptions { CloseOnEscapeKey = true }; + // DialogService.Show("Add Wallet", options); } } diff --git a/src/aoWebWallet/Pages/Start.razor b/src/aoWebWallet/Pages/Start.razor index 26eadda..620994a 100644 --- a/src/aoWebWallet/Pages/Start.razor +++ b/src/aoWebWallet/Pages/Start.razor @@ -3,44 +3,7 @@ @using aoWebWallet.Models @using aoWebWallet.Shared -Start - @Program.PageTitlePostFix +Add a wallet - @Program.PageTitlePostFix - - - - -
-
- -
-
- -
-
- - -
-
- -
-
- -
-
- - -
-
- -
-
- -
-
-
-
+ - @code { - - -} diff --git a/src/aoWebWallet/Pages/Wallets.razor b/src/aoWebWallet/Pages/Wallets.razor index 3a76f85..7f8f2d1 100644 --- a/src/aoWebWallet/Pages/Wallets.razor +++ b/src/aoWebWallet/Pages/Wallets.razor @@ -100,11 +100,6 @@ @code { - private void OpenDialog() - { - var options = new DialogOptions { CloseOnEscapeKey = true }; - DialogService.Show("Add Wallet", options); - } private async void EditWallet(Wallet wallet) { diff --git a/src/aoWebWallet/Shared/AddArConnectComponent.razor b/src/aoWebWallet/Shared/AddArConnectComponent.razor index 135099f..f6fc840 100644 --- a/src/aoWebWallet/Shared/AddArConnectComponent.razor +++ b/src/aoWebWallet/Shared/AddArConnectComponent.razor @@ -2,6 +2,7 @@ @inherits MvvmComponentBase @inject ISnackbar Snackbar @inject ArweaveService ArweaveService +@inject NavigationManager NavigationManager @@ -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}"); + } } } diff --git a/src/aoWebWallet/Shared/AddGenerateWalletComponent.razor b/src/aoWebWallet/Shared/AddGenerateWalletComponent.razor index 366df46..f30882b 100644 --- a/src/aoWebWallet/Shared/AddGenerateWalletComponent.razor +++ b/src/aoWebWallet/Shared/AddGenerateWalletComponent.razor @@ -2,6 +2,7 @@ @inherits MvvmComponentBase @inject ArweaveService ArweaveService @inject ISnackbar Snackbar +@inject NavigationManager NavigationManager @@ -13,7 +14,7 @@ @Progress
- Create AOWW Wallet + Create aoWW Wallet
@@ -65,6 +66,11 @@ { MudDialog.Close(); } + else + { + NavigationManager.NavigateTo($"/wallet/{wallet.Address}"); + } + return true; } } diff --git a/src/aoWebWallet/Shared/AddUploadWalletComponent.razor b/src/aoWebWallet/Shared/AddUploadWalletComponent.razor index cb1c90e..8d4f7ba 100644 --- a/src/aoWebWallet/Shared/AddUploadWalletComponent.razor +++ b/src/aoWebWallet/Shared/AddUploadWalletComponent.razor @@ -2,6 +2,8 @@ @inherits MvvmComponentBase @inject ArweaveService ArweaveService @inject ISnackbar Snackbar +@inject NavigationManager NavigationManager + @@ -154,6 +156,14 @@ { MudDialog.Close(); } + else if(_fileNames.Count == 1) + { + NavigationManager.NavigateTo($"/wallet/{_fileNames.First().Address}"); + } + else + { + NavigationManager.NavigateTo($"/"); + } } private void SetDragClass() diff --git a/src/aoWebWallet/Shared/AddWalletComponent.razor b/src/aoWebWallet/Shared/AddWalletComponent.razor new file mode 100644 index 0000000..84bd04f --- /dev/null +++ b/src/aoWebWallet/Shared/AddWalletComponent.razor @@ -0,0 +1,34 @@ + + + + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+
diff --git a/src/aoWebWallet/Shared/AddWalletDialog.razor b/src/aoWebWallet/Shared/AddWalletDialog.razor index 48cf964..926ef1e 100644 --- a/src/aoWebWallet/Shared/AddWalletDialog.razor +++ b/src/aoWebWallet/Shared/AddWalletDialog.razor @@ -4,18 +4,7 @@ - - - - - - - - - - - - + @code { diff --git a/src/aoWebWallet/Shared/EditWalletComponent.razor b/src/aoWebWallet/Shared/EditWalletComponent.razor index f5b6c1c..b74f1c7 100644 --- a/src/aoWebWallet/Shared/EditWalletComponent.razor +++ b/src/aoWebWallet/Shared/EditWalletComponent.razor @@ -4,9 +4,9 @@ - - + @Progress +
@@ -26,8 +26,7 @@ public string? Progress { get; set; } - [Parameter] - public bool IsExpanded { get; set; } + public bool IsReadOnly => !Wallet.IsReadOnly; protected override void OnInitialized() @@ -35,10 +34,6 @@ base.OnInitialized(); } - private void OnExpandCollapseClick() - { - IsExpanded = !IsExpanded; - } public async Task Submit() { diff --git a/src/aoWebWallet/aoWebWallet.csproj b/src/aoWebWallet/aoWebWallet.csproj index b4872a5..db18bf9 100644 --- a/src/aoWebWallet/aoWebWallet.csproj +++ b/src/aoWebWallet/aoWebWallet.csproj @@ -28,4 +28,10 @@ + + + true + + +