-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MeetMichal/react
React
- Loading branch information
Showing
149 changed files
with
22,566 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build & deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Installing Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Installing NPM packages | ||
run: npm ci | ||
|
||
- name: Building project | ||
run: npm run build | ||
|
||
- name: Running tests | ||
run: npm run test | ||
|
||
- name: Uploading production-ready build files | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: production-files | ||
path: ./build | ||
|
||
deploy: | ||
name: Deploy | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- name: Downloading artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: production-files | ||
path: ./build | ||
|
||
- name: Deploying to gh-pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./build |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="CsvHelper" Version="30.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34330.188 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebankSnapshots", "DebankSnapshots.csproj", "{1D34E357-E935-422B-B9AC-21774F5FA31C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1D34E357-E935-422B-B9AC-21774F5FA31C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1D34E357-E935-422B-B9AC-21774F5FA31C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1D34E357-E935-422B-B9AC-21774F5FA31C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1D34E357-E935-422B-B9AC-21774F5FA31C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5B716DFD-82CC-4F73-AF26-44D073137644} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using CsvHelper; | ||
using System.Globalization; | ||
|
||
namespace DebankSnapshots | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
var directory = "C:\\Repozytoria\\Inne\\web3-data\\valuable-users"; | ||
|
||
var userSnapshotsByusdValue = new List<UserSnapshotModel>(); | ||
var userSnapshotsByFollowerCount = new List<UserSnapshotModel>(); | ||
var userSnapshotsByTvf = new List<UserSnapshotModel>(); | ||
|
||
foreach(var file in System.IO.Directory.GetFiles(directory).Where(p => p.EndsWith(".json"))) | ||
{ | ||
var fileName = System.IO.Path.GetFileName(file); | ||
var date = System.DateTime.Parse(fileName.Substring(0, fileName.IndexOf('.'))); | ||
var json = System.IO.File.ReadAllText(file); | ||
var users = System.Text.Json.JsonSerializer.Deserialize<UserModel[]>(json); | ||
|
||
var top10ByUsdValue = users.Where(u => !String.IsNullOrWhiteSpace(u.Web3Id)).OrderByDescending(u => u.UsdValue).Take(10).Select(u => new UserSnapshotModel(u, date)); | ||
var top10ByFollowerCount = users.Where(u => !String.IsNullOrWhiteSpace(u.Web3Id)).OrderByDescending(u => u.FollowerCount).Take(10).Select(u => new UserSnapshotModel(u, date)); | ||
var top10ByTvf = users.Where(u => !String.IsNullOrWhiteSpace(u.Web3Id)).OrderByDescending(u => u.Tvf).Take(10).Select(u => new UserSnapshotModel(u, date)); | ||
|
||
userSnapshotsByusdValue.AddRange(top10ByUsdValue); | ||
userSnapshotsByFollowerCount.AddRange(top10ByFollowerCount); | ||
userSnapshotsByTvf.AddRange(top10ByTvf); | ||
} | ||
|
||
userSnapshotsByusdValue = userSnapshotsByusdValue.OrderBy(u => u.SnapshotDate).ToList(); | ||
userSnapshotsByFollowerCount = userSnapshotsByFollowerCount.OrderBy(u => u.SnapshotDate).ToList(); | ||
userSnapshotsByTvf = userSnapshotsByTvf.OrderBy(u => u.SnapshotDate).ToList(); | ||
|
||
using (var writer = new StreamWriter("SnapshotByUsdValue.csv")) | ||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) | ||
{ | ||
csv.WriteRecords(userSnapshotsByusdValue); | ||
} | ||
|
||
using (var writer = new StreamWriter("SnapshotByFollowerCount.csv")) | ||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) | ||
{ | ||
csv.WriteRecords(userSnapshotsByFollowerCount); | ||
} | ||
|
||
using (var writer = new StreamWriter("SnapshotByTvf.csv")) | ||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) | ||
{ | ||
csv.WriteRecords(userSnapshotsByTvf); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace DebankSnapshots | ||
{ | ||
public class UserModel | ||
{ | ||
[JsonPropertyName("id")] | ||
public string Id { get; set; } | ||
[JsonPropertyName("usd_value")] | ||
public double UsdValue { get; set; } | ||
[JsonPropertyName("web3_id")] | ||
public string Web3Id { get; set; } | ||
[JsonPropertyName("follower_count")] | ||
public int FollowerCount { get; set; } | ||
[JsonPropertyName("tvf")] | ||
public double Tvf { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace DebankSnapshots | ||
{ | ||
public class UserSnapshotModel : UserModel | ||
{ | ||
[JsonPropertyName("snapshot_date")] | ||
public DateTime SnapshotDate { get; set; } | ||
|
||
public UserSnapshotModel(UserModel user, DateTime snapshotDate) | ||
{ | ||
this.Id = user.Id; | ||
this.UsdValue = user.UsdValue; | ||
this.Web3Id = user.Web3Id; | ||
this.FollowerCount = user.FollowerCount; | ||
this.Tvf = user.Tvf; | ||
this.SnapshotDate = snapshotDate; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Getting Started with Create React App | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). |
Oops, something went wrong.