Skip to content

Commit

Permalink
Top depositors
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetMichal committed Nov 19, 2023
1 parent fe019a2 commit 133795c
Show file tree
Hide file tree
Showing 27 changed files with 3,415 additions and 2,696 deletions.
1 change: 1 addition & 0 deletions DeBankUI/Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static async Task Main(string[] args)

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMudServices();
builder.Services.AddBlazorDownloadFile();

await builder.Build().RunAsync();
}
Expand Down
19 changes: 15 additions & 4 deletions DeBankUI/Components/BaseChartComponent.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
using Microsoft.AspNetCore.Components;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using Microsoft.AspNetCore.Components;
using LiveChartsCore.SkiaSharpView.Painting;
using DeBankUI.Utils;

namespace DeBankUI.Components
{
public class BaseChartComponent : ComponentBase
public abstract class BaseChartComponent : ComponentBase
{
public void DownloadChartData()
public ISeries[] Series { get; set; }

Check warning on line 11 in DeBankUI/Components/BaseChartComponent.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable property 'Series' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public Axis[] YAxes { get; set; }

Check warning on line 12 in DeBankUI/Components/BaseChartComponent.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable property 'YAxes' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public Axis[] XAxes { get; set; }

Check warning on line 13 in DeBankUI/Components/BaseChartComponent.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable property 'XAxes' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public DrawMarginFrame DrawMarginFrame => new()
{
Fill = new SolidColorPaint(Colors.ChartBackground),
Stroke = new SolidColorPaint(Colors.ChartBorder, 2)
};

}
public abstract byte[] DownloadChartData();
}
}
2 changes: 2 additions & 0 deletions DeBankUI/DeBankUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BlazorDownloadFileFast" Version="1.0.0-preview-01" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Blazor" Version="2.0.0-rc1.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.25" PrivateAssets="all" />
Expand Down
8 changes: 4 additions & 4 deletions DeBankUI/Pages/Michal/DeBankUsersPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<Web3RegistrationsChart>
<Web3RegistrationsChart @ref="web3RegistrationsChart">

