Skip to content

Commit 5fed05e

Browse files
committed
Rename a component, preparing for extension
1 parent 673003a commit 5fed05e

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

.storybook/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { Preview } from '@storybook/react'
33
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
44
import '../src/locales/i18n'
5-
import { withDefaultTheme } from '../src/app/components/ThemeByNetwork'
5+
import { withDefaultTheme } from '../src/app/components/ThemeByScope'
66
import { initialize, mswLoader } from 'msw-storybook-addon'
77
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
88
import { handlers } from '../internals/mocks/msw-handlers'

src/app/components/AnalyticsConsent/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Button from '@mui/material/Button'
66
import Link from '@mui/material/Link'
77
import { Trans, useTranslation } from 'react-i18next'
88
import * as matomo from './initializeMatomo'
9-
import { ThemeByNetwork } from '../ThemeByNetwork'
9+
import { ThemeByScope } from '../ThemeByScope'
1010
import { Network } from '../../../types/network'
1111
import { AnalyticsIsBlocked } from './AnalyticsIsBlocked'
1212
import { AnalyticsDialogLayout } from './AnalyticsDialogLayout'
@@ -63,7 +63,7 @@ export const AnalyticsConsentProvider = (props: { children: React.ReactNode }) =
6363
>
6464
{props.children}
6565
{/* Theme is needed because AnalyticsConsentProvider is outside network-themed routes */}
66-
<ThemeByNetwork isRootTheme={false} network={Network.mainnet}>
66+
<ThemeByScope isRootTheme={false} network={Network.mainnet}>
6767
<AnalyticsConsentView
6868
isOpen={hasAccepted === 'not-chosen'}
6969
onAccept={async () => {
@@ -80,7 +80,7 @@ export const AnalyticsConsentProvider = (props: { children: React.ReactNode }) =
8080
onReload={() => window.location.reload()}
8181
onClose={() => setHasAccepted('timed_out_matomo_not_loaded')}
8282
/>
83-
</ThemeByNetwork>
83+
</ThemeByScope>
8484
</AnalyticsContext.Provider>
8585
)
8686
}

src/app/components/ThemeByNetwork/index.tsx renamed to src/app/components/ThemeByScope/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getThemesForNetworks } from '../../../styles/theme'
55
import CssBaseline from '@mui/material/CssBaseline'
66
import { fixedNetwork } from '../../utils/route-utils'
77

8-
export const ThemeByNetwork: FC<{ network: Network; isRootTheme: boolean; children: React.ReactNode }> = ({
8+
export const ThemeByScope: FC<{ network: Network; isRootTheme: boolean; children: React.ReactNode }> = ({
99
network,
1010
isRootTheme,
1111
children,
@@ -17,10 +17,10 @@ export const ThemeByNetwork: FC<{ network: Network; isRootTheme: boolean; childr
1717
)
1818

1919
export const withDefaultTheme = (node: ReactNode, alwaysMainnet = false) => (
20-
<ThemeByNetwork
20+
<ThemeByScope
2121
isRootTheme={true}
2222
network={alwaysMainnet ? Network.mainnet : fixedNetwork ?? Network.mainnet}
2323
>
2424
{node}
25-
</ThemeByNetwork>
25+
</ThemeByScope>
2626
)

src/app/pages/HomePage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useTranslation } from 'react-i18next'
1414
import { ParaTimeSelectorStep } from './Graph/types'
1515
import { BuildBanner } from '../../components/BuildBanner'
1616
import { useSearchQueryNetworkParam } from '../../hooks/useSearchQueryNetworkParam'
17-
import { ThemeByNetwork } from '../../components/ThemeByNetwork'
17+
import { ThemeByScope } from '../../components/ThemeByScope'
1818
import { NetworkOfflineBanner } from '../../components/OfflineBanner'
1919
import { useIsApiReachable } from '../../components/OfflineBanner/hook'
2020

@@ -168,7 +168,7 @@ export const HomePage: FC = () => {
168168
</InfoScreenBtn>
169169
)}
170170
</SearchInputContainer>
171-
<ThemeByNetwork isRootTheme={false} network={network}>
171+
<ThemeByScope isRootTheme={false} network={network}>
172172
<Box sx={{ zIndex: zIndexHomePage.paraTimeSelector }}>
173173
<ParaTimeSelector
174174
step={step}
@@ -179,7 +179,7 @@ export const HomePage: FC = () => {
179179
onGraphZoomedIn={setIsGraphZoomedIn}
180180
/>
181181
</Box>
182-
</ThemeByNetwork>
182+
</ThemeByScope>
183183
</Content>
184184

185185
<FooterStyled>

src/app/pages/RoutingErrorPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import Divider from '@mui/material/Divider'
33
import { PageLayout } from '../../components/PageLayout'
44
import { ErrorDisplay } from '../../components/ErrorDisplay'
55
import { useRouteError } from 'react-router-dom'
6-
import { ThemeByNetwork } from '../../components/ThemeByNetwork'
6+
import { ThemeByScope } from '../../components/ThemeByScope'
77
import { useScopeParam } from '../../hooks/useScopeParam'
88
import { Network } from '../../../types/network'
99

1010
export const RoutingErrorPage: FC = () => {
1111
const scope = useScopeParam()
1212
return (
13-
<ThemeByNetwork isRootTheme={true} network={scope?.network ?? Network.mainnet}>
13+
<ThemeByScope isRootTheme={true} network={scope?.network ?? Network.mainnet}>
1414
<PageLayout>
1515
<Divider variant="layout" />
1616
<ErrorDisplay error={useRouteError()} />
1717
</PageLayout>
18-
</ThemeByNetwork>
18+
</ThemeByScope>
1919
)
2020
}

src/app/utils/renderWithProviders.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MemoryRouter } from 'react-router-dom'
22
import { render } from '@testing-library/react'
3-
import { withDefaultTheme } from '../components/ThemeByNetwork'
3+
import { withDefaultTheme } from '../components/ThemeByScope'
44
import React from 'react'
55
import { useIsApiReachable, useRuntimeFreshness } from '../components/OfflineBanner/hook'
66

src/routes.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
skipGraph,
2727
} from './app/utils/route-utils'
2828
import { RoutingErrorPage } from './app/pages/RoutingErrorPage'
29-
import { ThemeByNetwork, withDefaultTheme } from './app/components/ThemeByNetwork'
29+
import { ThemeByScope, withDefaultTheme } from './app/components/ThemeByScope'
3030
import { useRequiredScopeParam } from './app/hooks/useScopeParam'
3131
import { TokensPage } from './app/pages/TokensOverviewPage'
3232
import { ContractCodeCard } from './app/pages/RuntimeAccountDetailsPage/ContractCodeCard'
@@ -60,9 +60,9 @@ import { FC, useEffect } from 'react'
6060
import { AnalyticsConsentProvider } from './app/components/AnalyticsConsent'
6161

6262
const NetworkSpecificPart = () => (
63-
<ThemeByNetwork isRootTheme={true} network={useRequiredScopeParam().network}>
63+
<ThemeByScope isRootTheme={true} network={useRequiredScopeParam().network}>
6464
<Outlet />
65-
</ThemeByNetwork>
65+
</ThemeByScope>
6666
)
6767

6868
/**

0 commit comments

Comments
 (0)