Commit 32713c67 authored by isstuev's avatar isstuev

fix

parent 59a7af71
...@@ -44,5 +44,6 @@ The app instance could be customized by passing following variables to NodeJS en ...@@ -44,5 +44,6 @@ The app instance could be customized by passing following variables to NodeJS en
| group | `mainnets \| testnets \| other` | Indicates in which tab network appears in the menu | `"mainnets"` | | group | `mainnets \| testnets \| other` | Indicates in which tab network appears in the menu | `"mainnets"` |
| isAccountSupported | `boolean` *(optional)* | Set to true if network has account feature | `true` | | isAccountSupported | `boolean` *(optional)* | Set to true if network has account feature | `true` |
| icon | `string` *(optional)* | Network icon; if not provided, will fallback to icon predefined in the project; if the project doesn't have icon for such network then the common placeholder will be shown; *Note* that icon size should be 30px by 30px | `"https://www.fillmurray.com/60/60"` | | icon | `string` *(optional)* | Network icon; if not provided, will fallback to icon predefined in the project; if the project doesn't have icon for such network then the common placeholder will be shown; *Note* that icon size should be 30px by 30px | `"https://www.fillmurray.com/60/60"` |
| logo | `string` *(optional)* | Network logo; if not provided, will fallback to logo predefined in the project; if the project doesn't have logo for such network then the common placeholder will be shown; *Note* that logo height should be 20px and width less than 120px | `"https://www.fillmurray.com/240/40"` |
*Note* the base path for the network is built up from its `type` and `subType` like so `https://blockscout.com/<type>/<subType>` *Note* the base path for the network is built up from its `type` and `subType` like so `https://blockscout.com/<type>/<subType>`
\ No newline at end of file
const parseNetworkConfig = require('../../lib/networks/parseNetworkConfig');
async function rewrites() {
// there can be networks without subtype
// routing in nextjs allows optional params only at the end of the path
// if there are paths with subtype and subsubtype, we will change the routing
// but so far we think we're ok with this hack
const networksFromConfig = parseNetworkConfig();
return networksFromConfig.filter(n => !n.subType).map(n => ({
source: `/${ n.type }/:slug*`,
destination: `/${ n.type }/mainnet/:slug*`,
}));
}
module.exports = rewrites;
import type { Network } from 'types/networks'; import type { Network } from 'types/networks';
import arbitrumIcon from 'icons/networks/arbitrum.svg'; import arbitrumIcon from 'icons/networks/icons/arbitrum.svg';
import artisIcon from 'icons/networks/artis.svg'; import artisIcon from 'icons/networks/icons/artis.svg';
import ethereumClassicIcon from 'icons/networks/ethereum-classic.svg'; import ethereumClassicIcon from 'icons/networks/icons/ethereum-classic.svg';
import ethereumIcon from 'icons/networks/ethereum.svg'; import ethereumIcon from 'icons/networks/icons/ethereum.svg';
import gnosisIcon from 'icons/networks/gnosis.svg'; import gnosisIcon from 'icons/networks/icons/gnosis.svg';
import optimismIcon from 'icons/networks/optimism.svg'; import optimismIcon from 'icons/networks/icons/optimism.svg';
import poaSokolIcon from 'icons/networks/poa-sokol.svg'; import poaSokolIcon from 'icons/networks/icons/poa-sokol.svg';
import poaIcon from 'icons/networks/poa.svg'; import poaIcon from 'icons/networks/icons/poa.svg';
import rskIcon from 'icons/networks/rsk.svg'; import rskIcon from 'icons/networks/icons/rsk.svg';
import parseNetworkConfig from './parseNetworkConfig'; import parseNetworkConfig from './parseNetworkConfig';
...@@ -27,18 +27,18 @@ const ICONS: Record<string, React.FunctionComponent<React.SVGAttributes<SVGEleme ...@@ -27,18 +27,18 @@ const ICONS: Record<string, React.FunctionComponent<React.SVGAttributes<SVGEleme
}; };
const LOGOS: Record<string, React.FunctionComponent<React.SVGAttributes<SVGElement>>> = { const LOGOS: Record<string, React.FunctionComponent<React.SVGAttributes<SVGElement>>> = {
'xdai/mainnet': require('icons/networkLogos/gnosis.svg'), 'xdai/mainnet': require('icons/networks/logos/gnosis.svg'),
'eth/mainnet': require('icons/networkLogos/eth.svg'), 'eth/mainnet': require('icons/networks/logos/eth.svg'),
'etc/mainnet': require('icons/networkLogos/etc.svg'), 'etc/mainnet': require('icons/networks/logos/etc.svg'),
'poa/core': require('icons/networkLogos/poa.svg'), 'poa/core': require('icons/networks/logos/poa.svg'),
'rsk/mainnet': require('icons/networkLogos/rsk.svg'), 'rsk/mainnet': require('icons/networks/logos/rsk.svg'),
'xdai/testnet': require('icons/networkLogos/gnosis.svg'), 'xdai/testnet': require('icons/networks/logos/gnosis.svg'),
'poa/sokol': require('icons/networkLogos/sokol.svg'), 'poa/sokol': require('icons/networks/logos/sokol.svg'),
'artis/sigma1': require('icons/networkLogos/artis.svg'), 'artis/sigma1': require('icons/networks/logos/artis.svg'),
'lukso/l14': require('icons/networkLogos/lukso.svg'), 'lukso/l14': require('icons/networks/logos/lukso.svg'),
astar: require('icons/networkLogos/astar.svg'), astar: require('icons/networks/logos/astar.svg'),
shiden: require('icons/networkLogos/shiden.svg'), shiden: require('icons/networks/logos/shiden.svg'),
shibuya: require('icons/networkLogos/shibuya.svg'), shibuya: require('icons/networks/logos/shibuya.svg'),
}; };
const NETWORKS: Array<Network> = (() => { const NETWORKS: Array<Network> = (() => {
......
...@@ -3,6 +3,7 @@ const withReactSvg = require('next-react-svg'); ...@@ -3,6 +3,7 @@ const withReactSvg = require('next-react-svg');
const path = require('path'); const path = require('path');
const headers = require('./configs/nextjs/headers'); const headers = require('./configs/nextjs/headers');
const rewrites = require('./configs/nextjs/rewrites');
const moduleExports = { const moduleExports = {
include: path.resolve(__dirname, 'icons'), include: path.resolve(__dirname, 'icons'),
...@@ -27,17 +28,7 @@ const moduleExports = { ...@@ -27,17 +28,7 @@ const moduleExports = {
]; ];
}, },
headers, headers,
async rewrites() { rewrites,
// there can be networks without subtype
// routing in nextjs allows optional params only at the end of the path
// if there are paths with subtype and subsubtype, we will change the routing
// but so far we think we're ok with this hack
const NETWORKS = JSON.parse(process.env.NEXT_PUBLIC_SUPPORTED_NETWORKS);
return NETWORKS.filter(n => !n.subType).map(n => ({
source: `/${ n.type }/:slug*`,
destination: `/${ n.type }/mainnet/:slug*`,
}));
},
output: 'standalone', output: 'standalone',
}; };
......
...@@ -5,7 +5,7 @@ import React from 'react'; ...@@ -5,7 +5,7 @@ import React from 'react';
import type { Network } from 'types/networks'; import type { Network } from 'types/networks';
import checkIcon from 'icons/check.svg'; import checkIcon from 'icons/check.svg';
import placeholderIcon from 'icons/networks/placeholder.svg'; import placeholderIcon from 'icons/networks/icons/placeholder.svg';
import isAccountRoute from 'lib/networks/isAccountRoute'; import isAccountRoute from 'lib/networks/isAccountRoute';
import useColors from './useColors'; import useColors from './useColors';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment