Skip to content

Commit

Permalink
Rename getThemeForNetwork to getThemeForScope, preparing for extension
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Aug 13, 2024
1 parent 12ef675 commit 19e662a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/app/components/ThemeByScope/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, ReactNode } from 'react'
import { Network } from '../../../types/network'
import { ThemeProvider } from '@mui/material/styles'
import { getThemeForNetwork } from '../../../styles/theme'
import { getThemeForScope } from '../../../styles/theme'
import CssBaseline from '@mui/material/CssBaseline'
import { fixedNetwork } from '../../utils/route-utils'

Expand All @@ -10,7 +10,7 @@ export const ThemeByScope: FC<{ network: Network; isRootTheme: boolean; children
isRootTheme,
children,
}) => (
<ThemeProvider theme={getThemeForNetwork(network)}>
<ThemeProvider theme={getThemeForScope(network)}>
{isRootTheme && <CssBaseline />}
{children}
</ThemeProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/SearchResultsPage/GlobalSearchResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Network,
} from '../../../types/network'
import { HideMoreResults, ShowMoreResults } from './notifications'
import { getThemeForNetwork } from '../../../styles/theme'
import { getThemeForScope } from '../../../styles/theme'
import { orderByLayer } from '../../../types/layers'
import { useRedirectIfSingleResult } from './useRedirectIfSingleResult'
import { SearchParams } from '../../components/Search/search-utils'
Expand Down Expand Up @@ -50,7 +50,7 @@ export const GlobalSearchResultsView: FC<{
}

const otherNetworks = RouteUtils.getEnabledNetworks().filter(isNotMainnet)
const notificationTheme = getThemeForNetwork(Network.testnet)
const notificationTheme = getThemeForScope(Network.testnet)
const mainnetResults = searchResults.filter(isOnMainnet).sort(orderByLayer)
const otherResults = searchResults.filter(isNotOnMainnet).sort(orderByLayer)

Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/SearchResultsPage/ScopedSearchResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getInverseFilterForScope,
SearchScope,
} from '../../../types/searchScope'
import { getThemeForNetwork } from '../../../styles/theme'
import { getThemeForScope } from '../../../styles/theme'
import { RouteUtils } from '../../utils/route-utils'
import { SearchResults } from './hooks'
import { SearchResultsList } from './SearchResultsList'
Expand All @@ -31,7 +31,7 @@ export const ScopedSearchResultsView: FC<{
const isNotInWantedScope = getInverseFilterForScope(wantedScope)
const wantedResults = searchResults.filter(isInWantedScope)
const otherResults = searchResults.filter(isNotInWantedScope)
const notificationTheme = getThemeForNetwork(
const notificationTheme = getThemeForScope(
otherResults.some(isOnMainnet) ? Network.mainnet : Network.testnet,
)

Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/SearchResultsPage/SearchResultsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TokenResult,
TransactionResult,
} from './hooks'
import { getThemeForNetwork } from '../../../styles/theme'
import { getThemeForScope } from '../../../styles/theme'
import { Network } from '../../../types/network'
import { SubPageCard } from '../../components/SubPageCard'
import { AllTokenPrices } from '../../../coin-gecko/api'
Expand Down Expand Up @@ -44,7 +44,7 @@ export const SearchResultsList: FC<{
if (!numberOfResults) {
return null
}
const theme = getThemeForNetwork(networkForTheme)
const theme = getThemeForScope(networkForTheme)

return (
<ResultListFrame theme={theme}>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export { testnetTheme } from './testnet/theme'
export const tooltipDelay = 500
export const typingDelay = 1000

export const getThemeForNetwork = (network: Network): Theme => {
export const getThemeForScope = (network: Network): Theme => {
switch (network) {
case Network.mainnet:
return defaultTheme
Expand Down

0 comments on commit 19e662a

Please sign in to comment.