Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new category to support dapps #527

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ module.exports = {
getManualLogos,
getSupportedChains,
getApiProviders,
getSupportedFeeds
getSupportedFeeds,
getDapps
};

function getDapps() {
return [];
}

function getApiProviders() {
const providers = [...new Set(dapis.map((dapi) => dapi.providers).flat())];
const filteredApiProviders = providers.filter((api) => !api.match(/(.*)(-mock)/));
Expand All @@ -43,8 +48,10 @@ function getSupportList(mode) {
return getSupportedFeeds();
case 'api-provider':
return getApiProviders();
case 'dapp':
return getDapps();
default:
break;
return [];
}
}

Expand All @@ -56,8 +63,10 @@ function getManualLogos(mode) {
return [];
case 'api-provider':
return [];
case 'dapp':
return [];
default:
break;
return [];
}
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"optimize-chain-logos": "rimraf ./optimized/chain & svgo -q -p 8 -f ./raw/chains -o ./optimized/chain",
"optimize-symbol-logos": "rimraf ./optimized/symbol & svgo -q -p 8 -f ./raw/symbols -o ./optimized/symbol",
"optimize-api-provider-logos": "rimraf ./optimized/api-provider & svgo -q -p 8 -f ./raw/api-providers -o ./optimized/api-provider",
"build": "pnpm run optimize-chain-logos && pnpm run optimize-symbol-logos && pnpm run optimize-api-provider-logos && node scripts/build-svg.js",
"optimize-dapp-logos": "rimraf ./optimized/dapp & svgo -q -p 8 -f ./raw/dapps -o ./optimized/dapp",
"build": "pnpm run optimize-chain-logos && pnpm run optimize-symbol-logos && pnpm run optimize-api-provider-logos && pnpm run optimize-dapp-logos && node scripts/build-svg.js",
"fetch": "node scripts/fetch-missing.js",
"version-check": "node scripts/version-check.js",
"package": "pnpm run build",
Expand Down
17 changes: 17 additions & 0 deletions raw/dapps/Placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions scripts/build-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ const camelcase = require('camelcase');

const outputPath = './dist';

const categories = ['chain', 'symbol', 'api-provider'];
const categories = ['chain', 'symbol', 'api-provider', 'dapp'];

let chainLightLogos = [];
let apiProviderLightLogos = [];
let symbolLightLogos = [];
let dappsLightLogos = [];

function getLogoList(mode) {
switch (mode) {
Expand All @@ -20,8 +21,10 @@ function getLogoList(mode) {
return [...symbolLightLogos, ...utils.getManualLogos(mode), ...utils.getSupportedFeeds()];
case 'api-provider':
return [...apiProviderLightLogos, ...utils.getManualLogos(mode), ...utils.getApiProviders()];
case 'dapp':
return [...dappsLightLogos, ...utils.getManualLogos(mode), ...utils.getDapps()];
default:
break;
return [];
}
}

Expand Down Expand Up @@ -119,7 +122,8 @@ async function findLightLogos() {
const [chainFiles, apiProviderFiles, symbolFiles] = await Promise.all([
fs.readdir('./optimized/chain', 'utf-8'),
fs.readdir('./optimized/api-provider', 'utf-8'),
fs.readdir('./optimized/symbol', 'utf-8')
fs.readdir('./optimized/symbol', 'utf-8'),
fs.readdir('./optimized/dapp', 'utf-8')
]);

chainLightLogos = chainFiles.filter((file) => file.includes('light')).map((file) => file.replace('Chain', ''));
Expand Down
2 changes: 2 additions & 0 deletions scripts/fetch-missing.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function getLogoList(mode) {
return [...utils.getManualLogos(mode), ...utils.getSupportedFeeds()];
case 'api-provider':
return [...utils.getManualLogos(mode), ...utils.getApiProviders()];
case 'dapp':
return [...utils.getManualLogos(mode), ...utils.getDapps()];
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/version-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ function getLogoList(mode) {
return [...utils.getManualLogos(mode), ...utils.getSupportedFeeds()];
case 'api-provider':
return [...utils.getManualLogos(mode), ...utils.getApiProviders()];
case 'dapp':
return [...utils.getManualLogos(mode), ...utils.getDapps()];
default:
break;
}
Expand Down
Loading