Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/block-core/angor
Browse files Browse the repository at this point in the history
  • Loading branch information
dangershony committed Sep 10, 2024
2 parents 6266cc4 + 24853a5 commit 8259fb9
Show file tree
Hide file tree
Showing 17 changed files with 570 additions and 175 deletions.
6 changes: 3 additions & 3 deletions src/Angor.Test/Angor.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.JSInterop" Version="8.0.7" />
<PackageReference Include="Microsoft.JSInterop" Version="8.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.0" />

<PackageReference Include="Blockcore.Core" Version="1.1.41" />
Expand Down
5 changes: 3 additions & 2 deletions src/Angor/Client/Angor.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
<PackageReference Include="Blockcore.Core" Version="1.1.41" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.7" PrivateAssets="all" />
<PackageReference Include="NBitcoin" Version="7.0.25" />
<PackageReference Include="Nostr.Client" Version="2.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
42 changes: 42 additions & 0 deletions src/Angor/Client/Components/BalanceDisplay.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@using Angor.Shared
@using Blockcore.Networks
@inject INetworkConfiguration NetworkConfiguration


<div class="d-flex flex-column align-items-start" title="@GetTooltip()">
<span class="fs-4">
<strong>@BtcBalance</strong> @_network.CoinTicker
</span>
@if (ShowFiatInline && PreferredCurrency != "BTC" && !string.IsNullOrEmpty(BtcBalanceInFiat))
{
<h6 class="text-muted">@BtcBalanceInFiat</h6>
}
</div>

@code {
[Parameter]
public decimal BtcBalance { get; set; }

[Parameter]
public string BtcBalanceInFiat { get; set; }

[Parameter]
public string PreferredCurrency { get; set; }

[Parameter]
public bool ShowFiatInline { get; set; } = false;

private Network _network;

protected override void OnInitialized()
{
_network = NetworkConfiguration.GetNetwork();
base.OnInitialized();
}

private string GetTooltip() =>
PreferredCurrency != "BTC" && !string.IsNullOrEmpty(BtcBalanceInFiat) && !ShowFiatInline
? $"Equivalent: {BtcBalanceInFiat}"
: string.Empty;
}

5 changes: 1 addition & 4 deletions src/Angor/Client/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/"

<PageTitle>Angor</PageTitle>
<div class="card">
<div class="row g-0">
Expand All @@ -20,10 +19,8 @@
<Icon IconName="angor-logo" Width="72" Height="72" />
</span>
<h5 class="card-title text-center">Welcome to Angor</h5>
<p class="card-text text-center">Stay in control of your investments with Angor</p>
<p class="card-text text-center">Stay in control of your investments with Angor</p>
</div>
</div>
</div>
</div>


48 changes: 47 additions & 1 deletion src/Angor/Client/Pages/Settings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,41 @@

</div>

@* Currency Display Settings *@
<div class="row mt-4">
<div class="card card-body">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center">
<span class="user-select-none">
<Icon IconName="currency" Height="42" Width="42"></Icon>
</span>
<div class="h-100 ms-3">
<h5 class="mb-0 font-weight-bolder">
Currency Display
</h5>
<p class="mb-0 mt-2 font-weight-normal text-sm">
<span>Current: <strong>@selectedCurrency</strong></span>
</p>
</div>
</div>
<div>
<label for="networkSelection">Select Currency:</label>
<select class="form-control mt-2" value="@selectedCurrency" @onchange="OnCurrencyChanged">
<option value="BTC">BTC</option>
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<option value="CAD">CAD</option>
<option value="CHF">CHF</option>
<option value="AUD">AUD</option>
<option value="JPY">JPY</option>
</select>
</div>
</div>
</div>
</div>


@* Wipe Storage *@
<div class="row mt-4">
<div class="card card-body border-danger border-3">
Expand Down Expand Up @@ -392,6 +427,8 @@
private bool confirmWipe = false;
private bool showConfirmWipeMessage = false;
private string selectedNetwork = "testnet"; // Default to "testnet"
private string selectedCurrency = "BTC"; // Default to BTC
private SettingsInfo settingsInfo;

Expand All @@ -404,10 +441,12 @@
networkType = _networkConfiguration.GetNetwork().Name;

_networkService.OnStatusChanged += UpdateUI;

selectedCurrency = _clientStorage.GetCurrencyDisplaySetting();

if (!networkType.ToLower().Contains("test"))
selectedNetwork = "mainnet";

return base.OnInitializedAsync();
}

Expand Down Expand Up @@ -650,4 +689,11 @@
NavMenuState.NotifyStateChanged();
}


private void OnCurrencyChanged(ChangeEventArgs e)
{
selectedCurrency = e.Value.ToString();
_clientStorage.SetCurrencyDisplaySetting(selectedCurrency);
StateHasChanged();
}
}
Loading

0 comments on commit 8259fb9

Please sign in to comment.