File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { FC , ReactNode } from 'react'
22import { Network } from '../../../types/network'
33import { ThemeProvider } from '@mui/material/styles'
4- import { getThemesForNetworks } from '../../../styles/theme'
4+ import { getThemeForNetwork } from '../../../styles/theme'
55import CssBaseline from '@mui/material/CssBaseline'
66import { fixedNetwork } from '../../utils/route-utils'
77
@@ -10,7 +10,7 @@ export const ThemeByScope: FC<{ network: Network; isRootTheme: boolean; children
1010 isRootTheme,
1111 children,
1212} ) => (
13- < ThemeProvider theme = { getThemesForNetworks ( ) [ network ] } >
13+ < ThemeProvider theme = { getThemeForNetwork ( network ) } >
1414 { isRootTheme && < CssBaseline /> }
1515 { children }
1616 </ ThemeProvider >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
1515 Network ,
1616} from '../../../types/network'
1717import { HideMoreResults , ShowMoreResults } from './notifications'
18- import { getThemesForNetworks } from '../../../styles/theme'
18+ import { getThemeForNetwork } from '../../../styles/theme'
1919import { orderByLayer } from '../../../types/layers'
2020import { useRedirectIfSingleResult } from './useRedirectIfSingleResult'
2121import { SearchParams } from '../../components/Search/search-utils'
@@ -30,7 +30,6 @@ export const GlobalSearchResultsView: FC<{
3030 const [ othersOpen , setOthersOpen ] = useState ( false )
3131 useRedirectIfSingleResult ( undefined , searchParams , searchResults )
3232
33- const themes = getThemesForNetworks ( )
3433 const networkNames = getNetworkNames ( t )
3534 const { searchTerm } = searchParams
3635
@@ -51,7 +50,7 @@ export const GlobalSearchResultsView: FC<{
5150 }
5251
5352 const otherNetworks = RouteUtils . getEnabledNetworks ( ) . filter ( isNotMainnet )
54- const notificationTheme = themes [ Network . testnet ]
53+ const notificationTheme = getThemeForNetwork ( Network . testnet )
5554 const mainnetResults = searchResults . filter ( isOnMainnet ) . sort ( orderByLayer )
5655 const otherResults = searchResults . filter ( isNotOnMainnet ) . sort ( orderByLayer )
5756
Original file line number Diff line number Diff line change 77 getInverseFilterForScope ,
88 SearchScope ,
99} from '../../../types/searchScope'
10- import { getThemesForNetworks } from '../../../styles/theme'
10+ import { getThemeForNetwork } from '../../../styles/theme'
1111import { RouteUtils } from '../../utils/route-utils'
1212import { SearchResults } from './hooks'
1313import { SearchResultsList } from './SearchResultsList'
@@ -27,12 +27,13 @@ export const ScopedSearchResultsView: FC<{
2727 const { t } = useTranslation ( )
2828 const [ othersOpen , setOthersOpen ] = useState ( false )
2929 const networkNames = getNetworkNames ( t )
30- const themes = getThemesForNetworks ( )
3130 const isInWantedScope = getFilterForScope ( wantedScope )
3231 const isNotInWantedScope = getInverseFilterForScope ( wantedScope )
3332 const wantedResults = searchResults . filter ( isInWantedScope )
3433 const otherResults = searchResults . filter ( isNotInWantedScope )
35- const notificationTheme = themes [ otherResults . some ( isOnMainnet ) ? Network . mainnet : Network . testnet ]
34+ const notificationTheme = getThemeForNetwork (
35+ otherResults . some ( isOnMainnet ) ? Network . mainnet : Network . testnet ,
36+ )
3637
3738 useRedirectIfSingleResult ( wantedScope , searchParams , searchResults )
3839
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
1515 TokenResult ,
1616 TransactionResult ,
1717} from './hooks'
18- import { getThemesForNetworks } from '../../../styles/theme'
18+ import { getThemeForNetwork } from '../../../styles/theme'
1919import { Network } from '../../../types/network'
2020import { SubPageCard } from '../../components/SubPageCard'
2121import { AllTokenPrices } from '../../../coin-gecko/api'
@@ -44,7 +44,7 @@ export const SearchResultsList: FC<{
4444 if ( ! numberOfResults ) {
4545 return null
4646 }
47- const theme = getThemesForNetworks ( ) [ networkForTheme ]
47+ const theme = getThemeForNetwork ( networkForTheme )
4848
4949 return (
5050 < ResultListFrame theme = { theme } >
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ export { testnetTheme } from './testnet/theme'
99export const tooltipDelay = 500
1010export const typingDelay = 1000
1111
12- export const getThemesForNetworks : ( ) => Record < Network , Theme > = ( ) => ( {
13- [ Network . mainnet ] : defaultTheme ,
14- [ Network . testnet ] : testnetTheme ,
15- } )
12+ export const getThemeForNetwork = ( network : Network ) : Theme => {
13+ switch ( network ) {
14+ case Network . mainnet :
15+ return defaultTheme
16+ case Network . testnet :
17+ return testnetTheme
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments