Skip to content

Commit 6b550ba

Browse files
authored
Merge pull request #15 from chainstacklabs/codex/vite-react19-ui-polish
Migrate to Vite/React 19 and polish protocol table UX
2 parents 982bad8 + b51c648 commit 6b550ba

40 files changed

Lines changed: 5897 additions & 31216 deletions

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build-and-check:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 24.13.1
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Check protocol icon coverage
27+
run: npm run check:protocol-icons
28+
29+
- name: Run tests
30+
run: npm run test
31+
32+
- name: Build app
33+
run: npm run build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# production
1212
/build
13+
/dist
1314

1415
# misc
1516
.DS_Store

AGENTS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains a React application that displays blockchain node stati
55
## 1. Use Development Server for Testing
66

77
* **Always use `npm start`** for local development.
8-
* **Test UI changes** in browser at http://localhost:3000.
8+
* **Test UI changes** in browser at http://localhost:5173.
99
* **Do _not_ deploy to production** during agent development sessions.
1010
* **Check console** for any React warnings or errors.
1111

@@ -16,7 +16,7 @@ If you update dependencies:
1616
1. Install packages with `npm install`.
1717
2. Update specific packages with `npm update <package>`.
1818
3. Run `npm audit fix` to resolve vulnerabilities.
19-
4. Verify compatibility with React 18 and Ant Design 5.
19+
4. Verify compatibility with current React and Ant Design versions in `package.json`.
2020

2121
## 3. Development Workflow
2222

@@ -95,8 +95,8 @@ src/
9595
When adding new protocols:
9696

9797
1. Add SVG icon to `src/components/ProtocolIcon/`
98-
2. Import in `ProtocolIcon.js`
99-
3. Add case in switch statement
98+
2. Import in `ProtocolIcon.jsx`
99+
3. Add mapping in `iconTypes`
100100
4. Test icon rendering
101101

102102
## 10. Search Functionality
@@ -129,7 +129,7 @@ For GitHub Pages deployment:
129129

130130
### Add New Protocol
131131
1. Add icon to ProtocolIcon directory
132-
2. Update ProtocolIcon.js switch statement
132+
2. Update `iconTypes` in `ProtocolIcon.jsx`
133133
3. Test data display in table/cards
134134

135135
### Update Styling
@@ -184,4 +184,4 @@ Before deployment:
184184

185185
---
186186

187-
Following these practices ensures smooth React development, maintains code quality, and enables reliable deployment to production. Always test thoroughly in development before deploying to chainstats.org.
187+
Following these practices ensures smooth React development, maintains code quality, and enables reliable deployment to production. Always test thoroughly in development before deploying to chainstats.org.

README.md

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,89 @@
1-
# Getting Started with Create React App
1+
# Chainstats
22

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
3+
Chainstats is a React + Vite app that visualizes Chainstack blockchain node storage sizes by protocol, network, node type, and client.
44

