From c43abdbc67a74b89c6f4ec81b976ae18e3114c41 Mon Sep 17 00:00:00 2001 From: titix Date: Wed, 17 Jul 2024 15:46:06 -0300 Subject: [PATCH 01/11] feat: i18n set up --- next-i18next.config.js | 9 +++++ next.config.mjs | 7 +++- package.json | 2 + pnpm-lock.yaml | 69 +++++++++++++++++++++++++++++++++++ public/locales/en/common.json | 0 public/locales/es/common.json | 0 src/pages/_app.tsx | 4 +- src/pages/index.tsx | 10 +++++ 8 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 next-i18next.config.js create mode 100644 public/locales/en/common.json create mode 100644 public/locales/es/common.json diff --git a/next-i18next.config.js b/next-i18next.config.js new file mode 100644 index 0000000..226c96c --- /dev/null +++ b/next-i18next.config.js @@ -0,0 +1,9 @@ +/** @type {import('next-i18next').UserConfig} */ + +// eslint-disable-next-line no-undef +module.exports = { + i18n: { + locales: ['en', 'es'], + defaultLocale: 'en', + }, + }; \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs index 4678774..c8e5580 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,9 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + i18n: { + locales: ['en', 'es'], + defaultLocale: 'en', + }, +}; export default nextConfig; diff --git a/package.json b/package.json index e82fb5b..a85ef92 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,9 @@ "@next/eslint-plugin-next": "14.1.3", "@rainbow-me/rainbowkit": "2.0.2", "@tanstack/react-query": "5.28.0", + "i18next": "23.12.1", "next": "14.1.3", + "next-i18next": "15.3.0", "react": "18.2.0", "react-dom": "18.2.0", "react-router-dom": "6.15.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c0d77b..777c4ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,9 +35,15 @@ dependencies: '@tanstack/react-query': specifier: 5.28.0 version: 5.28.0(react@18.2.0) + i18next: + specifier: 23.12.1 + version: 23.12.1 next: specifier: 14.1.3 version: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) + next-i18next: + specifier: ^15.3.0 + version: 15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@13.5.0)(react@18.2.0) react: specifier: 18.2.0 version: 18.2.0 @@ -3730,6 +3736,13 @@ packages: resolution: {integrity: sha512-RpQH4rXLuvTXKR0zqHq3go0RVXYv/YVqv4TnPH95VbwUxZdQlK1EtcMvQvMpDngHbt13Csh9Z4qT9AbkiQH5BA==} dev: false + /@types/hoist-non-react-statics@3.3.5: + resolution: {integrity: sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==} + dependencies: + '@types/react': 18.2.15 + hoist-non-react-statics: 3.3.2 + dev: false + /@types/istanbul-lib-coverage@2.0.6: resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} @@ -5486,6 +5499,11 @@ packages: dependencies: browserslist: 4.23.0 + /core-js@3.37.1: + resolution: {integrity: sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==} + requiresBuild: true + dev: false + /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true @@ -7423,12 +7441,22 @@ packages: '@babel/runtime': 7.24.1 dev: false + /i18next-fs-backend@2.3.1: + resolution: {integrity: sha512-tvfXskmG/9o+TJ5Fxu54sSO5OkY6d+uMn+K6JiUGLJrwxAVfer+8V3nU8jq3ts9Pe5lXJv4b1N7foIjJ8Iy2Gg==} + dev: false + /i18next@22.5.1: resolution: {integrity: sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==} dependencies: '@babel/runtime': 7.24.1 dev: false + /i18next@23.12.1: + resolution: {integrity: sha512-l4y291ZGRgUhKuqVSiqyuU2DDzxKStlIWSaoNBR4grYmh0X+pRYbFpTMs3CnJ5ECKbOI8sQcJ3PbTUfLgPRaMA==} + dependencies: + '@babel/runtime': 7.24.1 + dev: false + /iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} @@ -9302,6 +9330,26 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: false + /next-i18next@15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@13.5.0)(react@18.2.0): + resolution: {integrity: sha512-bq7Cc9XJFcmGOCLnyEtHaeJ3+JJNsI/8Pkj9BaHAnhm4sZ9vNNC4ZsaqYnlRZ7VH5ypSo73fEqLK935jLsmCvQ==} + engines: {node: '>=14'} + peerDependencies: + i18next: '>= 23.7.13' + next: '>= 12.0.0' + react: '>= 17.0.2' + react-i18next: '>= 13.5.0' + dependencies: + '@babel/runtime': 7.24.1 + '@types/hoist-non-react-statics': 3.3.5 + core-js: 3.37.1 + hoist-non-react-statics: 3.3.2 + i18next: 23.12.1 + i18next-fs-backend: 2.3.1 + next: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) + react: 18.2.0 + react-i18next: 13.5.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) + dev: false + /next@14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-oexgMV2MapI0UIWiXKkixF8J8ORxpy64OuJ/J9oVUmIthXOUCcuVEZX+dtpgq7wIfIqtBwQsKEDXejcjTsan9g==} engines: {node: '>=18.17.0'} @@ -10106,6 +10154,27 @@ packages: react-native: 0.73.6(@babel/core@7.24.1)(@babel/preset-env@7.24.1)(react@18.2.0) dev: false + /react-i18next@13.5.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0): + resolution: {integrity: sha512-CFJ5NDGJ2MUyBohEHxljOq/39NQ972rh1ajnadG9BjTk+UXbHLq4z5DKEbEQBDoIhUmmbuS/fIMJKo6VOax1HA==} + peerDependencies: + i18next: '>= 23.2.3' + react: '>= 16.8.0' + react-dom: '*' + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + '@babel/runtime': 7.24.1 + html-parse-stringify: 3.0.1 + i18next: 23.12.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-native: 0.73.6(@babel/core@7.24.1)(@babel/preset-env@7.24.1)(react@18.2.0) + dev: false + /react-is@16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} diff --git a/public/locales/en/common.json b/public/locales/en/common.json new file mode 100644 index 0000000..e69de29 diff --git a/public/locales/es/common.json b/public/locales/es/common.json new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index bc4ba68..71e725f 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,4 +1,6 @@ import { AppProps } from 'next/app'; +import { appWithTranslation } from 'next-i18next'; + import { Providers } from '~/providers'; import Layout from './layout'; @@ -12,4 +14,4 @@ const Home = ({ Component, pageProps }: AppProps) => { ); }; -export default Home; +export default appWithTranslation(Home); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index d753b21..1320a60 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,7 +1,17 @@ import Head from 'next/head'; +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; +import { GetStaticProps, GetStaticPropsContext } from 'next'; import { Landing } from '~/containers'; +export const getStaticProps: GetStaticProps = async ({ locale }: GetStaticPropsContext) => { + return { + props: { + ...(await serverSideTranslations(locale ?? 'en', ['common'])), + }, + }; +}; + const Ecosystem = () => { return ( <> From 7af1783a69c12eab5cdad0b41e27eb0c6491a7fb Mon Sep 17 00:00:00 2001 From: titix Date: Wed, 17 Jul 2024 16:04:29 -0300 Subject: [PATCH 02/11] chore: install --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 777c4ef..475a111 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,7 +42,7 @@ dependencies: specifier: 14.1.3 version: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) next-i18next: - specifier: ^15.3.0 + specifier: 15.3.0 version: 15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@13.5.0)(react@18.2.0) react: specifier: 18.2.0 From 38d3de18e665e0fc9bea9a7cfef28c12bb9cba6f Mon Sep 17 00:00:00 2001 From: titix Date: Wed, 17 Jul 2024 16:21:12 -0300 Subject: [PATCH 03/11] fix: config --- next-i18next.config.js | 17 ++++++++++------- package.json | 3 +-- public/locales/en/common.json | 5 +++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index 226c96c..b9a1286 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -1,9 +1,12 @@ -/** @type {import('next-i18next').UserConfig} */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable no-undef */ + +const path = require('path'); -// eslint-disable-next-line no-undef module.exports = { - i18n: { - locales: ['en', 'es'], - defaultLocale: 'en', - }, - }; \ No newline at end of file + i18n: { + locales: ['en', 'es'], + defaultLocale: 'en', + }, + localePath: typeof window === 'undefined' ? path.resolve('./public/locales') : '/locales', +}; diff --git a/package.json b/package.json index a85ef92..be79128 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { - "name": "web3-react-boilerplate", + "name": "ZKchainHub", "private": true, "version": "0.0.0", - "type": "module", "license": "MIT", "author": "Wonderland", "engines": { diff --git a/public/locales/en/common.json b/public/locales/en/common.json index e69de29..41e3090 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -0,0 +1,5 @@ +{ + "HOME":{ + + } +} \ No newline at end of file From c6e6722fc1ac95451999ea9ac972331830aafec7 Mon Sep 17 00:00:00 2001 From: titix Date: Wed, 17 Jul 2024 17:53:14 -0300 Subject: [PATCH 04/11] feat: add translations --- pnpm-lock.yaml | 29 ++++++++----- public/locales/en/common.json | 59 +++++++++++++++++++++++++-- public/locales/es/common.json | 58 ++++++++++++++++++++++++++ src/components/Disclaimer.tsx | 8 ++-- src/components/SearchBar.tsx | 6 ++- src/components/Table.tsx | 14 ++++--- src/components/TitleBanner.tsx | 9 +++- src/containers/Dashboard/index.tsx | 6 ++- src/containers/Footer/index.tsx | 7 +++- src/containers/LockedAssets/index.tsx | 5 ++- 10 files changed, 171 insertions(+), 30 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 475a111..8a81a64 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,7 +43,7 @@ dependencies: version: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) next-i18next: specifier: 15.3.0 - version: 15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@13.5.0)(react@18.2.0) + version: 15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@15.0.0)(react@18.2.0) react: specifier: 18.2.0 version: 18.2.0 @@ -1535,6 +1535,13 @@ packages: dependencies: regenerator-runtime: 0.14.1 + /@babel/runtime@7.24.8: + resolution: {integrity: sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.1 + dev: false + /@babel/template@7.24.0: resolution: {integrity: sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==} engines: {node: '>=6.9.0'} @@ -5757,7 +5764,7 @@ packages: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /dayjs@1.11.10: @@ -7438,7 +7445,7 @@ packages: /i18next-browser-languagedetector@7.2.0: resolution: {integrity: sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /i18next-fs-backend@2.3.1: @@ -7448,7 +7455,7 @@ packages: /i18next@22.5.1: resolution: {integrity: sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /i18next@23.12.1: @@ -9023,7 +9030,7 @@ packages: resolution: {integrity: sha512-21GQVd0pp2nACoK0C2PL8mBsEhIFUFFntYrWRlYNHtPQoqDzddrPEIgkyaABGXGued+dZoBlFQl+LASlmmfkvw==} engines: {node: '>=18'} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /metro-source-map@0.80.6: @@ -9330,7 +9337,7 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: false - /next-i18next@15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@13.5.0)(react@18.2.0): + /next-i18next@15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@15.0.0)(react@18.2.0): resolution: {integrity: sha512-bq7Cc9XJFcmGOCLnyEtHaeJ3+JJNsI/8Pkj9BaHAnhm4sZ9vNNC4ZsaqYnlRZ7VH5ypSo73fEqLK935jLsmCvQ==} engines: {node: '>=14'} peerDependencies: @@ -9347,7 +9354,7 @@ packages: i18next-fs-backend: 2.3.1 next: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 - react-i18next: 13.5.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) + react-i18next: 15.0.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) dev: false /next@14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0): @@ -10146,7 +10153,7 @@ packages: react-native: optional: true dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 html-parse-stringify: 3.0.1 i18next: 22.5.1 react: 18.2.0 @@ -10154,8 +10161,8 @@ packages: react-native: 0.73.6(@babel/core@7.24.1)(@babel/preset-env@7.24.1)(react@18.2.0) dev: false - /react-i18next@13.5.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0): - resolution: {integrity: sha512-CFJ5NDGJ2MUyBohEHxljOq/39NQ972rh1ajnadG9BjTk+UXbHLq4z5DKEbEQBDoIhUmmbuS/fIMJKo6VOax1HA==} + /react-i18next@15.0.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0): + resolution: {integrity: sha512-2O3IgF4zivg57Q6p6i+ChDgJ371IDcEWbuWC6gvoh5NbkDMs0Q+O7RPr4v61+Se32E0V+LmtwePAeqWZW0bi6g==} peerDependencies: i18next: '>= 23.2.3' react: '>= 16.8.0' @@ -10167,7 +10174,7 @@ packages: react-native: optional: true dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 html-parse-stringify: 3.0.1 i18next: 23.12.1 react: 18.2.0 diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 41e3090..5451f12 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -1,5 +1,58 @@ { - "HOME":{ - + "HOME": { + "title": "ZKsync Ecosystem", + "gasPrice": "Gas Price", + "transfer": "ERC-20 Transfer", + "lockedAssets": "Locked assets in shared bridge", + "DASHBOARD": { + "title": "Chain list", + "chain": "Chain", + "chainId": "Chain ID", + "nativeToken": "Native token", + "tvl": "TVL - L1", + "type": "Type", + "search": "Search by chain name or id..." } -} \ No newline at end of file + }, + "CHAINPAGE": { + "website": "Website", + "explorer": "Explorer", + "launchDate": "Launch date", + "environment": "Environment", + "nativeToken": "Native token", + "CHAININFORMATION": { + "title": "Chain information", + "chainType": "Chain type", + "lastBlock": "Last block", + "lastBlockVerified": "Last block verified", + "transactionsPerSecond": "Transactions per second", + "totalBatchesCommitted": "Total batches committed", + "totalBatchesVerified": "Total batches verified", + "averageBlockTime": "Average block time" + }, + "ZKCHAINTVL": { + "title": "ZKchain TVL" + }, + "RPC": { + "title": "RPC", + "status": "Status" + }, + "FEEPARAMS": { + "batch": "Batch Overhead L1 Gas", + "compute": "Compute Overhead Part", + "maxGasBatch": "Max Gas per Batch" + } + }, + "FOOTER": { + "docs": "Documentation", + "github": "GitHub", + "madeWithLove": "Made with ❤️ by" + }, + "DISCLAIMER": { + "disclaimer": "Disclaimer: This application is currently in beta. Please proceed at your own risk. Any funds lost through its use are non-recoverable." + }, + "LOCALES": { + "en": "English", + "es": "Spanish" + } +} diff --git a/public/locales/es/common.json b/public/locales/es/common.json index e69de29..6c8e324 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -0,0 +1,58 @@ +{ + "HOME": { + "title": "Ecosistema ZKsync", + "gasPrice": "Precio del gas", + "transfer": "Transferencia ERC-20", + "lockedAssets": "Activos bloqueados en puente compartido", + "DASHBOARD": { + "title": "Lista de cadenas", + "chain": "Cadena", + "chainId": "ID de cadena", + "nativeToken": "Token nativo", + "tvl": "TVL - L1", + "type": "Tipo", + "search": "Buscar por nombre o ID de la cadena..." + } + }, + "CHAINPAGE": { + "website": "Sitio web", + "explorer": "Explorador", + "launchDate": "Fecha de lanzamiento", + "environment": "Entorno", + "nativeToken": "Token nativo", + "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", + "totalBatchesVerified": "Total de lotes verificados", + "averageBlockTime": "Tiempo promedio de bloque" + }, + "ZKCHAINTVL": { + "title": "TVL de ZKchain" + }, + "RPC": { + "title": "RPC", + "status": "Estado" + }, + "FEEPARAMS": { + "batch": "Sobrecarga de lote L1 Gas", + "compute": "Parte de sobrecarga de cómputo", + "maxGasBatch": "Máximo gas por lote" + } + }, + "FOOTER": { + "docs": "Documentación", + "github": "GitHub", + "madeWithLove": "Hecho con ❤️ por" + }, + "DISCLAIMER": { + "disclaimer": "Advertencia: Esta aplicación está actualmente en beta. Por favor, proceda bajo su propio riesgo. Cualquier fondo perdido a través de su uso no es recuperable." + }, + "LOCALES": { + "en": "Inglés", + "es": "Español" + } +} diff --git a/src/components/Disclaimer.tsx b/src/components/Disclaimer.tsx index 81d4764..d201257 100644 --- a/src/components/Disclaimer.tsx +++ b/src/components/Disclaimer.tsx @@ -1,14 +1,14 @@ import { styled, Box, Typography } from '@mui/material'; +import { useTranslation } from 'next-i18next'; import { DISCLAIMER_HEIGHT } from '~/utils'; export const Disclaimer = () => { + const { t } = useTranslation(); + return ( - - Disclaimer: This application is currently in beta. Please proceed at your own risk. Any funds lost through its - use are non-recoverable. - + {t('DISCLAIMER.disclaimer')} ); }; diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index cd1018e..45d9ef5 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -1,7 +1,11 @@ +import { useTranslation } from 'next-i18next'; + export const SearchBar = () => { + const { t } = useTranslation(); + return (
- +
); }; diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 377796c..0ad112d 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -1,15 +1,19 @@ +import { useTranslation } from 'next-i18next'; + import { useData } from '~/hooks'; export const Table = () => { + const { t } = useTranslation(); const { ecosystemData } = useData(); + return ( - - - - - + + + + + {ecosystemData?.chains.map((data, index) => { diff --git a/src/components/TitleBanner.tsx b/src/components/TitleBanner.tsx index 36a52f4..3d650d8 100644 --- a/src/components/TitleBanner.tsx +++ b/src/components/TitleBanner.tsx @@ -1,9 +1,14 @@ +import { useTranslation } from 'next-i18next'; + export const TitleBanner = () => { + const { t } = useTranslation(); + return (
- zkSync Ecosystem + {t('HOME.title')} +
- Gas Price: 10 wei · ERC-20 Transfer: $10 + {`${t('HOME.gasPrice')}: 10 wei ${t('HOME.transfer')} $10`}
); diff --git a/src/containers/Dashboard/index.tsx b/src/containers/Dashboard/index.tsx index 2633f45..544d0e1 100644 --- a/src/containers/Dashboard/index.tsx +++ b/src/containers/Dashboard/index.tsx @@ -1,10 +1,14 @@ +import { useTranslation } from 'next-i18next'; + import { SearchBar, Table, Title } from '~/components'; export const Dashboard = () => { + const { t } = useTranslation(); + return (
- + <Title title={t('HOME.DASHBOARD.title')} /> <SearchBar /> </header> <Table /> diff --git a/src/containers/Footer/index.tsx b/src/containers/Footer/index.tsx index 5d98840..45f49cb 100644 --- a/src/containers/Footer/index.tsx +++ b/src/containers/Footer/index.tsx @@ -1,14 +1,17 @@ +import { useTranslation } from 'next-i18next'; import { styled } from '@mui/material/styles'; -import { useCustomTheme } from '~/hooks/useContext/useTheme'; +import { useCustomTheme } from '~/hooks'; import { FOOTER_HEIGHT } from '~/utils'; export const Footer = () => { + const { t } = useTranslation(); + return ( <FooterContainer> <h1>Footer</h1> <Subtitle> - <p>Made with 💜 by</p> + <p>{t('FOOTER.madeWithLove')}</p> <a href='https://defi.sucks'>Wonderland</a> </Subtitle> </FooterContainer> diff --git a/src/containers/LockedAssets/index.tsx b/src/containers/LockedAssets/index.tsx index c365ac0..beb9cc6 100644 --- a/src/containers/LockedAssets/index.tsx +++ b/src/containers/LockedAssets/index.tsx @@ -1,14 +1,17 @@ +import { useTranslation } from 'next-i18next'; + import { TotalValueLocked, Title } from '~/components'; import { useData } from '~/hooks'; export const LockedAssets = () => { + const { t } = useTranslation(); const { ecosystemData } = useData(); return ( <section> {ecosystemData && ( <> - <Title title={`Locked assets in shared bridge: ${ecosystemData.total}`} /> + <Title title={`${t('HOME.lockedAssets')}: ${ecosystemData.total}`} /> <TotalValueLocked tvl={ecosystemData.tvl} /> </> )} From 5be359a6f8dd09cc290056a97a9bc132f681ba8a Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:11:15 -0300 Subject: [PATCH 05/11] fix: vercel deployment --- next.config.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index c8e5580..74dad1c 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,9 +1,13 @@ /** @type {import('next').NextConfig} */ +const path = require('path'); + const nextConfig = { - i18n: { - locales: ['en', 'es'], - defaultLocale: 'en', - }, + i18n: { + locales: ['en', 'es'], + defaultLocale: 'en', + }, + localePath: path.resolve('./public/locales'), + outputFileTracing: true }; export default nextConfig; From 3dd2dfa816620058224479e92a28d600cd723cd8 Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:13:59 -0300 Subject: [PATCH 06/11] fix: module import --- next.config.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 74dad1c..62250e1 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,12 +1,10 @@ /** @type {import('next').NextConfig} */ -const path = require('path'); const nextConfig = { i18n: { locales: ['en', 'es'], defaultLocale: 'en', }, - localePath: path.resolve('./public/locales'), outputFileTracing: true }; From d745108a6b8ae4b932667e1fd849df514ba71d7a Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:22:20 -0300 Subject: [PATCH 07/11] fix: locales path --- next-i18next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index b9a1286..93b7a95 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -7,6 +7,6 @@ module.exports = { i18n: { locales: ['en', 'es'], defaultLocale: 'en', + localePath: path.resolve('./public/locales') }, - localePath: typeof window === 'undefined' ? path.resolve('./public/locales') : '/locales', }; From 6330bf139868e26b2fa7d371286b471b4541f0c8 Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:27:21 -0300 Subject: [PATCH 08/11] fix: localePath --- next-i18next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index 93b7a95..26c8323 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -7,6 +7,6 @@ module.exports = { i18n: { locales: ['en', 'es'], defaultLocale: 'en', - localePath: path.resolve('./public/locales') + localePath: path.resolve('./locales') }, }; From 23a749141f806494b0ba026d66e38e44a439a222 Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:31:09 -0300 Subject: [PATCH 09/11] fix: static path --- next-i18next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index 26c8323..f9c971b 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -7,6 +7,6 @@ module.exports = { i18n: { locales: ['en', 'es'], defaultLocale: 'en', - localePath: path.resolve('./locales') + localePath: path.resolve('./public/static/locales') }, }; From bae2b9c986548c2d2c53c97a0d7f3a9057bbeb48 Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Wed, 17 Jul 2024 18:52:55 -0300 Subject: [PATCH 10/11] chore: dependencies --- next-i18next.config.js | 2 +- next.config.mjs | 1 - package.json | 5 +++-- pnpm-lock.yaml | 46 ++++++++++++++++++++++-------------------- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index f9c971b..b9a1286 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -7,6 +7,6 @@ module.exports = { i18n: { locales: ['en', 'es'], defaultLocale: 'en', - localePath: path.resolve('./public/static/locales') }, + localePath: typeof window === 'undefined' ? path.resolve('./public/locales') : '/locales', }; diff --git a/next.config.mjs b/next.config.mjs index 62250e1..404aa72 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -5,7 +5,6 @@ const nextConfig = { locales: ['en', 'es'], defaultLocale: 'en', }, - outputFileTracing: true }; export default nextConfig; diff --git a/package.json b/package.json index be79128..6079f6d 100644 --- a/package.json +++ b/package.json @@ -40,11 +40,12 @@ "@next/eslint-plugin-next": "14.1.3", "@rainbow-me/rainbowkit": "2.0.2", "@tanstack/react-query": "5.28.0", - "i18next": "23.12.1", + "i18next": "23.7.6", "next": "14.1.3", - "next-i18next": "15.3.0", + "next-i18next": "15.2.0", "react": "18.2.0", "react-dom": "18.2.0", + "react-i18next": "14.0.0", "react-router-dom": "6.15.0", "viem": "2.8.6", "wagmi": "2.5.7" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a81a64..fcd394e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,20 +36,23 @@ dependencies: specifier: 5.28.0 version: 5.28.0(react@18.2.0) i18next: - specifier: 23.12.1 - version: 23.12.1 + specifier: 23.7.6 + version: 23.7.6 next: specifier: 14.1.3 version: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) next-i18next: - specifier: 15.3.0 - version: 15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@15.0.0)(react@18.2.0) + specifier: 15.2.0 + version: 15.2.0(i18next@23.7.6)(next@14.1.3)(react-i18next@14.0.0)(react@18.2.0) react: specifier: 18.2.0 version: 18.2.0 react-dom: specifier: 18.2.0 version: 18.2.0(react@18.2.0) + react-i18next: + specifier: 14.0.0 + version: 14.0.0(i18next@23.7.6)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) react-router-dom: specifier: 6.15.0 version: 6.15.0(react-dom@18.2.0)(react@18.2.0) @@ -1540,7 +1543,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 - dev: false /@babel/template@7.24.0: resolution: {integrity: sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==} @@ -2583,7 +2585,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 '@mui/utils': 5.15.14(@types/react@18.2.15)(react@18.2.0) '@types/react': 18.2.15 prop-types: 15.8.1 @@ -2603,7 +2605,7 @@ packages: '@emotion/styled': optional: true dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 '@emotion/cache': 11.11.0 '@emotion/react': 11.11.3(@types/react@18.2.15)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.3)(@types/react@18.2.15)(react@18.2.0) @@ -4931,7 +4933,7 @@ packages: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} engines: {node: '>=10', npm: '>=6'} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 cosmiconfig: 7.1.0 resolve: 1.22.8 dev: false @@ -5994,7 +5996,7 @@ packages: /dom-helpers@5.2.1: resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 csstype: 3.1.3 dev: false @@ -7458,10 +7460,10 @@ packages: '@babel/runtime': 7.24.8 dev: false - /i18next@23.12.1: - resolution: {integrity: sha512-l4y291ZGRgUhKuqVSiqyuU2DDzxKStlIWSaoNBR4grYmh0X+pRYbFpTMs3CnJ5ECKbOI8sQcJ3PbTUfLgPRaMA==} + /i18next@23.7.6: + resolution: {integrity: sha512-O66BhXBw0fH4bEJMA0/klQKPEbcwAp5wjXEL803pdAynNbg2f4qhLIYlNHJyE7icrL6XmSZKPYaaXwy11kJ6YQ==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /iconv-lite@0.6.3: @@ -8922,7 +8924,7 @@ packages: /media-query-parser@2.0.2: resolution: {integrity: sha512-1N4qp+jE0pL5Xv4uEcwVUhIkwdUO3S/9gML90nqKA7v7FcOS5vUtatfzok9S9U1EJU8dHWlcv95WLnKmmxZI9w==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 dev: false /memoize-one@5.2.1: @@ -9337,8 +9339,8 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: false - /next-i18next@15.3.0(i18next@23.12.1)(next@14.1.3)(react-i18next@15.0.0)(react@18.2.0): - resolution: {integrity: sha512-bq7Cc9XJFcmGOCLnyEtHaeJ3+JJNsI/8Pkj9BaHAnhm4sZ9vNNC4ZsaqYnlRZ7VH5ypSo73fEqLK935jLsmCvQ==} + /next-i18next@15.2.0(i18next@23.7.6)(next@14.1.3)(react-i18next@14.0.0)(react@18.2.0): + resolution: {integrity: sha512-Rl5yZ4oGffsB0AjRykZ5PzNQ2M6am54MaMayldGmH/UKZisrIxk2SKEPJvaHhKlWe1qgdNi2FkodwK8sEjfEmg==} engines: {node: '>=14'} peerDependencies: i18next: '>= 23.7.13' @@ -9346,15 +9348,15 @@ packages: react: '>= 17.0.2' react-i18next: '>= 13.5.0' dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 '@types/hoist-non-react-statics': 3.3.5 core-js: 3.37.1 hoist-non-react-statics: 3.3.2 - i18next: 23.12.1 + i18next: 23.7.6 i18next-fs-backend: 2.3.1 next: 14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 - react-i18next: 15.0.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) + react-i18next: 14.0.0(i18next@23.7.6)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0) dev: false /next@14.1.3(@babel/core@7.24.1)(react-dom@18.2.0)(react@18.2.0): @@ -10161,8 +10163,8 @@ packages: react-native: 0.73.6(@babel/core@7.24.1)(@babel/preset-env@7.24.1)(react@18.2.0) dev: false - /react-i18next@15.0.0(i18next@23.12.1)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0): - resolution: {integrity: sha512-2O3IgF4zivg57Q6p6i+ChDgJ371IDcEWbuWC6gvoh5NbkDMs0Q+O7RPr4v61+Se32E0V+LmtwePAeqWZW0bi6g==} + /react-i18next@14.0.0(i18next@23.7.6)(react-dom@18.2.0)(react-native@0.73.6)(react@18.2.0): + resolution: {integrity: sha512-OCrS8rHNAmnr8ggGRDxjakzihrMW7HCbsplduTm3EuuQ6fyvWGT41ksZpqbduYoqJurBmEsEVZ1pILSUWkHZng==} peerDependencies: i18next: '>= 23.2.3' react: '>= 16.8.0' @@ -10176,7 +10178,7 @@ packages: dependencies: '@babel/runtime': 7.24.8 html-parse-stringify: 3.0.1 - i18next: 23.12.1 + i18next: 23.7.6 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-native: 0.73.6(@babel/core@7.24.1)(@babel/preset-env@7.24.1)(react@18.2.0) @@ -10476,7 +10478,7 @@ packages: /regenerator-transform@0.15.2: resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} dependencies: - '@babel/runtime': 7.24.1 + '@babel/runtime': 7.24.8 /regexp.prototype.flags@1.5.2: resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} From 8c414627d735e9e82c84fd11ab9b013ba6679d46 Mon Sep 17 00:00:00 2001 From: titix <titi@defi.sucks> Date: Thu, 18 Jul 2024 13:49:34 -0300 Subject: [PATCH 11/11] style: eslint --- src/components/SearchBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 450c236..f4bdda0 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -7,7 +7,7 @@ interface SearchBarProps { export const SearchBar = ({ value, onChange }: SearchBarProps) => { const { t } = useTranslation(); - + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { onChange(event.target.value); };
ChainChain IDNative tokenTVL - L1Type{t('HOME.DASHBOARD.chain')}{t('HOME.DASHBOARD.chainId')}{t('HOME.DASHBOARD.nativeToken')}{t('HOME.DASHBOARD.tvl')}{t('HOME.DASHBOARD.type')}