|
1 |
| -import React, { useState } from "react"; |
| 1 | +import React, { useState, useEffect } from "react"; |
2 | 2 | import Link from "next/link";
|
3 | 3 | import { BlockCopyButton } from "./ui/block-copy-button";
|
4 | 4 | import {
|
@@ -94,7 +94,7 @@ const NETWORK_DATA = {
|
94 | 94 | testnet: [
|
95 | 95 | { property: "Interfaces and Apps", value: "" },
|
96 | 96 | {
|
97 |
| - property: "Tangle App", |
| 97 | + property: "Tangle dApp", |
98 | 98 | value: {
|
99 | 99 | type: "link",
|
100 | 100 | url: "https://app.tangle.tools",
|
@@ -122,8 +122,8 @@ const NETWORK_DATA = {
|
122 | 122 | property: "Substrate Explorer",
|
123 | 123 | value: {
|
124 | 124 | type: "link",
|
125 |
| - url: "https://tangle-testnet.statescan.io/", |
126 |
| - text: "tangle-testnet.statescan.io", |
| 125 | + url: "https://polkadot.js.org/apps/?rpc=wss://testnet-rpc.tangle.tools#/explorer", |
| 126 | + text: "polkadot.js.org/apps/?rpc=wss://testnet-rpc.tangle.tools", |
127 | 127 | },
|
128 | 128 | },
|
129 | 129 | { property: "Asset Details", value: "" },
|
@@ -173,8 +173,28 @@ const NETWORK_DATA = {
|
173 | 173 | const NetworkTabs = () => {
|
174 | 174 | const [activeTab, setActiveTab] = useState("mainnet");
|
175 | 175 |
|
| 176 | + // Set initial tab based on URL hash when component mounts |
| 177 | + useEffect(() => { |
| 178 | + // Get hash from URL (remove the # character) |
| 179 | + const hash = window.location.hash.substring(1); |
| 180 | + |
| 181 | + // If hash matches one of our tabs, set it as active |
| 182 | + if (["mainnet", "testnet", "wallets", "evmToSubstrate"].includes(hash)) { |
| 183 | + setActiveTab(hash); |
| 184 | + } else { |
| 185 | + // Explicitly set to mainnet if no valid hash is present |
| 186 | + setActiveTab("mainnet"); |
| 187 | + // If URL has no hash, we don't need to update it |
| 188 | + if (hash && hash !== "mainnet") { |
| 189 | + window.location.hash = "mainnet"; |
| 190 | + } |
| 191 | + } |
| 192 | + }, []); |
| 193 | + |
176 | 194 | const handleTabClick = (tab) => {
|
177 | 195 | setActiveTab(tab);
|
| 196 | + // Update URL hash when tab changes |
| 197 | + window.location.hash = tab; |
178 | 198 | };
|
179 | 199 |
|
180 | 200 | const renderValue = (value) => {
|
|
0 commit comments