From a2a7f346c561c66d95633eccd24584ad20f001a6 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Tue, 23 Apr 2024 09:08:33 +0200 Subject: [PATCH] Network selection (#72) * Network selection * progress * format * .. * working * fix style * lint fixes * width * fix * linting errors * working but a mess * cleanup * more cleanup * .. * small fixes * merge fix * fix issue --- .env.example | 6 ++- Dockerfile | 4 +- next.config.js | 6 ++- src/components/Elements/FeatureCard/index.tsx | 4 +- .../Elements/NetworkSelect/index.tsx | 35 +++++++++++++++++ src/components/Header/index.tsx | 12 +----- src/components/Sidebar/index.module.scss | 7 +++- src/components/Sidebar/index.tsx | 8 +++- src/contexts/apis/CoretimeApi/index.tsx | 33 +++++++++++----- src/contexts/apis/RelayApi/index.tsx | 33 ++++++++++++---- src/contexts/apis/common.ts | 27 ++++++++----- src/contexts/apis/consts.ts | 8 +++- src/contexts/sales/index.tsx | 9 ++++- src/contexts/tasks/index.tsx | 14 ++++++- src/hooks/salePhase.tsx | 15 ++++++-- src/pages/_app.tsx | 24 +++++++++++- src/pages/purchase.tsx | 8 ++-- src/utils/functions.ts | 38 ++++++++++--------- src/utils/sale/utils.test.ts | 17 ++++++--- src/utils/sale/utils.ts | 29 ++++++++------ 20 files changed, 239 insertions(+), 98 deletions(-) create mode 100644 src/components/Elements/NetworkSelect/index.tsx diff --git a/.env.example b/.env.example index 5c2e725f..30aa77da 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ -WS_CORETIME_CHAIN="WSS endpoint of the coretime chain" -WS_RELAY_CHAIN="WSS endpoint of the coretime relay chain" +WS_ROCOCO_CORETIME_CHAIN="WSS endpoint of the coretime chain" +WS_KUSAMA_CORETIME_CHAIN="WSS endpoint of the coretime chain" +WS_ROCOCO_RELAY_CHAIN="WSS endpoint of the coretime relay chain" +WS_KUSAMA_RELAY_CHAIN="WSS endpoint of the coretime relay chain" diff --git a/Dockerfile b/Dockerfile index ec8f1dfc..6c7364b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ WORKDIR /corehub COPY . . # Set the necessary environment variables -ENV WS_CORETIME_CHAIN="ws://127.0.0.1:9910" -ENV WS_RELAY_CHAIN="ws://127.0.0.1:9900" +ENV WS_ROCOCO_CORETIME_CHAIN="ws://127.0.0.1:9910" +ENV WS_ROCOCO_RELAY_CHAIN="ws://127.0.0.1:9900" RUN apk add --no-cache libc6-compat diff --git a/next.config.js b/next.config.js index 7bee534b..5ab342eb 100644 --- a/next.config.js +++ b/next.config.js @@ -5,8 +5,10 @@ const nextConfig = { domains: ['github.com'], }, env: { - WS_CORETIME_CHAIN: process.env.WS_CORETIME_CHAIN || '', - WS_RELAY_CHAIN: process.env.WS_RELAY_CHAIN, + WS_ROCOCO_CORETIME_CHAIN: process.env.WS_ROCOCO_CORETIME_CHAIN || '', + WS_KUSAMA_CORETIME_CHAIN: process.env.WS_KUSAMA_CORETIME_CHAIN || '', + WS_ROCOCO_RELAY_CHAIN: process.env.WS_ROCOCO_RELAY_CHAIN, + WS_KUSAMA_RELAY_CHAIN: process.env.WS_KUSAMA_RELAY_CHAIN, }, }; diff --git a/src/components/Elements/FeatureCard/index.tsx b/src/components/Elements/FeatureCard/index.tsx index bd54f7cc..c9c5d9bb 100644 --- a/src/components/Elements/FeatureCard/index.tsx +++ b/src/components/Elements/FeatureCard/index.tsx @@ -27,7 +27,7 @@ export const FeatureCard = ({ enabled, href, }: FeatureCardProps) => { - const { push } = useRouter(); + const { push, query } = useRouter(); const theme = useTheme(); return ( @@ -40,7 +40,7 @@ export const FeatureCard = ({