From fbe90b45de170af250dd5ec82fbc0ba9790dafb0 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 5 Jun 2024 02:13:25 +0200 Subject: [PATCH] Add support for adding custom themes for specific paratimes --- src/config.ts | 6 ++++++ src/styles/theme/index.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/config.ts b/src/config.ts index 527106b3a..92ad4e2bb 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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 /** @@ -213,3 +214,8 @@ export const specialScopePaths: Partial>>> = { + [Network.mainnet]: {}, + [Network.testnet]: {}, +} diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts index da7188d3a..aabd697fd 100644 --- a/src/styles/theme/index.ts +++ b/src/styles/theme/index.ts @@ -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' @@ -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