MyCrypto/common/containers/App/index.jsx

79 lines
1.7 KiB
React
Raw Normal View History

2017-05-24 15:39:58 -07:00
// @flow
2017-05-23 16:06:01 -07:00
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Footer, Header, AlphaAgreement } from 'components';
2017-06-21 16:31:59 -07:00
import Notifications from './Notifications';
2017-07-03 18:25:01 -07:00
import * as actions from 'actions/config';
2017-04-11 22:04:27 -07:00
class App extends Component {
2017-07-03 20:21:19 -07:00
props: {
// FIXME
children: any,
location: any,
router: any,
isMobile: boolean,
2017-07-03 20:21:19 -07:00
languageSelection: string,
nodeSelection: string,
gasPriceGwei: number,
2017-07-03 20:21:19 -07:00
changeLanguage: typeof actions.changeLanguage,
changeNode: typeof actions.changeNode,
changeGasPrice: typeof actions.changeGasPrice,
2017-07-03 20:21:19 -07:00
handleWindowResize: () => void
};
2017-07-03 20:21:19 -07:00
render() {
let {
children,
// APP
nodeSelection,
2017-07-03 20:21:19 -07:00
languageSelection,
gasPriceGwei,
2017-07-03 20:21:19 -07:00
changeLanguage,
changeNode,
changeGasPrice
2017-07-03 20:21:19 -07:00
} = this.props;
2017-06-21 16:31:59 -07:00
2017-07-03 20:21:19 -07:00
let headerProps = {
location,
languageSelection,
nodeSelection,
gasPriceGwei,
changeLanguage,
2017-07-03 20:21:19 -07:00
changeNode,
changeGasPrice
2017-05-23 16:06:01 -07:00
};
2017-04-11 22:04:27 -07:00
2017-07-03 20:21:19 -07:00
return (
<div className="page-layout">
<main>
<Header {...headerProps} />
<div className="Tab container">
2017-07-03 20:21:19 -07:00
{React.cloneElement(children, { languageSelection })}
</div>
<Footer />
</main>
<Notifications />
<AlphaAgreement />
2017-07-03 20:21:19 -07:00
</div>
);
}
2017-04-11 22:04:27 -07:00
}
function mapStateToProps(state) {
2017-07-03 20:21:19 -07:00
return {
nodeSelection: state.config.nodeSelection,
nodeToggle: state.config.nodeToggle,
languageSelection: state.config.languageSelection,
languageToggle: state.config.languageToggle,
gasPriceGwei: state.config.gasPriceGwei
2017-07-03 20:21:19 -07:00
};
2017-04-11 22:04:27 -07:00
}
2017-07-03 18:25:01 -07:00
export default connect(mapStateToProps, actions)(App);