Skip to content

Commit

Permalink
Add support for adding custom themes for specific paratimes
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Aug 13, 2024
1 parent e32b1ad commit 04a6871
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Layer } from './oasis-nexus/generated/api'
import { NativeToken, NativeTokenInfo } from './types/ticker'
import { SearchScope } from './types/searchScope'
import { Network } from './types/network'
import type { Theme } from '@mui/material/styles/createTheme'

export const consensusDecimals = 9
/**
Expand Down Expand Up @@ -213,3 +214,8 @@ export const specialScopePaths: Partial<Record<Network, Partial<Record<Layer, [s
[Network.mainnet]: {},
[Network.testnet]: {},
}

export const specialScopeThemes: Partial<Record<Network, Partial<Record<Layer, Theme>>>> = {
[Network.mainnet]: {},
[Network.testnet]: {},
}
4 changes: 4 additions & 0 deletions src/styles/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defaultTheme } from './defaultTheme'
import { testnetTheme } from './testnet/theme'
import type { Theme } from '@mui/material/styles/createTheme'
import { Layer } from '../../oasis-nexus/api'
import { specialScopeThemes } from '../../config'

export { defaultTheme } from './defaultTheme'
export { testnetTheme } from './testnet/theme'
Expand All @@ -11,6 +12,9 @@ export const tooltipDelay = 500
export const typingDelay = 1000

export const getThemeForScope = (network: Network, layer?: Layer): Theme => {
const specialTheme = layer ? specialScopeThemes[network]?.[layer] : undefined
if (specialTheme) return specialTheme

switch (network) {
case Network.mainnet:
return defaultTheme
Expand Down

0 comments on commit 04a6871

Please sign in to comment.