2017-09-25 02:06:28 +00:00
|
|
|
import { TChangeGasPrice, TChangeLanguage, TChangeNode } from 'actions/config';
|
|
|
|
import logo from 'assets/images/logo-myetherwallet.svg';
|
|
|
|
import { Dropdown } from 'components/ui';
|
2017-05-23 23:06:01 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Link } from 'react-router';
|
2017-08-25 07:37:36 +00:00
|
|
|
import {
|
2017-09-25 02:06:28 +00:00
|
|
|
ANNOUNCEMENT_MESSAGE,
|
|
|
|
ANNOUNCEMENT_TYPE,
|
2017-08-25 07:37:36 +00:00
|
|
|
languages,
|
2017-09-20 00:47:08 +00:00
|
|
|
NETWORKS,
|
2017-09-25 02:06:28 +00:00
|
|
|
NODES,
|
|
|
|
VERSION
|
2017-08-25 07:37:36 +00:00
|
|
|
} from '../../config/data';
|
2017-09-25 02:06:28 +00:00
|
|
|
import GasPriceDropdown from './components/GasPriceDropdown';
|
|
|
|
import Navigation from './components/Navigation';
|
2017-09-26 23:03:38 +00:00
|
|
|
import { getKeyByValue } from 'utils/helpers';
|
2017-07-15 04:16:36 +00:00
|
|
|
import './index.scss';
|
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
interface Props {
|
|
|
|
location: {};
|
|
|
|
languageSelection: string;
|
|
|
|
nodeSelection: string;
|
|
|
|
gasPriceGwei: number;
|
2017-06-18 19:56:12 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
changeLanguage: TChangeLanguage;
|
|
|
|
changeNode: TChangeNode;
|
|
|
|
changeGasPrice: TChangeGasPrice;
|
|
|
|
}
|
2017-04-12 05:04:27 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
export default class Header extends Component<Props, {}> {
|
|
|
|
public render() {
|
2017-07-04 03:21:19 +00:00
|
|
|
const { languageSelection, changeNode, nodeSelection } = this.props;
|
2017-09-26 23:03:38 +00:00
|
|
|
const selectedLanguage = languageSelection;
|
2017-07-04 03:21:19 +00:00
|
|
|
const selectedNode = NODES[nodeSelection];
|
2017-09-20 00:47:08 +00:00
|
|
|
const selectedNetwork = NETWORKS[selectedNode.network];
|
2017-09-25 02:06:28 +00:00
|
|
|
const LanguageDropDown = Dropdown as new () => Dropdown<
|
|
|
|
typeof selectedLanguage
|
|
|
|
>;
|
|
|
|
const NodeDropDown = Dropdown as new () => Dropdown<keyof typeof NODES>;
|
2017-07-02 05:49:06 +00:00
|
|
|
return (
|
2017-07-15 04:16:36 +00:00
|
|
|
<div className="Header">
|
2017-09-25 02:06:28 +00:00
|
|
|
{ANNOUNCEMENT_MESSAGE && (
|
2017-08-25 07:37:36 +00:00
|
|
|
<div
|
|
|
|
className={`Header-announcement is-${ANNOUNCEMENT_TYPE}`}
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: ANNOUNCEMENT_MESSAGE
|
|
|
|
}}
|
2017-09-25 02:06:28 +00:00
|
|
|
/>
|
|
|
|
)}
|
2017-08-25 07:37:36 +00:00
|
|
|
|
2017-07-15 04:16:36 +00:00
|
|
|
<section className="Header-branding">
|
|
|
|
<section className="Header-branding-inner container">
|
|
|
|
<Link
|
|
|
|
to={'/'}
|
|
|
|
className="Header-branding-title"
|
|
|
|
aria-label="Go to homepage"
|
|
|
|
>
|
|
|
|
{/* TODO - don't hardcode image path*/}
|
|
|
|
<img
|
|
|
|
className="Header-branding-title-logo"
|
|
|
|
src={logo}
|
|
|
|
height="64px"
|
|
|
|
width="245px"
|
|
|
|
alt="MyEtherWallet"
|
|
|
|
/>
|
2017-07-02 05:49:06 +00:00
|
|
|
</Link>
|
2017-07-15 04:16:36 +00:00
|
|
|
<div className="Header-branding-title-tagline">
|
2017-08-25 07:37:36 +00:00
|
|
|
<span className="Header-branding-title-tagline-version">
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
v{VERSION}
|
2017-07-02 05:49:06 +00:00
|
|
|
</span>
|
2017-07-15 04:16:36 +00:00
|
|
|
|
2017-07-20 17:06:10 +00:00
|
|
|
<GasPriceDropdown
|
|
|
|
value={this.props.gasPriceGwei}
|
|
|
|
onChange={this.props.changeGasPrice}
|
|
|
|
/>
|
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
<LanguageDropDown
|
2017-09-26 23:03:38 +00:00
|
|
|
ariaLabel={`change language. current language ${languages[
|
|
|
|
selectedLanguage
|
|
|
|
]}`}
|
|
|
|
options={Object.values(languages)}
|
|
|
|
value={languages[selectedLanguage]}
|
2017-07-02 05:49:06 +00:00
|
|
|
extra={[
|
|
|
|
<li key={'separator'} role="separator" className="divider" />,
|
|
|
|
<li key={'disclaimer'}>
|
|
|
|
<a data-toggle="modal" data-target="#disclaimerModal">
|
|
|
|
Disclaimer
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
]}
|
2017-07-04 03:21:19 +00:00
|
|
|
onChange={this.changeLanguage}
|
2017-07-02 05:49:06 +00:00
|
|
|
/>
|
2017-07-15 04:16:36 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
<NodeDropDown
|
2017-07-04 03:21:19 +00:00
|
|
|
ariaLabel={`change node. current node ${selectedNode.network} node by ${selectedNode.service}`}
|
|
|
|
options={Object.keys(NODES)}
|
2017-09-25 02:06:28 +00:00
|
|
|
formatTitle={this.nodeNetworkAndService}
|
2017-07-02 05:49:06 +00:00
|
|
|
value={nodeSelection}
|
|
|
|
extra={
|
|
|
|
<li>
|
2017-09-25 02:06:28 +00:00
|
|
|
<a>Add Custom Node</a>
|
2017-07-02 05:49:06 +00:00
|
|
|
</li>
|
|
|
|
}
|
|
|
|
onChange={changeNode}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</section>
|
2017-04-18 23:36:29 +00:00
|
|
|
|
2017-09-20 00:47:08 +00:00
|
|
|
<Navigation
|
|
|
|
location={this.props.location}
|
2017-09-26 23:03:38 +00:00
|
|
|
color={selectedNetwork.color}
|
2017-09-20 00:47:08 +00:00
|
|
|
/>
|
2017-07-02 05:49:06 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-07-04 01:25:01 +00:00
|
|
|
|
2017-09-26 23:03:38 +00:00
|
|
|
public changeLanguage = (value: string) => {
|
|
|
|
const key = getKeyByValue(languages, value);
|
|
|
|
if (key) {
|
|
|
|
this.props.changeLanguage(key);
|
|
|
|
}
|
2017-07-04 03:21:19 +00:00
|
|
|
};
|
2017-09-25 02:06:28 +00:00
|
|
|
|
|
|
|
private nodeNetworkAndService = (option: string) => [
|
|
|
|
NODES[option].network,
|
|
|
|
' ',
|
|
|
|
<small key="service">({NODES[option].service}) </small>
|
|
|
|
];
|
2017-04-12 05:04:27 +00:00
|
|
|
}
|