forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
19 lines (15 loc) · 853 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2017-2020 @polkadot/apps-config authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { chainColors, nodeColors } from './general';
import { identityNodes } from './identityIcons';
function sanitize (value?: string): string {
return value?.toLowerCase().replace('-', ' ') || '';
}
export function getSystemIcon (systemName: string): 'beachball' | 'polkadot' | 'substrate' {
return (identityNodes[systemName.toLowerCase().replace(/-/g, ' ')] || 'substrate') as 'substrate';
}
export const getSystemChainColor = (systemChain: string, systemName: string): string | undefined => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return chainColors[sanitize(systemChain)] || nodeColors[sanitize(systemName)];
};