diff --git a/apps/connect/package-lock.json b/apps/connect/package-lock.json index cd6d02e86..6d9906f50 100644 --- a/apps/connect/package-lock.json +++ b/apps/connect/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "@xlabs/portal-bridge-ui", - "version": "0.2.0", + "version": "0.2.2", "hasInstallScript": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/apps/connect/src/main.tsx b/apps/connect/src/main.tsx index 5c4807f11..721a4eaa9 100644 --- a/apps/connect/src/main.tsx +++ b/apps/connect/src/main.tsx @@ -6,6 +6,15 @@ import theme from "./theme/portal.ts"; import Background from "./components/atoms/Background.tsx"; import App from "./App.tsx"; +if (redirects) { + const matcher = new RegExp(redirects.join("|")); + const hash = window.location.hash; + if (matcher.test(hash)) { + window.location.href = `${advancedToolsHref}${hash}` + } +} + +// eslint-disable-next-line @typescript-eslint/no-non-null-assertion ReactDOM.createRoot(document.getElementById("root")!).render( diff --git a/apps/connect/src/vite-env.d.ts b/apps/connect/src/vite-env.d.ts index 255229949..b64f8fc39 100644 --- a/apps/connect/src/vite-env.d.ts +++ b/apps/connect/src/vite-env.d.ts @@ -11,4 +11,6 @@ type NavLink = { declare global { declare const wormholeConnectConfig: WormholeConnectConfig; declare const navBar: NavLink[]; + declare const redirects: string[] | undefined; + declare const advancedToolsHref: string; } diff --git a/apps/connect/vite.token-bridge.config.ts b/apps/connect/vite.token-bridge.config.ts index 7449d97ac..f3fc4b89f 100644 --- a/apps/connect/vite.token-bridge.config.ts +++ b/apps/connect/vite.token-bridge.config.ts @@ -3,8 +3,8 @@ import viteConfig from './vite.config' const PUBLIC_URL = viteConfig.base; -const ADVANCE_TOOLS_HREF = `${PUBLIC_URL}/advanced-tools/#/transfer` -const ADVANCE_TOOLS_HREF_TEMPLATE = `${ADVANCE_TOOLS_HREF}?sourceChain={:sourceChain}&targetChain={:targetChain}` +const ADVANCE_TOOLS_HREF = `${PUBLIC_URL}/advanced-tools/` +const ADVANCE_TOOLS_HREF_TEMPLATE = `${ADVANCE_TOOLS_HREF}#/transfer?sourceChain={:sourceChain}&targetChain={:targetChain}` const USDC_BRIDGE_HREF = `${PUBLIC_URL}/usdc-bridge/` const ALGORAND = { @@ -45,6 +45,24 @@ export default defineConfig({ { label: "Home", active: true, href: `${PUBLIC_URL}/` }, { label: "USDC", href: USDC_BRIDGE_HREF } ], + advancedToolsHref: ADVANCE_TOOLS_HREF, + redirects: [ + "#/nft", + "#/redeem", + "#/nft-origin-verifier", + "#/token-origin-verifier", + "#/register", + "#/migrate/Ethereum/:legacyAsset/", + "#/migrate/BinanceSmartChain/:legacyAsset/", + "#/migrate/Celo/:legacyAsset/", + "#/migrate/Ethereum/", + "#/migrate/BinanceSmartChain/", + "#/migrate/Celo/", + "#/stats", + "#/withdraw-tokens-terra", + "#/unwrap-native", + "#/custody-addresses" + ], wormholeConnectConfig: { ...viteConfig?.define?.wormholeConnectConfig, cctpWarning: {