diff --git a/src/components/nav/EnvironmentSelector.tsx b/src/components/nav/EnvironmentSelector.tsx
new file mode 100644
index 0000000..61cbaed
--- /dev/null
+++ b/src/components/nav/EnvironmentSelector.tsx
@@ -0,0 +1,48 @@
+import { useRouter } from 'next/router';
+import { useEffect } from 'react';
+
+import { Environment, envDisplayValue, environments } from '../../consts/environments';
+import { useEnvironment } from '../../store';
+import { getQueryParamString, replacePathParam } from '../../utils/queryParams';
+import { SelectField } from '../input/SelectField';
+
+export function EnvironmentSelector() {
+ const router = useRouter();
+ const { environment, setEnvironment } = useEnvironment();
+
+ const queryEnv = getQueryParamString(router.query, 'env');
+ useEffect(() => {
+ if (!queryEnv || queryEnv === environment) return;
+ if (environments.includes(queryEnv as Environment)) {
+ setEnvironment(queryEnv as Environment);
+ }
+ // special case to alias testnet as testnet2
+ if (queryEnv.toLowerCase() === 'testnet') {
+ setEnvironment(Environment.Testnet2);
+ }
+ // Only run once on mount
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ const onSelect = (env: string) => {
+ setEnvironment(env as Environment);
+ replacePathParam('env', env);
+ };
+
+ return (
+
+ {/* */}
+
+
+ );
+}
+
+const envOptions = [
+ { value: Environment.Mainnet, display: envDisplayValue[Environment.Mainnet] },
+ { value: Environment.Testnet2, display: envDisplayValue[Environment.Testnet2] },
+];
diff --git a/src/components/nav/Header.tsx b/src/components/nav/Header.tsx
index da29c06..26ae60c 100644
--- a/src/components/nav/Header.tsx
+++ b/src/components/nav/Header.tsx
@@ -2,7 +2,6 @@ import Image from 'next/future/image';
import Link from 'next/link';
import useDropdownMenu from 'react-accessible-dropdown-menu-hook';
-import { Environment, envDisplayValue } from '../../consts/environments';
import { links } from '../../consts/links';
import BookIcon from '../../images/icons/book.svg';
import BugIcon from '../../images/icons/bug.svg';
@@ -11,8 +10,8 @@ import HouseIcon from '../../images/icons/house.svg';
import InfoIcon from '../../images/icons/info-circle.svg';
import Logo from '../../images/logos/hyperlane-logo.svg';
import Name from '../../images/logos/hyperlane-name.svg';
-import { useStore } from '../../store';
-import { SelectField } from '../input/SelectField';
+
+import { EnvironmentSelector } from './EnvironmentSelector';
export function Header({ pathName }: { pathName: string }) {
const { buttonProps, itemProps, isOpen, setIsOpen } = useDropdownMenu(4);
@@ -44,7 +43,7 @@ export function Header({ pathName }: { pathName: string }) {
About
-
+