</Web3RegistrationsChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(web3RegistrationsChart, "Web3RegistrationsChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -34,12 +34,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<OfficialProfileRegistrationsChart>
<OfficialProfileRegistrationsChart @ref="officialProfileRegistrationsChart">

</OfficialProfileRegistrationsChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(officialProfileRegistrationsChart, "OfficialProfilesChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand Down
14 changes: 12 additions & 2 deletions DeBankUI/Pages/Michal/DeBankUsersPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;

namespace DeBankUI.Pages.Michal
{
public partial class DeBankUsersPage
{
public void DownloadChartData()
{
[Inject]
public IBlazorDownloadFileService BlazorDownloadFileService { get; set; }

private Web3RegistrationsChart web3RegistrationsChart;
private OfficialProfileRegistrationsChart officialProfileRegistrationsChart;

public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
}
}
}
16 changes: 8 additions & 8 deletions DeBankUI/Pages/Michal/LuckyDrawsPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.LuckyDrawsTotalChart>
<DeBankUI.Shared.Michal.LuckyDrawsTotalChart @ref="luckyDrawsTotalChart">

</DeBankUI.Shared.Michal.LuckyDrawsTotalChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(luckyDrawsTotalChart, "TotalLuckyDrawsChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -32,12 +32,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.LuckyDrawsDailyChart>
<DeBankUI.Shared.Michal.LuckyDrawsDailyChart @ref="luckyDrawsDailyChart">

</DeBankUI.Shared.Michal.LuckyDrawsDailyChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(luckyDrawsDailyChart, "DailyLuckyDrawsChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -51,12 +51,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.LuckyDrawsHistogram>
<DeBankUI.Shared.Michal.LuckyDrawsHistogram @ref="luckyDrawsHistogram">

</DeBankUI.Shared.Michal.LuckyDrawsHistogram>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(luckyDrawsHistogram, "LuckyDrawsHistogram.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -70,12 +70,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.LuckyDrawsWinnersHistogram>
<DeBankUI.Shared.Michal.LuckyDrawsWinnersHistogram @ref="luckyDrawsWinnersHistogram">

</DeBankUI.Shared.Michal.LuckyDrawsWinnersHistogram>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(luckyDrawsWinnersHistogram, "LuckyDrawsWinnersHistogram.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand Down
16 changes: 14 additions & 2 deletions DeBankUI/Pages/Michal/LuckyDrawsPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;

namespace DeBankUI.Pages.Michal
{
public partial class LuckyDrawsPage
{
public void DownloadChartData()
{
[Inject]
public IBlazorDownloadFileService BlazorDownloadFileService { get; set; }

private LuckyDrawsTotalChart luckyDrawsTotalChart;
private LuckyDrawsDailyChart luckyDrawsDailyChart;
private LuckyDrawsHistogram luckyDrawsHistogram;
private LuckyDrawsWinnersHistogram luckyDrawsWinnersHistogram;

public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
}
}
}
17 changes: 8 additions & 9 deletions DeBankUI/Pages/Michal/RewardPoolsPage.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@using DeBankUI.Components;
@using LiveChartsCore.SkiaSharpView.Blazor
@page "/michal/reward-pools"
@inherits BaseChartComponent

<MudGrid>
<MudItem xs="6">
Expand All @@ -14,12 +13,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.RewardPoolsTotalChart>
<DeBankUI.Shared.Michal.RewardPoolsTotalChart @ref="rewardPoolsTotalChart">

</DeBankUI.Shared.Michal.RewardPoolsTotalChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(rewardPoolsTotalChart, "RewardPoolsTotalChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -33,12 +32,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.RewardPoolsDailyChart>
<DeBankUI.Shared.Michal.RewardPoolsDailyChart @ref="rewardPoolsDailyChart">

</DeBankUI.Shared.Michal.RewardPoolsDailyChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(rewardPoolsDailyChart, "RewardPoolsDailyChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -52,12 +51,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.RewardPoolsHistogram>
<DeBankUI.Shared.Michal.RewardPoolsHistogram @ref="rewardPoolsHistogram">

</DeBankUI.Shared.Michal.RewardPoolsHistogram>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(rewardPoolsHistogram, "RewardPoolsHistogram.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -71,12 +70,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.RewardPoolsEarnersHistogram>
<DeBankUI.Shared.Michal.RewardPoolsEarnersHistogram @ref="rewardPoolsEarnersHistogram">

</DeBankUI.Shared.Michal.RewardPoolsEarnersHistogram>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(rewardPoolsEarnersHistogram, "RewardPoolsEarnersHistogram.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand Down
14 changes: 12 additions & 2 deletions DeBankUI/Pages/Michal/RewardPoolsPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;

namespace DeBankUI.Pages.Michal
{
public partial class RewardPoolsPage
{
public void DownloadChartData()
[Inject]
public IBlazorDownloadFileService BlazorDownloadFileService { get; set; }
private RewardPoolsTotalChart rewardPoolsTotalChart;
private RewardPoolsDailyChart rewardPoolsDailyChart;
private RewardPoolsHistogram rewardPoolsHistogram;
private RewardPoolsEarnersHistogram rewardPoolsEarnersHistogram;
public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{

var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
}
}
}
12 changes: 6 additions & 6 deletions DeBankUI/Pages/Michal/StreamActivityPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.StreamActivityTotalChart>
<DeBankUI.Shared.Michal.StreamActivityTotalChart @ref="streamActivityTotalChart">

</DeBankUI.Shared.Michal.StreamActivityTotalChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(streamActivityTotalChart, "StreamActivityTotalChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -32,12 +32,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.StreamActivityDailyChart>
<DeBankUI.Shared.Michal.StreamActivityDailyChart @ref="streamActivityDailyChart">

</DeBankUI.Shared.Michal.StreamActivityDailyChart>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(streamActivityDailyChart, "StreamActivityDailyChart.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand All @@ -51,12 +51,12 @@
</CardHeaderContent>
</MudCardHeader>
<MudCardContent style="height:600px">
<DeBankUI.Shared.Michal.StreamActivityHistogram>
<DeBankUI.Shared.Michal.StreamActivityHistogram @ref="streamActivityHistogram">

</DeBankUI.Shared.Michal.StreamActivityHistogram>
</MudCardContent>
<MudCardActions>
<MudButton Class="rounded-0" Variant="Variant.Outlined" OnClick="DownloadChartData" Color="Color.Primary">Get data</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="rounded-0" Variant="Variant.Outlined" OnClick="@(async () => await DownloadChartData(streamActivityHistogram, "StreamActicityHistogram.csv"))" Color="Color.Primary">Get data</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
Expand Down
14 changes: 12 additions & 2 deletions DeBankUI/Pages/Michal/StreamActivityPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;

namespace DeBankUI.Pages.Michal
{
public partial class StreamActivityPage
{
public void DownloadChartData()
{
[Inject]
public IBlazorDownloadFileService BlazorDownloadFileService { get; set; }

Check warning on line 19 in DeBankUI/Pages/Michal/StreamActivityPage.razor.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable property 'BlazorDownloadFileService' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
private StreamActivityTotalChart streamActivityTotalChart;

Check warning on line 20 in DeBankUI/Pages/Michal/StreamActivityPage.razor.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable field 'streamActivityTotalChart' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
private StreamActivityDailyChart streamActivityDailyChart;

Check warning on line 21 in DeBankUI/Pages/Michal/StreamActivityPage.razor.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable field 'streamActivityDailyChart' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
private StreamActivityHistogram streamActivityHistogram;

Check warning on line 22 in DeBankUI/Pages/Michal/StreamActivityPage.razor.cs

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable field 'streamActivityHistogram' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
}
}
}
Loading

0 comments on commit 133795c

Please sign in to comment.