From 0313f0b2c5126d52043b6b6ec7b255397bd7d6dd Mon Sep 17 00:00:00 2001 From: Alexey Samosadov Date: Sun, 8 Feb 2026 03:08:38 +0300 Subject: [PATCH] feat(dashboard): add network switcher dropdown Add a dropdown component to switch between mainnet and testnet versions of the staking dashboard, similar to the Dashtecs implementation. Changes: - New NetworkSwitcher component with dropdown menu - Environment variables for network configuration - Integration in Navbar (desktop and mobile) Closes #4 --- staking-dashboard/.env.example | 11 +- .../src/components/Navbar/Navbar.tsx | 26 ++- .../NetworkSwitcher/NetworkSwitcher.tsx | 159 ++++++++++++++++++ .../src/components/NetworkSwitcher/index.ts | 1 + staking-dashboard/src/vite-env.d.ts | 30 ++++ 5 files changed, 217 insertions(+), 10 deletions(-) create mode 100644 staking-dashboard/src/components/NetworkSwitcher/NetworkSwitcher.tsx create mode 100644 staking-dashboard/src/components/NetworkSwitcher/index.ts diff --git a/staking-dashboard/.env.example b/staking-dashboard/.env.example index 54e1dabf0..492b3ffdb 100644 --- a/staking-dashboard/.env.example +++ b/staking-dashboard/.env.example @@ -29,5 +29,12 @@ VITE_SAFE_API_KEY=xxxxxxxxxx NODE_ENV='development' -# Validator Dashboard URL -VITE_VALIDATOR_DASHBOARD_URL=https://dashtec.xyz \ No newline at end of file +# Validator Dashboard URL +VITE_VALIDATOR_DASHBOARD_URL=https://dashtec.xyz + +# Network Switcher Configuration +# VITE_CURRENT_NETWORK: mainnet | testnet (defaults to mainnet) +VITE_CURRENT_NETWORK=mainnet +# URLs for switching between networks +VITE_MAINNET_URL=https://stake.aztec.network +VITE_TESTNET_URL=https://testnet.stake.aztec.network \ No newline at end of file diff --git a/staking-dashboard/src/components/Navbar/Navbar.tsx b/staking-dashboard/src/components/Navbar/Navbar.tsx index 936938dc1..107aeda0f 100644 --- a/staking-dashboard/src/components/Navbar/Navbar.tsx +++ b/staking-dashboard/src/components/Navbar/Navbar.tsx @@ -2,6 +2,7 @@ import { useState } from "react" import { Link } from "react-router-dom" import { Icon } from "@/components/Icon" import { CustomConnectButton } from "../CustomConnectButton" +import { NetworkSwitcher } from "../NetworkSwitcher" /** * Main navigation bar component @@ -27,13 +28,16 @@ export const Navbar = () => {