diff --git a/src/Blockcore/UI/BlazorModal/ModalService.cs b/src/Blockcore/UI/BlazorModal/ModalService.cs new file mode 100644 index 000000000..2f9ff3412 --- /dev/null +++ b/src/Blockcore/UI/BlazorModal/ModalService.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Components; +using System; + +namespace BlazorModal.Services +{ + public class ModalService + { + public event Action OnShow; + + public event Action OnClose; + + public void Show(string title, Type contentType) + { + if (contentType.BaseType != typeof(ComponentBase)) + { + throw new ArgumentException($"{contentType.FullName} must be a Blazor Component"); + } + + var content = new RenderFragment(x => { x.OpenComponent(1, contentType); x.CloseComponent(); }); + + OnShow?.Invoke(title, content); + } + + public void Close() + { + OnClose?.Invoke(); + } + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor new file mode 100644 index 000000000..a6ee2c3fd --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor @@ -0,0 +1,33 @@ +@typeparam TItem + + +@code { + [Parameter] + public RenderFragment InitialTip{get;set;} + [Parameter] + public RenderFragment ChildContent{get;set;} + [Parameter] + public EventCallback OnSelected {get;set;} + + private bool show = false; + private RenderFragment Tip ; + + protected override void OnInitialized(){ this.Tip = InitialTip; } + public async Task HandleSelect(TItem item, RenderFragment contentFragment) + { + this.Tip= contentFragment.Invoke(item); + this.show=false; + StateHasChanged(); + await this.OnSelected.InvokeAsync(item); + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor b/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor new file mode 100644 index 000000000..0979f10a3 --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor @@ -0,0 +1,12 @@ +@typeparam TItem +@ChildContent(Item) + +@code { + [CascadingParameter(Name="Dropdown")] + public Dropdown Dropdown {get;set;} + + [Parameter] + public TItem Item{get;set;} + [Parameter] + public RenderFragment ChildContent {get;set;} +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor index 2c84cafb0..cbbc4587f 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor @@ -120,7 +120,7 @@ } } - + } diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor index 48c20286a..06a93a3b5 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor @@ -3,7 +3,6 @@ @using Blockcore.Features.ColdStaking @using Blockcore.Features.Wallet.Interfaces @using Blockcore.Base.Deployments -@using NBitcoin; @inject IWalletManager WalletManager @inject NavigationManager NavigationManager diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor index 1bf5d437c..ffcda5d29 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor @@ -8,12 +8,25 @@ @inject NavigationManager NavigationManager @inject IWalletManager WalletManager @inject Network Network +@inject ModalService ModalService @{ -
-

Cold Staking - @walletname

+

Cold Staking

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + + + } } @@ -107,7 +124,12 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle public string walletname { get; set; } [Parameter] public string accountname { get; set; } - + ColdStakingManager ColdStakingManager; + protected override Task OnInitializedAsync() + { + ColdStakingManager = this.WalletManager as ColdStakingManager; + return Task.CompletedTask; + } private void NavigateToEnableWallet() { NavigationManager.NavigateTo("coldstaking-enablewallet"); @@ -126,8 +148,17 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle NavigationManager.NavigateTo("coldstaking-delegate/" + walletName); } - private void NavigateToViewTx(uint256 txId) + private void ViewTransaction() + { + ModalService.Show("Transaction Details", typeof(ViewTransaction)); + } + private void NavigateToColdStakeView(string walletName) + { + NavigationManager.NavigateTo("coldstakeview/" + walletName + "/coldStakingColdAddresses"); + } + private void OnSelected(string selection) { - NavigationManager.NavigateTo("coldStakeviewtx"); + Console.WriteLine(selection); + NavigateToColdStakeView(selection); } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor new file mode 100644 index 000000000..7a7013a81 --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor @@ -0,0 +1,13 @@ +@if (ShowForm) +{ + +} + +@code +{ + bool ShowForm { get; set; } = true; + private void SubmitForm() + { + ShowForm = false; + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor b/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor index c3615efc7..b71f70d0c 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor @@ -1 +1,3 @@ -@using Microsoft.AspNetCore.Components.Web \ No newline at end of file +@using Microsoft.AspNetCore.Components.Web +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs b/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs index 7e7809b0f..b0a1bf3e0 100644 --- a/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs +++ b/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using BlazorModal.Services; using Blockcore.Builder.Feature; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; @@ -40,5 +41,10 @@ public static IMvcBuilder AddControllers(this IMvcBuilder builder, IEnumerable(); + } } } diff --git a/src/Features/Blockcore.Features.NodeHost/Startup.cs b/src/Features/Blockcore.Features.NodeHost/Startup.cs index dfb484cc0..7ca99860d 100644 --- a/src/Features/Blockcore.Features.NodeHost/Startup.cs +++ b/src/Features/Blockcore.Features.NodeHost/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Swashbuckle.AspNetCore.SwaggerUI; +using BlazorModal; namespace Blockcore.Features.NodeHost { @@ -82,6 +83,9 @@ public void ConfigureServices(IServiceCollection services) // The UI elements moved under the UI folder options.RootDirectory = "/UI/Pages"; }); + + services.AddBlazorModal(); + } if (hostSettings.EnableWS) diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor new file mode 100644 index 000000000..a37610396 --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor @@ -0,0 +1,38 @@ +@using Blockcore.Utilities.Extensions + +@inject Blockcore.Connection.IConnectionManager ConnectionManager + +@if (ShowForm) +{ + +
+ +
+ +
+
+
+ @Alert +
+
+
+} + +@code +{ + bool ShowForm { get; set; } = true; + private string NodeIp { get; set; } + string Alert { get; set; } + private void Addnode() + { + + if (string.IsNullOrEmpty(this.NodeIp)) { this.Alert = "Please enter an IP address"; return; } + this.Alert = string.Empty; + var endpoint = this.NodeIp.ToIPEndPoint(this.ConnectionManager.Network.DefaultPort); + this.ConnectionManager.AddNodeAddress(endpoint); + this.Alert = $"Added Node: {endpoint}"; + } + + +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor index 4fdf5b4ef..4565233e5 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor @@ -8,31 +8,20 @@ @inject Blockcore.Connection.IConnectionManager ConnectionManager @inject Blockcore.Interfaces.IInitialBlockDownloadState InitialBlockDownloadState @inject NavigationManager NavigationManager +@inject ModalService ModalService

@this.Network.CoinTicker.ToUpper() Network

-
- -
- -
- - -
+ + +
-
-
@Alert
-
- @{ if (this.InitialBlockDownloadState.IsInitialBlockDownload()) { @@ -152,6 +141,7 @@
+

Peers

@@ -179,29 +169,20 @@ + } @code { - private string NodeIp { get; set; } - string Alert { get; set; } - private void Addnode() - { - if (string.IsNullOrEmpty(this.NodeIp)) { this.Alert = "Please enter an IP address"; return; } - this.Alert = string.Empty; - - var endpoint = this.NodeIp.ToIPEndPoint(this.ConnectionManager.Network.DefaultPort); - - this.ConnectionManager.AddNodeAddress(endpoint); - - this.Alert = $"node {endpoint} added"; - } private void Shutdown() { this.FullNode?.NodeLifetime.StopApplication(); } - private void NavigateToLogs() { NavigationManager.NavigateTo("logs"); } -} \ No newline at end of file + private void AddNode() + { + ModalService.Show("Add Node", typeof(AddNode)); + } +} diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor index d0b000de8..ab9af0dbf 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor @@ -5,6 +5,7 @@

Node Logs

+
@@ -12,4 +13,11 @@
 @(((Blockcore.FullNode)this.FullNode).LastLogOutput.TrimStart(' '))
 
+} + +@code { + private async Task ReloadPage() + { + + } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml b/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml index e46ad2d3b..4c54a0859 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml @@ -1,6 +1,7 @@ @page "/" @namespace Blockcore.Features.NodeHost.UI.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, BlazorModal @{ Layout = null; } diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor b/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor index 3fda61f89..dcf545a77 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor @@ -1,5 +1,6 @@ @inherits LayoutComponentBase + @@ -11,7 +12,7 @@ @* *@ diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor new file mode 100644 index 000000000..2362fc33c --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor @@ -0,0 +1,19 @@ +@inherits ModalBase + +
+ +
+ +
+
+

@Title

+ +
+
+ @Content +
+
+ +
\ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor.cs b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor.cs new file mode 100644 index 000000000..64066e617 --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor.cs @@ -0,0 +1,45 @@ +using BlazorModal.Services; +using System; +using Microsoft.AspNetCore.Components; + +namespace BlazorModal +{ + public class ModalBase : ComponentBase, IDisposable + { + [Inject] ModalService ModalService { get; set; } + + protected bool IsVisible { get; set; } + protected string Title { get; set; } + protected RenderFragment Content { get; set; } + + protected override void OnInitialized() + { + ModalService.OnShow += ShowModal; + ModalService.OnClose += CloseModal; + } + + public void ShowModal(string title, RenderFragment content) + { + Title = title; + Content = content; + IsVisible = true; + + StateHasChanged(); + } + + public void CloseModal() + { + IsVisible = false; + Title = ""; + Content = null; + + StateHasChanged(); + } + + public void Dispose() + { + ModalService.OnShow -= ShowModal; + ModalService.OnClose -= CloseModal; + } + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor b/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor index 29e85b0da..96f2017c1 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor @@ -5,4 +5,6 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.JSInterop -@using Blockcore.Features.NodeHost.UI.Shared \ No newline at end of file +@using Blockcore.Features.NodeHost.UI.Shared +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css b/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css index 2f22560a1..b94c6f746 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css +++ b/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css @@ -180,4 +180,57 @@ app { /* Never collapse the sidebar for wide screens */ display: block; } +} +.bm-container { + display: none; + align-items: center; + justify-content: center; + position: fixed; + width: 100%; + height: 100%; + z-index: 2; +} + +.bm-overlay { + display: block; + position: fixed; + width: 100%; + height: 100%; + z-index: 3; + background-color: rgba(0,0,0,0.5); +} + +.bm-active { + display: flex; +} + +.blazor-modal { + display: flex; + flex-direction: column; + width: 50rem; + background-color:#303030; + border-radius: 4px; + border: 1px solid rgba(0, 0, 0, 0.125); + padding: 1.5rem; + z-index: 4; +} + +.bm-header { + display: flex; + align-items: flex-start; + justify-content: space-between; + padding: 0 0 2rem 0; +} + +.bm-title { + margin-bottom: 0; +} + +.bm-close { + padding: 1rem; + margin: -1rem -1rem -1rem auto; + background-color: transparent; + border: 0; + -webkit-appearance: none; + cursor: pointer; } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Dropdown.razor b/src/Features/Blockcore.Features.Wallet/UI/Dropdown.razor new file mode 100644 index 000000000..a6ee2c3fd --- /dev/null +++ b/src/Features/Blockcore.Features.Wallet/UI/Dropdown.razor @@ -0,0 +1,33 @@ +@typeparam TItem + + +@code { + [Parameter] + public RenderFragment InitialTip{get;set;} + [Parameter] + public RenderFragment ChildContent{get;set;} + [Parameter] + public EventCallback OnSelected {get;set;} + + private bool show = false; + private RenderFragment Tip ; + + protected override void OnInitialized(){ this.Tip = InitialTip; } + public async Task HandleSelect(TItem item, RenderFragment contentFragment) + { + this.Tip= contentFragment.Invoke(item); + this.show=false; + StateHasChanged(); + await this.OnSelected.InvokeAsync(item); + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor b/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor new file mode 100644 index 000000000..0979f10a3 --- /dev/null +++ b/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor @@ -0,0 +1,12 @@ +@typeparam TItem +@ChildContent(Item) + +@code { + [CascadingParameter(Name="Dropdown")] + public Dropdown Dropdown {get;set;} + + [Parameter] + public TItem Item{get;set;} + [Parameter] + public RenderFragment ChildContent {get;set;} +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor new file mode 100644 index 000000000..7a7013a81 --- /dev/null +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor @@ -0,0 +1,13 @@ +@if (ShowForm) +{ + +} + +@code +{ + bool ShowForm { get; set; } = true; + private void SubmitForm() + { + ShowForm = false; + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor index 79c76b37a..bddba2a72 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor @@ -7,15 +7,30 @@ @inject IWalletManager WalletManager @inject NavigationManager NavigationManager +@{
-

Receive to @walletname

+

Receive

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + + +
-@{ var result = this.WalletManager.GetUnusedAddress(new WalletAccountReference(walletname, accountname)); -
@@ -46,4 +61,21 @@ var result = this.WalletManager.GetUnusedAddress(new WalletAccountReference(wall public string walletname { get; set; } [Parameter] public string accountname { get; set; } + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } + private void NavigateToReceiveWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); + } + private void NavigateToSendWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); + } + private void OnSelected(string selection) + { + Console.WriteLine(selection); + NavigateToWallet(selection,"account 0"); + } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor index ff395abb2..40be9438a 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor @@ -16,8 +16,24 @@ @{
-

Send coins from @walletname

+

Send coins

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + + +
@@ -285,4 +301,22 @@ { NavigationManager.NavigateTo("walletbroadcasttx/" + walletName + "/" + accountname); } + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } + private void NavigateToReceiveWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); + } + private void NavigateToSendWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); + } + + private void OnSelected(string selection) + { + Console.WriteLine(selection); + NavigateToWallet(selection,"account 0"); + } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor similarity index 71% rename from src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor rename to src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor index 9d5dfa56f..6223f0d56 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor @@ -1,4 +1,4 @@ -@page "/walletaccount/{walletname}/{accountname}" +@page "/walletview/{walletname}/{accountname}" @using Blockcore.Features.Wallet.Interfaces @using NBitcoin; @@ -8,18 +8,33 @@ @inject NavigationManager NavigationManager @inject IWalletManager WalletManager @inject Network Network +@inject ModalService ModalService @{ var accountBalance = this.WalletManager.GetBalances(walletname, accountname).Single();
-

Wallet - @walletname

+

Wallet

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + + + Receive + - + Send +
@@ -57,6 +72,7 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle
+ @@ -64,11 +80,14 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle { foreach (var transaction in history.TransactionsHistory) { - @*@onclick="() => { NavigateToViewTx(transaction.Id); }" > *@ - + + + } } @@ -80,31 +99,31 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle } - @code { - [Parameter] public string walletname { get; set; } [Parameter] public string accountname { get; set; } - + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } private void NavigateToReceiveWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); } - private void NavigateToSendWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); } - - private void NavigateToWallets() + private void ViewTransaction() { - NavigationManager.NavigateTo("wallets"); + ModalService.Show("Transaction Details", typeof(ViewTransaction)); } - - private void NavigateToViewTx(uint256 txId) + private void OnSelected(string selection) { - NavigationManager.NavigateTo("coldStakeviewtx"); + Console.WriteLine(selection); + NavigateToWallet(selection,"account 0"); } + } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor index e8624c9e8..2eb1579ba 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor @@ -14,112 +14,121 @@ @inject Blockcore.Interfaces.IInitialBlockDownloadState InitialBlockDownloadState @{ -
-

Wallets

-
- - - - +
+

Wallets

+
+ + + + +
-
-
-
-
-
-
Main Balance
-
-
-
-

@totalBalance()

-

@this.Network.CoinTicker.ToUpper()

+
+
+
+
+
Main Balance
+
+
+
+

@totalBalance()

+

@this.Network.CoinTicker.ToUpper()

+
+
@totalUnconfirmedBalance() (unconfirmed)
-
@totalUnconfirmedBalance() (unconfirmed)
-
-
-
-
-
Wallet Status
-
-
-
-

@this.WalletSyncManager.WalletTip.Height / @ChainIndexer.Height

+
+
+
+
Wallet Status
+
+
+
+

@this.WalletSyncManager.WalletTip.Height / @ChainIndexer.Height

+
+
+
+
+ @if (InSync() < 100) + { + + } + else + { + + } +
-
-
- @if (InSync()<100) { - - } else { - - } -
-
-
- @if (InSync()<100) { -
Syncing - @InSync()%
- } else { + @if (InSync() < 100) + { +
Syncing - @InSync()%
+ } + else + {
Synced
- } + } +
-
-
-
-
-
-

Balances

- -
-
DATE/TIME AMOUNT BLOCKDETAILS
@transaction.Type
@transaction.Type @String.Format("{0:f}", transaction.Timestamp) @transaction.Amount @transaction.ConfirmedInBlock + +
- - - - - - - - - - @{ - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) +
+
+
+
+

Balances

+
+
WALLETCONFIRMED BALANCEUNCONFIRMED BALANCEDETAILS
+ + + + + + + + + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - - - - - - + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + + + + + + + } } } - } - -
WALLETCONFIRMED BALANCEUNCONFIRMED BALANCEDETAILS
@walletName@accountBalance.AmountConfirmed@accountBalance.AmountUnconfirmed
@walletName@accountBalance.AmountConfirmed@accountBalance.AmountUnconfirmed + +
+ + +
-
} @code { private void NavigateToWallet(string walletName, string accountname) { - NavigationManager.NavigateTo("walletaccount/" + walletName + "/" + accountname); + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); } private void NavigateToWalletCreate() @@ -164,36 +173,38 @@ private dynamic totalBalance() { dynamic balance = 0; - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) - { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - balance = balance + accountBalance.AmountConfirmed; - } - } + foreach (var walletName in this.WalletManager.GetWalletsNames()) + { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + balance = balance + accountBalance.AmountConfirmed; + } + } return balance; } private dynamic totalUnconfirmedBalance() { dynamic balance = 0; - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) - { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - balance = balance + accountBalance.AmountUnconfirmed; - } - } + foreach (var walletName in this.WalletManager.GetWalletsNames()) + { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + balance = balance + accountBalance.AmountUnconfirmed; + } + } return balance; } private dynamic InSync() { + decimal wt = (decimal)this.WalletSyncManager.WalletTip.Height; + decimal ct = (decimal)this.ChainIndexer.Height; + dynamic syncPercent = 0; - syncPercent = (this.WalletSyncManager.WalletTip.Height / this.ChainIndexer.Height) * 100; + syncPercent = (int)(((decimal)wt / (decimal)ct) * 100); return syncPercent; } - } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor b/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor index c3615efc7..b71f70d0c 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor @@ -1 +1,3 @@ -@using Microsoft.AspNetCore.Components.Web \ No newline at end of file +@using Microsoft.AspNetCore.Components.Web +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file