Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
dangershony committed Oct 15, 2024
2 parents 660765e + d724517 commit f545c7b
Show file tree
Hide file tree
Showing 46 changed files with 2,847 additions and 4,316 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

<p align="center">
<img src="https://github.com/miwahn/angor/raw/patch-1/src/Angor/Client/wwwroot/angor-logo.svg" height="100" alt="Angor" />
<img src="https://github.com/user-attachments/assets/fe8c48ab-3479-4312-8e09-7dedce6850f5" height="100" alt="Angor" />
</p>

<h3 align="center">
Bitcoin Crowdfunding Platform
</h3>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angor",
"version": "0.0.59",
"version": "0.0.63",
"license": "MIT",
"scripts": {
"version": "node -p \"require('./package.json').version\"",
Expand Down
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;
}

2 changes: 1 addition & 1 deletion src/Angor/Client/Components/FounderProjectItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@if (InvestmentRequests)
{
<hr class="horizontal light mt-3">
<a role="button" class="d-flex align-items-center btn btn-secondary w-100-m" href=@($"/signatures/{FounderProject.ProjectInfo.ProjectIdentifier}")>
<a role="button" class="d-flex align-items-center btn btn-border w-100-m" href=@($"/signatures/{FounderProject.ProjectInfo.ProjectIdentifier}")>
<span class="user-select-none">
<Icon IconName="check-circle" Height="24" Width="24"></Icon>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/Angor/Client/Components/Icon.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Parameter] public string IconName { get; set; }
[Parameter] public int Width { get; set; } = 32;
[Parameter] public int Height { get; set; } = 32;
[Parameter] public string Color { get; set; } = "var(--bs-primary)";
[Parameter] public string Color { get; set; } = "var(--angor-primary)";
private string svgContent;

protected override async Task OnParametersSetAsync()
Expand Down
2 changes: 1 addition & 1 deletion src/Angor/Client/Pages/Browse.razor
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="card card-body angor-alert-info pt-2 pb-2">
<div class="d-flex align-items-center">
<span class="me-3 user-select-none">
<Icon IconName="info" Width="40" Height="40" Color="var(--bs-primary-btn-icon)" />
<Icon IconName="info" Width="40" Height="40" Color="var(--angor-primary-btn-icon)" />
</span>
<span class="text-white" data-cy="projectsGrid">No projects found.</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Angor/Client/Pages/Founder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div class="card card-body angor-alert-info pt-2 pb-2">
<div class="d-flex align-items-center align-items-center">
<span class="me-3 user-select-none">
<Icon IconName="info" Width="40" Height="40" Color="var(--bs-primary-btn-icon)"/>
<Icon IconName="info" Width="40" Height="40" Color="var(--angor-primary-btn-icon)" />
</span>
<span class="text-white">No projects found.</span>
</div>
Expand Down
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>


12 changes: 7 additions & 5 deletions src/Angor/Client/Pages/Invest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<div class="card card-body angor-alert-info pt-2 pb-2">
<div class="d-flex align-items-center align-items-center">
<span class="me-3 user-select-none">
<Icon IconName="info" Width="40" Height="40" Color="var(--bs-primary-btn-icon)" />
<Icon IconName="info" Width="40" Height="40" Color="var(--angor-primary-btn-icon)" />
</span>
<span class="text-white">
You already invested.
Expand All @@ -84,7 +84,7 @@
<div class="card card-body angor-alert-info pt-2 pb-2">
<div class="d-flex align-items-center align-items-center">
<span class="me-3 user-select-none">
<Icon IconName="info" Width="40" Height="40" Color="var(--bs-primary-btn-icon)" />
<Icon IconName="info" Width="40" Height="40" Color="var(--angor-primary-btn-icon)" />
</span>
<span class="text-white">
You are the founder.
Expand All @@ -101,7 +101,7 @@
<div class="card card-body angor-alert-info pt-2 pb-2">
<div class="d-flex align-items-center align-items-center">
<span class="me-3 user-select-none">
<Icon IconName="info" Width="40" Height="40" Color="var(--bs-primary-btn-icon)" />
<Icon IconName="info" Width="40" Height="40" Color="var(--angor-primary-btn-icon)" />
</span>
<span class="text-white">
The project was not found.
Expand Down Expand Up @@ -180,7 +180,9 @@
@if (showCreateModal)
{
<!-- Confirmation Modal -->
<div class="modal fade show d-block" tabindex="-1" style="background: rgba(0, 0, 0, 0.5)">

<div class="modal-wrapper">
<div class="modal fade show d-block" tabindex="-1" style="background: rgba(0, 0, 0, 0.5)">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down Expand Up @@ -243,7 +245,7 @@
</div>
</div>
</div>

</div>
}

<!-- Stages Breakdown -->
Expand Down
174 changes: 105 additions & 69 deletions src/Angor/Client/Pages/Investor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -135,80 +135,116 @@
</h5>
</div>
</div>
</div>

