From e9eff0b651a35c3c2ad40c6bdc7b4ffa88ad5af9 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Sun, 5 Apr 2026 21:18:34 +0300 Subject: [PATCH] use current network inside network parameters Signed-off-by: Uncle Fatso --- package.json | 2 +- src/App.jsx | 49 +++++++++++++------ src/components/Sidebar/NavContent.jsx | 24 +++++---- src/components/TopBar/SelectNetwork.jsx | 14 ++++++ .../TopBar/Wallet/InitialWalletView.tsx | 5 +- src/components/TopBar/Wallet/Token.tsx | 11 ++++- src/components/TopBar/Wallet/index.tsx | 7 ++- src/containers/Bond/BondModal.jsx | 17 ++++--- src/containers/Bond/Bonds.jsx | 4 +- src/containers/Bond/components/BondList.jsx | 15 +++--- src/containers/Governance/Governance.jsx | 9 ++-- .../Governance/components/ProposalsList.jsx | 8 +-- src/containers/Stake/components/FarmPools.jsx | 5 +- .../components/TokenInfo.jsx | 9 ++-- src/hooks/bonds/index.js | 6 +-- src/hooks/helpers.js | 8 +-- 16 files changed, 124 insertions(+), 69 deletions(-) diff --git a/package.json b/package.json index 4bae5e3..5e43c42 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.6.13", + "version": "0.6.14", "type": "module", "scripts": { "dev": "vite", diff --git a/src/App.jsx b/src/App.jsx index 2a94595..e5978c0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,8 +5,16 @@ import CssBaseline from "@mui/material/CssBaseline"; import { styled, ThemeProvider } from "@mui/material/styles"; import { lazy, Suspense, useCallback, useEffect, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; -import { Navigate, Route, Routes, useLocation } from "react-router-dom"; -import { useAccount, useConnect, useChainId, useConfig, usePublicClient, injected } from "wagmi"; +import { Outlet, Navigate, Route, Routes, useLocation, useParams } from "react-router-dom"; +import { + useAccount, + useConnect, + useChainId, + useConfig, + usePublicClient, + useSwitchChain, + injected +} from "wagmi"; import Messages from "./components/Messages/Messages"; import NavDrawer from "./components/Sidebar/NavDrawer"; @@ -100,6 +108,7 @@ function App() { const [theme, toggleTheme] = useTheme(); const config = useConfig(); + const { chains } = useSwitchChain(); const { connect, error: errorMessage } = useConnect(); const tryConnectInjected = () => connect({ connector: injected() }); @@ -203,23 +212,23 @@ function App() {
}> - } /> + } /> {chainExists && - <> - } /> - } /> - } /> - } /> + chain.name.toLowerCase())} /> }> + } /> + } /> + } /> + } /> {isNetworkLegacy(chainId) - ? } /> - : } /> + ? } /> + : } /> } - } /> - } /> - {isGovernanceAvailable(chainId, addressChainId) && } />} - {isGovernanceAvailable(chainId, addressChainId) && } />} - {isGovernanceAvailable(chainId, addressChainId) && } />} - + } /> + } /> + {isGovernanceAvailable(chainId, addressChainId) && } />} + {isGovernanceAvailable(chainId, addressChainId) && } />} + {isGovernanceAvailable(chainId, addressChainId) && } />} + } { + const { network } = useParams(); + if (!allowedNetworks.includes(network)) { + return ; + } + return +} + export default App; diff --git a/src/components/Sidebar/NavContent.jsx b/src/components/Sidebar/NavContent.jsx index 47e9f8d..c879e49 100644 --- a/src/components/Sidebar/NavContent.jsx +++ b/src/components/Sidebar/NavContent.jsx @@ -16,6 +16,7 @@ import { } from "@mui/material"; import { styled } from "@mui/material/styles"; import { NavLink } from "react-router-dom"; +import { useSwitchChain } from "wagmi"; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import GitHubIcon from '@mui/icons-material/GitHub'; @@ -68,6 +69,11 @@ const StyledBox = styled(Box)(({ theme }) => ({ })); const NavContent = ({ chainId, addressChainId }) => { + const { chains } = useSwitchChain(); + const chainName = useMemo(() => { + return chains.find(chain => chain.id === chainId).name.toLowerCase(); + }, [chains, chainId, addressChainId]) + const { liveBonds: ghostBonds } = useLiveBonds(chainId); const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO"); const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST"); @@ -104,18 +110,18 @@ const NavContent = ({ chainId, addressChainId }) => {