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 }) => {