|
1 | | -import Services from '#services' |
2 | 1 | import { PageUIProvider, PersonaContext, PrivySetup } from '@masknet/shared' |
3 | | -import { MaskMessages, PopupRoutes, PrivySetupProvider, assert } from '@masknet/shared-base' |
4 | | -import { queryClient } from '@masknet/shared-base-ui' |
| 2 | +import { assert, jsxCompose, MaskMessages, PopupRoutes, PrivySetupProvider } from '@masknet/shared-base' |
5 | 3 | import { PopupSnackbarProvider } from '@masknet/theme' |
6 | 4 | import { EVMWeb3ContextProvider } from '@masknet/web3-hooks-base' |
7 | 5 | import { ProviderType } from '@masknet/web3-shared-evm' |
8 | 6 | import { Box } from '@mui/material' |
9 | | -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' |
10 | | -import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client' |
11 | | -import { Suspense, lazy, memo, useEffect, useMemo, useState, type ReactNode } from 'react' |
| 7 | +import { Suspense, cloneElement, lazy, memo, useEffect, useMemo, useState, type ReactNode } from 'react' |
12 | 8 | import { useIdleTimer } from 'react-idle-timer' |
13 | 9 | import { |
| 10 | + createHashRouter, |
14 | 11 | Navigate, |
15 | 12 | Outlet, |
16 | 13 | RouterProvider, |
17 | | - createHashRouter, |
18 | 14 | useNavigate, |
19 | | - useRouteError, |
20 | 15 | useSearchParams, |
| 16 | + useRouteError, |
21 | 17 | } from 'react-router-dom' |
22 | | -import { ErrorBoundaryUIOfError } from '../../shared-base-ui/src/components/ErrorBoundary/ErrorBoundary.js' |
23 | | -import { UserContext, queryPersistOptions } from '../shared-ui/index.js' |
| 18 | +import { usePopupTheme } from './hooks/usePopupTheme.js' |
| 19 | +import Services from '#services' |
24 | 20 | import { LoadingPlaceholder } from './components/LoadingPlaceholder/index.js' |
25 | 21 | import { PopupLayout } from './components/PopupLayout/index.js' |
26 | | -import { PageTitleContext, PopupContext } from './hooks/index.js' |
27 | | -import { usePopupTheme } from './hooks/usePopupTheme.js' |
| 22 | +import { PopupContext, PageTitleContext } from './hooks/index.js' |
28 | 23 | import { Modals } from './modals/index.js' |
29 | | -import { ContactsFrame, contactsRoutes } from './pages/Friends/index.js' |
| 24 | +import { UserContext, queryPersistOptions } from '../shared-ui/index.js' |
| 25 | +import { ReactQueryDevtools } from '@tanstack/react-query-devtools' |
| 26 | +import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client' |
| 27 | +import { queryClient } from '@masknet/shared-base-ui' |
30 | 28 | import { PersonaFrame, personaRoute } from './pages/Personas/index.js' |
31 | | -import { TraderFrame, traderRoutes } from './pages/Trader/index.js' |
32 | 29 | import { WalletFrame, walletRoutes } from './pages/Wallet/index.js' |
| 30 | +import { ContactsFrame, contactsRoutes } from './pages/Friends/index.js' |
| 31 | +import { ErrorBoundaryUIOfError } from '../../shared-base-ui/src/components/ErrorBoundary/ErrorBoundary.js' |
| 32 | +import { TraderFrame, traderRoutes } from './pages/Trader/index.js' |
33 | 33 |
|
34 | 34 | const personaInitialState = { |
35 | 35 | queryOwnedPersonaInformation: Services.Identity.queryOwnedPersonaInformation, |
@@ -110,33 +110,25 @@ export default function Popups() { |
110 | 110 |
|
111 | 111 | assert(process.env.PRIVY_APP_ID, 'Missing PRIVY_APP_ID') |
112 | 112 |
|
113 | | - // prettier-ignore |
114 | | - return ( |
115 | | - <PrivySetupProvider> |
116 | | - <PersistQueryClientProvider client={queryClient} persistOptions={queryPersistOptions}> |
117 | | - {/* eslint-disable-next-line react-compiler/react-compiler */} |
118 | | - <PageUIProvider useTheme={usePopupTheme}> |
119 | | - <PopupSnackbarProvider> |
120 | | - <EVMWeb3ContextProvider providerType={ProviderType.MaskWallet}> |
121 | | - <PopupContext> |
122 | | - <PageTitleContext value={titleContext}> |
123 | | - {/* https://github.com/TanStack/query/issues/5417 */} |
124 | | - {process.env.NODE_ENV === 'development' ? |
125 | | - <ReactQueryDevtools buttonPosition="bottom-right" /> |
126 | | - : null} |
127 | | - <PrivySetup /> |
128 | | - <RouterProvider |
129 | | - router={router} |
130 | | - fallbackElement={pending} |
131 | | - future={{ v7_startTransition: true }} |
132 | | - /> |
133 | | - </PageTitleContext> |
134 | | - </PopupContext> |
135 | | - </EVMWeb3ContextProvider> |
136 | | - </PopupSnackbarProvider> |
137 | | - </PageUIProvider> |
138 | | - </PersistQueryClientProvider> |
139 | | - </PrivySetupProvider> |
| 113 | + return jsxCompose( |
| 114 | + <PrivySetupProvider />, |
| 115 | + <PersistQueryClientProvider client={queryClient} persistOptions={queryPersistOptions} />, |
| 116 | + // eslint-disable-next-line react-compiler/react-compiler |
| 117 | + <PageUIProvider useTheme={usePopupTheme} />, |
| 118 | + <PopupSnackbarProvider children={null!} />, |
| 119 | + <EVMWeb3ContextProvider providerType={ProviderType.MaskWallet} />, |
| 120 | + <PopupContext />, |
| 121 | + <PageTitleContext value={titleContext} />, |
| 122 | + )( |
| 123 | + cloneElement, |
| 124 | + <> |
| 125 | + {/* https://github.com/TanStack/query/issues/5417 */} |
| 126 | + {process.env.NODE_ENV === 'development' ? |
| 127 | + <ReactQueryDevtools buttonPosition="bottom-right" /> |
| 128 | + : null} |
| 129 | + <PrivySetup /> |
| 130 | + <RouterProvider router={router} fallbackElement={pending} future={{ v7_startTransition: true }} /> |
| 131 | + </>, |
140 | 132 | ) |
141 | 133 | } |
142 | 134 |
|
|
0 commit comments