MyCrypto/common/containers/App/index.jsx

79 lines
1.7 KiB
React
Raw Normal View History

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