<div class="row row-cols-1 row-cols-sm-1 row-cols-md-1 row-cols-lg-2 g-4 card-container mt-0">
@foreach (var project in projects)
{
Stats.TryGetValue(project.ProjectInfo.ProjectIdentifier, out var stats);
var nostrPubKey = project.ProjectInfo.NostrPubKey;
investmentRequestsMap.TryGetValue(nostrPubKey, out bool hasInvestmentRequests);

<div class="col">



<div class="card card-body">
<div class="d-flex align-items-center">
<span class="user-select-none">
<Icon IconName="project_explorer"></Icon>
</span>
<div class="h-100 ms-3">
<h5 class="mb-0 font-weight-bolder">
@project.Metadata?.Name
</h5>
</div>
</div>

<div class="mb-3 mt-4 d-flex justify-content-between">
<span>Funding Target:</span>
<strong>@project.ProjectInfo.TargetAmount @network.CoinTicker</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>Raised:</span>
<strong>@Money.Satoshis(stats?.AmountInvested ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>Raised (% Target):</span>
<strong>@((stats?.AmountInvested ?? 0) * 100 / Money.Coins(project.ProjectInfo.TargetAmount).Satoshi) %</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>Status:</span>
@if (project.ProjectInfo.StartDate < DateTime.UtcNow)
{
<strong class="text-warning">Funding</strong>
}
else
{
<strong class="text-success">Live</strong>
}
</div>

<div class="mb-3 d-flex justify-content-between">
<span>My Investment:</span>
<div>
@if (!project.SignaturesInfo?.Signatures.Any() ?? false)
{
<a href=@($"/invest/{project.ProjectInfo.ProjectIdentifier}") class="btn btn-sm btn-border ms-2" title="Pending">
<i class="oi oi-clock">
<Icon IconName="clock-square" Width="24" Height="24"></Icon>
</i>
</a>
}
<strong>@Money.Satoshis(project.AmountInvested ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker</strong>

</div>

</div>

<div class="mb-3 d-flex justify-content-between">
<span>Spent by Founder:</span>
<strong>-</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>Available to Founder:</span>
<strong>-</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>In Recovery:</span>
<strong>@Money.Satoshis(project.AmountInRecovery ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker</strong>
</div>

<div class="mb-3 d-flex justify-content-between">
<span>Founder Approval:</span>
@if (hasInvestmentRequests)
{
<strong class="text-primary">Approved</strong>
}
else
{
<strong class="text-danger">Pending</strong>
}
</div>
<div class="card-footer">
<a href=@($"/view/{project.ProjectInfo.ProjectIdentifier}") class="btn btn-border w-100">
View Project
</a>
</div>
</div>




<div class="card-body">
<div class="table-responsive form-control" style="overflow-x: hidden;">
<table class="table table-sm table-striped align-items-center mb-0" style="table-layout: fixed; width: 100%;">
<thead>
<tr>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7" style="padding: 4px;">Name</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">Funding Target (@network.CoinTicker)</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">Raised (@network.CoinTicker)</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">Raised (% Target)</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7" style="padding: 4px;">Project Status</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">My Investment (@network.CoinTicker)</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">Spent by Founder</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">Available to Founder</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7 text-end" style="padding: 4px;">In Recovery</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7" style="padding: 4px;">Founder Approval</th>
</tr>

</thead>
<tbody>
@foreach (var project in projects)
{
Stats.TryGetValue(project.ProjectInfo.ProjectIdentifier, out var stats);
var nostrPubKey = project.ProjectInfo.NostrPubKey;
investmentRequestsMap.TryGetValue(nostrPubKey, out bool hasInvestmentRequests);

<tr>
<td>
<a href=@($"/view/{project.ProjectInfo.ProjectIdentifier}") class="text-truncate">@project.Metadata?.Name</a>
</td>
<td class="text-end">@project.ProjectInfo.TargetAmount @network.CoinTicker</td>
<td class="text-end">@Money.Satoshis(stats?.AmountInvested ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker</td>
<td class="text-end">@((stats?.AmountInvested ?? 0) * 100 / Money.Coins(project.ProjectInfo.TargetAmount).Satoshi) %</td>
<td>
@if (project.ProjectInfo.StartDate < DateTime.UtcNow)
{
<span class="text-info">Funding</span>
}
else
{
<span class="text-success">Live</span>
}
</td>
<td class="text-end">
@Money.Satoshis(project.AmountInvested ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker
@if (!project.SignaturesInfo?.Signatures.Any() ?? false)
{
<a href=@($"/invest/{project.ProjectInfo.ProjectIdentifier}") class="btn btn-link p-0" data-toggle="tooltip" title="Pending"> <i class="oi oi-clock"></i></a>
}
</td>
<td class="text-end">-</td>
<td class="text-end">-</td>
<td class="text-end">@Money.Satoshis(project.AmountInRecovery ?? 0).ToUnit(MoneyUnit.BTC) @network.CoinTicker</td>
<td>
@if (hasInvestmentRequests)
{
<a href="@($"/invest/{project.ProjectInfo.ProjectIdentifier}")" class="text-info">Approved</a>
}
else
{
<span class="text-warning">Pending</span>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>

}
</div>



</div>

</div>
Expand Down
Loading

0 comments on commit f545c7b

Please sign in to comment.