import { TChangeGasPrice, TChangeLanguage, TChangeNode } from 'actions/config'; import logo from 'assets/images/logo-myetherwallet.svg'; import { Dropdown, ColorDropdown } from 'components/ui'; import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { ANNOUNCEMENT_MESSAGE, ANNOUNCEMENT_TYPE, languages, NETWORKS, NODES, VERSION } from '../../config/data'; import GasPriceDropdown from './components/GasPriceDropdown'; import Navigation from './components/Navigation'; import { getKeyByValue } from 'utils/helpers'; import './index.scss'; interface Props { languageSelection: string; nodeSelection: string; gasPriceGwei: number; changeLanguage: TChangeLanguage; changeNode: TChangeNode; changeGasPrice: TChangeGasPrice; } export default class Header extends Component { public render() { const { languageSelection, changeNode, nodeSelection } = this.props; const selectedLanguage = languageSelection; const selectedNode = NODES[nodeSelection]; const selectedNetwork = NETWORKS[selectedNode.network]; const LanguageDropDown = Dropdown as new () => Dropdown< typeof selectedLanguage >; const nodeOptions = Object.keys(NODES).map(key => { return { value: key, name: ( {NODES[key].network} ({NODES[key].service}) ), color: NETWORKS[NODES[key].network].color }; }); return (
{ANNOUNCEMENT_MESSAGE && (
)}
{/* TODO - don't hardcode image path*/} MyEtherWallet
v{VERSION}
Disclaimer } onChange={this.changeLanguage} size="smr" color="white" />
Add Custom Node } onChange={changeNode} size="smr" color="white" />
); } public changeLanguage = (value: string) => { const key = getKeyByValue(languages, value); if (key) { this.props.changeLanguage(key); } }; }