import { useEffect, useMemo, useState } from 'react'; import Head from 'next/head'; import type { AppProps } from 'next/app'; import { t } from '@vegaprotocol/i18n'; import { useEagerConnect as useVegaEagerConnect, useVegaWallet, } from '@vegaprotocol/wallet'; import { useVegaTransactionManager, useVegaTransactionUpdater, } from '@vegaprotocol/web3'; import { useEagerConnect as useEthereumEagerConnect, useEthTransactionManager, useEthTransactionUpdater, useEthWithdrawApprovalsManager, } from '@vegaprotocol/web3'; import { envTriggerMapping, Networks, NodeSwitcherDialog, useEnvironment, useInitializeEnv, useNodeSwitcherStore, } from '@vegaprotocol/environment'; import './styles.css'; import { useGlobalStore, usePageTitleStore } from '../stores'; import DialogsContainer from './dialogs-container'; import ToastsManager from './toasts-manager'; import { HashRouter, useLocation, Route, Routes, useSearchParams, } from 'react-router-dom'; import { Connectors } from '../lib/vega-connectors'; import { AppLoader, DynamicLoader } from '../components/app-loader'; import { useDataProvider } from '@vegaprotocol/data-provider'; import { activeOrdersProvider } from '@vegaprotocol/orders'; import { useTelemetryApproval } from '../lib/hooks/use-telemetry-approval'; import { AnnouncementBanner } from '../components/banner'; import { Navbar } from '../components/navbar'; import classNames from 'classnames'; import { ProtocolUpgradeCountdownMode, ProtocolUpgradeInProgressNotification, ProtocolUpgradeProposalNotification, } from '@vegaprotocol/proposals'; import { ViewingBanner } from '../components/viewing-banner'; import { NavHeader } from '../components/navbar/nav-header'; import { Telemetry } from '../components/telemetry'; import { Routes as AppRoutes } from '../lib/links'; const DEFAULT_TITLE = t('Welcome to Vega trading!'); const Title = () => { const { pageTitle } = usePageTitleStore((store) => ({ pageTitle: store.pageTitle, })); const { VEGA_ENV } = useEnvironment(); const networkName = envTriggerMapping[VEGA_ENV]; const title = useMemo(() => { if (!pageTitle) return DEFAULT_TITLE; if (networkName) return `${pageTitle} [${networkName}]`; return pageTitle; }, [pageTitle, networkName]); return (