5-
## Available Scripts
5+
Production URL: [https://chainstats.org](https://chainstats.org)
66

7-
In the project directory, you can run:
7+
## Data Source
88

9-
### `npm start`
9+
- API endpoint: `https://console.chainstack.com/api/core/v1/calc/`
10+
- Source path: `Enterprise.protocols`
11+
- Inclusion rule in UI:
12+
- Use only `dedicated` entries
13+
- Include only nodes where `type === "public"`
14+
- Skip entries without `node_info.storage.size_required`
1015

11-
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
16+
## Features
1317

14-
The page will reload when you make changes.\
15-
You may also see any lint errors in the console.
18+
- Protocol/network/client table with sorting and filtering.
19+
- Search by protocol slug and friendly display aliases.
20+
- Full and archive node-type rows.
21+
- Multi-client visibility per network/type.
22+
- Protocol icons with fallback badges for unmapped protocols.
23+
- Light/dark theme support.
1624

17-
### `npm run build`
25+
## Stack
1826

19-
Builds the app for production to the `build` folder.\
20-
It correctly bundles React in production mode and optimizes the build for the best performance.
27+
- React 19
28+
- Vite 7
29+
- Ant Design 6
30+
- Sass
31+
- Axios
2132

22-
The build is minified and the filenames include the hashes.\
23-
Your app is ready to be deployed!
33+
## Local Development
2434

25-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
35+
### Prerequisites
2636

27-
### `npm run deploy`
37+
- Node.js 24+
38+
- npm 9+
2839

29-
Will deploy app on gh-pages
40+
### Install
41+
42+
```bash
43+
npm install
44+
```
45+
46+
### Start dev server
47+
48+
```bash
49+
npm start
50+
```
51+
52+
Open [http://localhost:5173](http://localhost:5173).
53+
54+
## Scripts
55+
56+
- `npm start`: run Vite dev server.
57+
- `npm run build`: create production build in `dist/`.
58+
- `npm run preview`: preview built app locally.
59+
- `npm run test`: run Vitest (`--passWithNoTests`).
60+
- `npm run check:protocol-icons`: compare visible API protocols to icon map coverage.
61+
- `npm run deploy`: publish `dist/` to GitHub Pages.
62+
63+
## CI
64+
65+
Workflow: `.github/workflows/ci.yml`
66+
67+
Runs:
68+
1. `npm ci`
69+
2. `npm run check:protocol-icons`
70+
3. `npm run build`
71+
72+
## Protocol Metadata
73+
74+
Shared protocol formatting lives in:
75+
76+
- `src/helpers/protocolMetadata.json`
77+
- `src/helpers/protocolDisplay.js`
78+
79+
Use these helpers for protocol naming and network formatting in UI components.
80+
81+
## Deployment
82+
83+
1. Run checks:
84+
- `npm run check:protocol-icons`
85+
- `npm run build`
86+
2. Deploy:
87+
- `npm run deploy`
88+
3. Verify:
89+
- [https://chainstats.org](https://chainstats.org)
Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
5+
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77

8-
<!-- Primary Meta Tags -->
98
<title>Blockchain Size - How Much Storage Does A Blockchain Use?</title>
109
<meta
1110
name="title"
@@ -16,9 +15,8 @@
1615
content="Ever wondered what is the size of a blockchain in terms of storage? See how many gigabytes of data are stored on the main blockchain networks."
1716
/>
1817

19-
<!-- Open Graph / Facebook -->
2018
<meta property="og:type" content="website" />
21-
<meta property="og:url" content="%PUBLIC_URL%" />
19+
<meta property="og:url" content="https://chainstats.org" />
2220
<meta
2321
property="og:title"
2422
content="Blockchain Size - How Much Storage Does A Blockchain Use?"
@@ -27,28 +25,20 @@
2725
property="og:description"
2826
content="Ever wondered what is the size of a blockchain in terms of storage? See how many gigabytes of data are stored on the main blockchain networks."
2927
/>
30-
<meta
31-
property="og:image"
32-
content="https://raw.githubusercontent.com/chainstacklabs/chainstats/main/public/og-image.png"
33-
/>
28+
<meta property="og:image" content="https://chainstats.org/og-image.png" />
3429

35-
<!-- Twitter -->
3630
<meta name="twitter:card" content="summary_large_image" />
37-
<meta name="twitter:url" content="%PUBLIC_URL%" />
31+
<meta name="twitter:url" content="https://chainstats.org" />
3832
<meta
3933
name="twitter:title"
4034
content="Blockchain Size - How Much Storage Does A Blockchain Use?"
4135
/>
42-
4336
<meta
4437
name="twitter:description"
4538
content="Ever wondered what is the size of a blockchain in terms of storage? See how many gigabytes of data are stored on the main blockchain networks."
4639
/>
47-
<meta
48-
name="twitter:image"
49-
content="https://raw.githubusercontent.com/chainstacklabs/chainstats/main/public/og-image.png"
50-
/>
51-
<!-- Google tag (gtag.js) -->
40+
<meta name="twitter:image" content="https://chainstats.org/og-image.png" />
41+
5242
<script
5343
async
5444
src="https://www.googletagmanager.com/gtag/js?id=G-EEW4LPHTW7"
@@ -61,10 +51,10 @@
6151
gtag('js', new Date());
6252
gtag('config', 'G-EEW4LPHTW7');
6353
</script>
64-
<!-- Google tag (gtag.js) -->
6554
</head>
6655
<body>
6756
<noscript>You need to enable JavaScript to run this app.</noscript>
6857
<div id="root"></div>
58+
<script type="module" src="/src/index.jsx"></script>
6959
</body>
7060
</html>

0 commit comments

Comments
 (0)