Skip to content

Commit bf215c6

Browse files
committed
Address review feedback from CodeRabbit and GHAS
- add CI test step and pin Node version in workflow - switch social meta images to absolute chainstats.org URLs - move testing-library packages to devDependencies - harden icon check script logging and reduce format fragility - remove stale commented import and enforce case-insensitive search matching - guard ProtocolIcon against null/undefined protocol names - rework table sort/filter state to avoid row-span lag during reordering - move protocol cell inline styles into TableWrapper.scss - add focus-visible outline for theme toggle accessibility - make size formatter handle 1000 GB boundary and consistent TB precision - replace hardcoded error color with theme variable - iterate parseProtocolData with Object.keys for consistency - deduplicate protocol search aliases - convert entrypoint to index.jsx and update index.html module path - split ProtocolIcon SVG checks into parameterized tests - move ProtocolCards Card component to module scope
1 parent d2d5cc6 commit bf215c6

18 files changed

Lines changed: 199 additions & 119 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: 20
20+
node-version: 20.18.0
2121
cache: npm
2222

2323
- name: Install dependencies
@@ -26,5 +26,8 @@ jobs:
2626
- name: Check protocol icon coverage
2727
run: npm run check:protocol-icons
2828

29+
- name: Run tests
30+
run: npm run test
31+
2932
- name: Build app
3033
run: npm run build

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
property="og:description"
2626
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."
2727
/>
28-
<meta property="og:image" content="/og-image.png" />
28+
<meta property="og:image" content="https://chainstats.org/og-image.png" />
2929

3030
<meta name="twitter:card" content="summary_large_image" />
3131
<meta name="twitter:url" content="https://chainstats.org" />
@@ -37,7 +37,7 @@
3737
name="twitter:description"
3838
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."
3939
/>
40-
<meta name="twitter:image" content="/og-image.png" />
40+
<meta name="twitter:image" content="https://chainstats.org/og-image.png" />
4141

4242
<script
4343
async
@@ -55,6 +55,6 @@
5555
<body>
5656
<noscript>You need to enable JavaScript to run this app.</noscript>
5757
<div id="root"></div>
58-
<script type="module" src="/src/index.js"></script>
58+
<script type="module" src="/src/index.jsx"></script>
5959
</body>
6060
</html>

package-lock.json

Lines changed: 27 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
"private": false,
66
"dependencies": {
77
"@ant-design/icons": "^6.1.0",
8-
"@testing-library/jest-dom": "^6.9.1",
9-
"@testing-library/react": "^16.3.2",
10-
"@testing-library/user-event": "^14.6.1",
118
"antd": "^6.3.0",
129
"axios": "^1.13.5",
1310
"cryptocurrency-icons": "^0.18.1",
@@ -26,6 +23,9 @@
2623
"deploy": "gh-pages -d dist"
2724
},
2825
"devDependencies": {
26+
"@testing-library/jest-dom": "^6.9.1",
27+
"@testing-library/react": "^16.3.2",
28+
"@testing-library/user-event": "^14.6.1",
2929
"@vitejs/plugin-react": "^5.0.2",
3030
"gh-pages": "^6.3.0",
3131
"jsdom": "^28.1.0",

scripts/check-protocol-icons.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const protocolIconPath = path.join(
2626

2727
const protocolMetadata = JSON.parse(fs.readFileSync(protocolMetadataPath, 'utf8'));
2828

29+
// Keep this in sync with src/helpers/protocolDisplay.js for script-only runtime usage.
2930
const capitalizeFirstLetter = (value) => {
3031
if (!value) {
3132
return '';
@@ -44,9 +45,7 @@ const formatProtocolDisplayName = (protocolSlug) => {
4445

4546
const extractIconKeys = () => {
4647
const fileContent = fs.readFileSync(protocolIconPath, 'utf8');
47-
const iconMatches = fileContent.matchAll(
48-
/^\s{2}(['A-Za-z0-9\s.-]+):\s*</gm
49-
);
48+
const iconMatches = fileContent.matchAll(/^\s*(['A-Za-z0-9\s.-]+):\s*</gm);
5049

5150
return new Set(
5251
Array.from(iconMatches).map((match) =>
@@ -132,10 +131,7 @@ const main = async () => {
132131
.sort();
133132

134133
if (missingIconProtocols.length) {
135-
console.error('Protocol icons missing for currently visible protocols:');
136-
missingIconProtocols.forEach((protocolName) => {
137-
console.error(`- ${protocolName}`);
138-
});
134+
console.error('Protocol icons missing for one or more visible protocols.');
139135
process.exitCode = 1;
140136
return;
141137
}
@@ -146,6 +142,8 @@ const main = async () => {
146142
};
147143

148144
main().catch((error) => {
149-
console.error(`Protocol icon check failed: ${error.message}`);
145+
console.error(
146+
'Protocol icon check failed due to an invalid or unavailable API response.'
147+
);
150148
process.exitCode = 1;
151149
});

src/App.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { lazy, Suspense, useEffect, useState } from 'react';
22
import processData from './helpers/getData';
3-
4-
// import PlannedUpgrades from "./components/PlannedUpgrades/PlannedUpgrades";
53
import LayoutWrapper from './components/LayoutWrapper/LayoutWrapper';
64
import { Input } from 'antd';
75
import { SearchOutlined } from '@ant-design/icons';
@@ -46,7 +44,7 @@ export default function App() {
4644
setSearchResult(
4745
initialData.filter((item) => {
4846
return getProtocolSearchAliases(item.protocol).some((alias) =>
49-
alias.includes(searchValue)
47+
alias.toLowerCase().includes(searchValue)
5048
);
5149
})
5250
);

src/App.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
&_error {
2323
text-align: center;
2424
line-height: 140%;
25-
color: #c62828;
25+
color: var(--color-typo-error);
2626
}
2727
}
2828

src/components/Header/Header.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
color: var(--color-typo-primary);
4848
}
4949

50+
&:focus-visible {
51+
outline: 2px solid var(--color-typo-brand);
52+
outline-offset: 2px;
53+
}
54+
5055
.anticon {
5156
display: inline-flex;
5257
font-size: 14px;

0 commit comments

Comments
 (0)