Skip to content

Commit

Permalink
Merge branch 'dev' into docs/env-example
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiti authored Sep 10, 2024
2 parents d049ddd + 69e6438 commit 1df55ef
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 1,192 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
run: |
touch .env
echo "NEXT_PUBLIC_API_BASE_URL=${{ secrets.NEXT_PUBLIC_API_BASE_URL }}" >> .env
echo "NEXT_PUBLIC_TESTING_MODE=${{ secrets.NEXT_PUBLIC_TESTING_MODE }}" >> .env
- name: run Cypress and Jest
uses: cypress-io/github-action@v6
Expand Down
25 changes: 24 additions & 1 deletion cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
describe('Navigation tests', () => {
beforeEach(() => {
Cypress.env('NEXT_PUBLIC_API_BASE_URL', 'NEXT_PUBLIC_TESTING_MODE');
// Intercept the ecosystem data API call and mock the response using a JSON fixture
cy.fixture('ecosystemMockData.json').then((ecosystemData) => {
cy.intercept('GET', '**/metrics/ecosystem', {
statusCode: 200,
body: ecosystemData,
}).as('fetchEcosystemData');
});

// Intercept the chain data API call and mock the response using a JSON fixture for chainId 324
cy.fixture('chainMockData.json').then((chainData) => {
cy.intercept('GET', '**/metrics/zkchain/*', {
statusCode: 200,
body: chainData,
}).as('fetchChainData');
});

// Intercept the chain data API call and mock the response using a JSON fixture for chainId 324
cy.fixture('nextData.json').then((nextData) => {
cy.intercept('GET', '**/_next/data/**/324.json?chain=324', {
statusCode: 200,
body: nextData,
}).as('fetchNextData');
});

cy.visit('/');
});

Expand Down
258 changes: 258 additions & 0 deletions cypress/fixtures/nextData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
{
"pageProps": {
"chain": {
"chainId": "324",
"chainType": "Rollup",
"baseToken": {
"name": "Ether",
"symbol": "ETH",
"type": "native",
"contractAddress": null,
"decimals": 18,
"imageUrl": "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png?1696501628"
},
"tvl": "342284477.319083050366894310295",
"metadata": {
"iconUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/24091.png",
"name": "ZKsyncERA",
"publicRpcs": ["https://mainnet.era.zksync.io", "https://zksync.drpc.org", "https://zksync.meowrpc.com"],
"explorerUrl": "https://explorer.zksync.io/",
"launchDate": 1679626800
},
"rpc": false
},
"_nextI18Next": {
"initialI18nStore": {
"en": {
"common": {
"HEADER": {
"lightMode": "Light mode",
"darkMode": "Dark mode",
"menu": "Menu",
"search": "Search",
"gasPrice": "L1 Gas Price",
"transfer": "ERC-20 Transfer"
},
"HOME": {
"title": "ZKsync",
"subtitle": "Ecosystem",
"home": "Home",
"LOCKEDASSETS": {
"lockedAssets": "Locked assets",
"others": "Others",
"allTokens": "All tokens"
},
"DASHBOARD": {
"title": "Chain list",
"chain": "Chain",
"chainId": "Chain ID",
"nativeToken": "Native token",
"tvl": "TVL (L1)",
"type": "Type",
"search": "Search (Chain)",
"noRPC": "No RPC",
"noMetadata": "No Metadata",
"searchResults": "Search results",
"enterSearchTerm": "Enter the name or chain ID",
"notFound": "No results found"
}
},
"CHAIN": {
"website": "Website",
"explorer": "Explorer",
"launchDate": "Launch date",
"environment": "Environment",
"nativeToken": "Native token",
"addNetwork": "Add network",
"networkAdded": "Network added",
"chainId": "Chain ID",
"CHAININFORMATION": {
"title": "Chain information",
"chainType": "Chain type",
"lastBlock": "Last block",
"lastBlockVerified": "Last block verified",
"transactionsPerSecond": "Transactions per second",
"totalBatchesCommitted": "Total batches committed",
"totalBatchesExecuted": "Total batches executed",
"totalBatchesVerified": "Total batches verified",
"averageBlockTime": "Average block time",
"notAvailable": "Not available"
},
"TVL": {
"title": "TVL",
"chain": "Chain",
"token": "Token",
"price": "Price",
"tvl": "TVL",
"address": "Contract Address"
},
"RPC": {
"title": "RPCs",
"subtitle": "Statuses",
"status": "Status",
"statusActive": "Active",
"statusInactive": "Inactive",
"showMore": "Show more",
"showLess": "Show less"
},
"FEEPARAMS": {
"title": "Fee params",
"batch": "Batch Overhead L1 Gas",
"maxPubData": "Max public data per batch",
"maxGasBatch": "Max Gas per Batch",
"priorityTxMaxPubdata": "Max priority data"
},
"backButton": "Go back"
},
"TOKENS": {
"title": "Tokens"
},
"WALLET": {
"connection": "Connect Wallet",
"connectTooltip": "Connect your wallet to add this network"
},
"FOOTER": {
"docs": "Documentation",
"github": "GitHub",
"madeWith": "Made with",
"by": "by"
},
"ERROR": {
"title": "Error",
"noApiUrl": "API URL is missing. Please add it in the .env file.",
"networkError": "Network connection error. Please try again later.",
"errorFetchingData": "There was a problem retrieving the data. Please try again later."
},
"LOCALES": {
"en": "English",
"es": "Spanish"
}
}
},
"es": {
"common": {
"HEADER": {
"lightMode": "Modo claro",
"darkMode": "Modo oscuro",
"menu": "Menú",
"search": "Búsqueda",
"gasPrice": "Precio del gas L1",
"transfer": "Transferencia ERC-20"
},
"HOME": {
"title": "ZKsync",
"subtitle": "Ecosistema",
"home": "Inicio",
"LOCKEDASSETS": {
"lockedAssets": "Activos bloqueados",
"others": "Otros",
"allTokens": "Todos los tokens"
},
"DASHBOARD": {
"title": "Lista de cadenas",
"chain": "Cadena",
"chainId": "ID de cadena",
"nativeToken": "Token nativo",
"tvl": "TVL (L1)",
"type": "Tipo",
"search": "Buscar (Cadena)",
"noRPC": "Sin RPC",
"noMetadata": "Sin Metadata",
"searchResults": "Resultados de la búsqueda",
"enterSearchTerm": "Ingrese el nombre o ID de la cadena",
"notFound": "No se encontraron resultados"
}
},
"CHAIN": {
"website": "Sitio web",
"explorer": "Explorador",
"launchDate": "Fecha de lanzamiento",
"environment": "Entorno",
"nativeToken": "Token nativo",
"addNetwork": "Agregar red",
"networkAdded": "Red agregada",
"chainId": "ID de cadena",
"CHAININFORMATION": {
"title": "Información de la cadena",
"chainType": "Tipo de cadena",
"lastBlock": "Último bloque",
"lastBlockVerified": "Último bloque verificado",
"transactionsPerSecond": "Transacciones por segundo",
"totalBatchesCommitted": "Total de lotes comprometidos",
"totalBatchesExecuted": "Total de lotes ejecutados",
"totalBatchesVerified": "Total de lotes verificados",
"averageBlockTime": "Tiempo promedio de bloque",
"notAvailable": "No disponible"
},
"TVL": {
"title": "TVL",
"chain": "Cadena",
"price": "Precio",
"token": "Token",
"tvl": "TVL",
"address": "Dirección del contrato"
},
"RPC": {
"title": "RPCs",
"subtitle": "Estados",
"status": "Estado",
"statusActive": "Activo",
"statusInactive": "Inactivo",
"showMore": "Mostrar más",
"showLess": "Mostrar menos"
},
"FEEPARAMS": {
"title": "Parámetros de gas",
"batch": "Sobrecarga de lote L1 Gas",
"maxPubData": "Máximos datos públicos por lote",
"maxGasBatch": "Máximo gas por lote",
"priorityTxMaxPubdata": "Maximos datos de prioridad"
},
"backButton": "Volver"
},
"TOKENS": {
"title": "Tokens"
},
"FOOTER": {
"docs": "Documentación",
"github": "GitHub",
"madeWithLove": "Hecho con",
"by": "por"
},
"WALLET": {
"connection": "Conectar Wallet",
"connectTooltip": "Conecta tu wallet para agregar esta red"
},
"ERROR": {
"title": "Error",
"noApiUrl": "No se encontró la URL de la API. Por favor, agréguela en el archivo .env.",
"networkError": "Error de conexión de red. Por favor, inténtelo de nuevo más tarde.",
"errorFetchingData": "Lo sentimos, algo salió mal. Por favor, inténtelo de nuevo más tarde."
},
"LOCALES": {
"en": "Inglés",
"es": "Español"
}
}
}
},
"initialLocale": "en",
"ns": ["common"],
"userConfig": {
"i18n": {
"locales": ["en", "es"],
"defaultLocale": "en"
},
"localePath": "/*/public/locales",
"default": {
"i18n": {
"locales": ["en", "es"],
"defaultLocale": "en"
},
"localePath": "/*/public/locales"
}
}
}
},
"__N_SSG": true
}
16 changes: 13 additions & 3 deletions src/components/ChainTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const ChainTable = ({ chains }: TableProps) => {
<STableBody>
{chains?.map((data, index) => {
return (
<STableBodyRow
<STableBodyRowLink
key={index}
onClick={() => handleChainNavigation(data.chainId)}
onKeyDown={(event) => {
Expand Down Expand Up @@ -96,7 +96,7 @@ export const ChainTable = ({ chains }: TableProps) => {
<STableCell sx={{ width: '10%' }}>{formatDataNumber(data.tvl, 0, true)}</STableCell>

<STableCell sx={{ width: '10%' }}>{data.chainType}</STableCell>
</STableBodyRow>
</STableBodyRowLink>
);
})}
</STableBody>
Expand Down Expand Up @@ -150,7 +150,17 @@ export const STableRow = styled(TableRow)(() => {
};
});

export const STableBodyRow = styled(TableRow)(({ theme }) => {
export const STableBodyRow = styled(TableRow)(() => {
const { currentTheme } = useCustomTheme();
return {
'&:not(:last-child)': {
border: currentTheme.border,
},
transition: currentTheme.transition,
};
});

export const STableBodyRowLink = styled(TableRow)(({ theme }) => {
const { currentTheme } = useCustomTheme();
return {
cursor: 'pointer',
Expand Down
2 changes: 0 additions & 2 deletions src/containers/ChainDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export const ChainContainer = styled(Box)(({ theme }) => ({
gap: '4rem',
marginTop: '4rem',
marginBottom: '4rem',
minHeight: 'calc(100vh - 19rem)',
[theme.breakpoints.down('md')]: {
padding: '0 1rem',
minHeight: 'calc(100vh - 23rem)',
},
}));
3 changes: 0 additions & 3 deletions src/containers/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ const DashboardContainer = styled('section')(({ theme }) => {

return {
width: '100%',
minHeight: 'calc(100vh - 19rem)',
...(isSearch && {
padding: '0 7rem',
minHeight: 'calc(100vh - 11rem)',
[theme.breakpoints.down('md')]: {
padding: '0 1rem',
minHeight: 'calc(100vh - 23rem)',
},
}),
};
Expand Down
2 changes: 0 additions & 2 deletions src/containers/Landing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const LandingContainer = styled('main')(({ theme }) => ({
gap: '4rem',
marginTop: '4rem',
marginBottom: '4rem',
minHeight: 'calc(100vh - 19rem)',
[theme.breakpoints.down('md')]: {
padding: '0 1rem',
minHeight: 'calc(100vh - 23rem)',
},
}));
26 changes: 26 additions & 0 deletions src/containers/SearchPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { styled } from '@mui/material/styles';

import { Dashboard } from '~/containers';

export const SearchPage = () => {
return (
<SearchContainer>
<Dashboard />
</SearchContainer>
);
};

const SearchContainer = styled('main')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
padding: '0 7rem',
alignItems: 'center',
justifyContent: 'center',
width: '100%',
minHeight: 'calc(100vh - 15rem)',
marginBottom: '4rem',
[theme.breakpoints.down('md')]: {
padding: '0 1rem',
minHeight: 'calc(100vh - 23rem)',
},
}));
Loading

0 comments on commit 1df55ef

Please sign in to comment.