diff --git a/common/components/ElectronNav/ElectronNav.tsx b/common/components/ElectronNav/ElectronNav.tsx index 79f39f04..7f8a0ba7 100644 --- a/common/components/ElectronNav/ElectronNav.tsx +++ b/common/components/ElectronNav/ElectronNav.tsx @@ -54,6 +54,7 @@ class ElectronNav extends React.Component { link={link} isHomepage={link === navigationLinks[0]} className="ElectronNavLink" + isNotEnabled={false} /> ))} diff --git a/common/components/Header/components/Navigation.tsx b/common/components/Header/components/Navigation.tsx index efc44564..90c164c9 100644 --- a/common/components/Header/components/Navigation.tsx +++ b/common/components/Header/components/Navigation.tsx @@ -3,9 +3,11 @@ import React, { PureComponent } from 'react'; import { navigationLinks } from 'config'; import NavigationLink from 'components/NavigationLink'; import './Navigation.scss'; +import { TAB } from './constants'; interface Props { color?: string | false; + unsupportedTabs?: TAB[]; } interface State { @@ -30,7 +32,7 @@ export default class Navigation extends PureComponent { */ public render() { - const { color } = this.props; + const { color, unsupportedTabs } = this.props; const borderStyle: BorderStyle = {}; if (color) { @@ -58,6 +60,9 @@ export default class Navigation extends PureComponent { link={link} isHomepage={link === navigationLinks[0]} className="NavigationLink" + isNotEnabled={ + unsupportedTabs && unsupportedTabs.map(tab => tab.toString()).includes(link.name) + } /> ))} diff --git a/common/components/Header/components/constants.ts b/common/components/Header/components/constants.ts new file mode 100644 index 00000000..9d24d6d2 --- /dev/null +++ b/common/components/Header/components/constants.ts @@ -0,0 +1,10 @@ +export enum TAB { + VIEW = 'NAV_VIEW', + CREATE = 'NAV_GENERATEWALLET', + SWAP = 'NAV_SWAP', + CONTRACTS = 'NAV_CONTRACTS', + ENS = 'NAV_ENS', + SIGN = 'NAV_SIGN', + TXSTATUS = 'NAV_TXSTATUS', + BROADCAST = 'NAV_BROADCAST' +} diff --git a/common/components/Header/index.tsx b/common/components/Header/index.tsx index ac1eed4f..6bf5332f 100644 --- a/common/components/Header/index.tsx +++ b/common/components/Header/index.tsx @@ -122,7 +122,10 @@ class Header extends Component { - + { link: NavigationLink; isHomepage: boolean; className: string; + isNotEnabled?: boolean; } class NavigationLinkClass extends React.PureComponent { public render() { - const { link, location, isHomepage, className } = this.props; + const { link, location, isHomepage, className, isNotEnabled } = this.props; let isActive = false; + if (isNotEnabled) { + return null; + } + if (!link.external) { // isActive if // 1) Current path is the same as link diff --git a/shared/types/network.d.ts b/shared/types/network.d.ts index 8a7a8554..fd609964 100644 --- a/shared/types/network.d.ts +++ b/shared/types/network.d.ts @@ -1,3 +1,5 @@ +import { TAB } from 'components/Header/components/constants'; + type StaticNetworkIds = | 'ETH' | 'Ropsten' @@ -70,6 +72,7 @@ interface StaticNetworkConfig { isTestnet?: boolean; gasPriceSettings: GasPriceSetting; shouldEstimateGasPrice?: boolean; + unsupportedTabs?: TAB[]; } interface CustomNetworkConfig { @@ -80,6 +83,7 @@ interface CustomNetworkConfig { unit: string; chainId: number; dPathFormats: DPathFormats | null; + unsupportedTabs?: TAB[]; } type NetworkConfig = CustomNetworkConfig | StaticNetworkConfig;