diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 2ee57c4..0f59ddb 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,13 +1,35 @@ import { Navbar } from "flowbite-react"; import { SvgLoader } from "react-svgmt"; +import { useAccount, useSwitchChain } from "wagmi"; import { CollectionSwitcher } from "#/components/CollectionSwitcher"; import NavLink from "#/components/NavLink"; import Profile from "#/components/Profile"; +import { DEFAULT_CHAIN } from "#/constants"; export default function Header() { + const { chain } = useAccount(); + const { switchChain } = useSwitchChain(); + + const isInvalidChain = chain?.id !== DEFAULT_CHAIN.id; return ( -
+
+ {isInvalidChain && ( +
+ You're connected to a different network.{" "} + switchChain({ chainId: DEFAULT_CHAIN.id })} + className={"font-extrabold text-primary underline cursor-pointer"} + > + Switch to {DEFAULT_CHAIN.name} + {" "} + and continue using the app. +
+ )}